-
Notifications
You must be signed in to change notification settings - Fork 1
[Android] IAB 종료시 발생하는 메모리 누수 수정 #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary of Changes
Hello @zb-sj, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
이 PR은 Android InAppBrowser 종료 시 발생하는 메모리 누수를 수정하고, iOS InAppBrowser에서 전화번호, SMS, 이메일, 지리적 위치 스키마를 시스템이 처리하도록 지원을 추가합니다. 또한, 플러그인 및 테스트 패키지의 버전이 5.0.1-dev로 업데이트되었습니다.
Highlights
- Android 메모리 누수 수정: about:blank URL이 로드될 때 inAppWebView 객체를 명시적으로 일시 중지하고, 모든 뷰를 제거하며, 드로잉 캐시를 파괴하고, 웹뷰 자체를 파괴한 후 null로 설정하여 메모리 누수를 방지합니다. 이는 기존에 보고된 이슈를 해결합니다.
- iOS 스키마 지원 확장: CDVWKInAppBrowser.m 파일에서 itms-appss 및 itms-apps 외에 tel, sms, mailto, geo 스키마도 시스템이 처리하도록 허용하여, InAppBrowser 내에서 해당 링크가 제대로 작동하지 않던 문제를 해결합니다.
- 버전 업데이트: package.json 및 plugin.xml 파일과 테스트 패키지의 해당 파일들이 5.0.0에서 5.0.1-dev로 업데이트되었습니다.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
이 PR은 Android에서 In-App Browser를 닫을 때 발생하는 메모리 누수를 수정하고, iOS에서 tel
, sms
등 추가적인 URL 스킴을 지원하도록 개선하는 두 가지 중요한 변경 사항을 포함하고 있습니다.
전반적으로 좋은 변경이지만, 코드의 안정성과 성능을 더욱 향상시킬 수 있는 몇 가지 점을 발견하여 리뷰 코멘트를 남겼습니다.
- Android:
WebView
를 파괴하는 로직에서 발생할 수 있는 잠재적인 경합 상태를 방지하고, 문자열 비교를 더 안전하고 효율적으로 수정할 것을 제안했습니다. - iOS: 자주 호출되는 델리게이트 메서드 내에서
NSArray
가 반복적으로 생성되는 것을 방지하여 성능을 개선하도록static const
로 변경할 것을 제안했습니다.
이 제안들이 코드 품질을 높이는 데 도움이 되기를 바랍니다.
if (url.equals(new String("about:blank"))) { | ||
inAppWebView.onPause(); | ||
inAppWebView.removeAllViews(); | ||
inAppWebView.destroyDrawingCache(); | ||
inAppWebView.destroy(); | ||
inAppWebView = null; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 코드는 몇 가지 잠재적인 문제를 가지고 있습니다.
new String("about:blank")
는 호출될 때마다 불필요한 새 문자열 객체를 생성합니다. 문자열 리터럴"about:blank"
를 직접 사용하는 것이 더 효율적입니다.url.equals(...)
는url
이null
일 경우NullPointerException
을 발생시킬 수 있습니다."about:blank".equals(url)
과 같이 리터럴에 대해equals
를 호출하는 것이 더 안전합니다.onPageFinished
콜백 내에서 인스턴스 변수인inAppWebView
를 직접 사용하면 경합 상태(race condition)가 발생할 수 있습니다. 예를 들어, 이WebView
가 닫히기 전에 다른InAppBrowser
가 열리면inAppWebView
는 새WebView
를 가리키게 되어, 결국 잘못된WebView
를 닫게 될 수 있습니다. 콜백의view
파라미터를 사용하여 올바른WebView
인스턴스를 조작해야 합니다.
if ("about:blank".equals(url)) {
view.onPause();
view.removeAllViews();
view.destroyDrawingCache();
view.destroy();
if (inAppWebView == view) {
inAppWebView = null;
}
}
NSArray * allowedSchemes = @[@"itms-appss", @"itms-apps", @"tel", @"sms", @"mailto", @"geo"]; | ||
if ([allowedSchemes containsObject:[url scheme]]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
decidePolicyForNavigationAction:
델리게이트 메서드는 페이지 로딩 중에 자주 호출될 수 있습니다. allowedSchemes
배열을 매번 새로 생성하는 것은 비효율적입니다.
이 배열을 static const
로 선언하여 앱의 생명주기 동안 한 번만 생성되도록 하는 것이 좋습니다. 이렇게 하면 불필요한 객체 할당을 줄여 성능을 향상시킬 수 있습니다.
NSArray * allowedSchemes = @[@"itms-appss", @"itms-apps", @"tel", @"sms", @"mailto", @"geo"]; | |
if ([allowedSchemes containsObject:[url scheme]]) { | |
static NSArray * const allowedSchemes = @[@"itms-appss", @"itms-apps", @"tel", @"sms", @"mailto", @"geo"]; | |
if ([allowedSchemes containsObject:[url scheme]]) { |
그 외 전화번호 등 scheme 지원 포함