Fix webview memory leak when keyboard was shown
Android framework does not seem to release ResultReceiver passed in InputMethodManager#showSoftInput() after use. As a result, WebView will not be garbage collected after it's removed, if keyboard shows up on the screen once. ResultReceiver cannot be avoided since we want to scroll to the editable node only after input method window shows up. This is a fix to weak-reference CVC object (and thus WebView as well) from ResultReceiver. Unfortunately, ResultReceiver will still be leaked, but the leak can be significantly reduced. A test is added to AwContentsGarbageCollectionTest to test that references to WebView can be removed even when showSoftInput() is called before garbage collection. Also, I've manually tested that the new test can catch the memory leak issue when we strong-reference CVC. BUG=595613 Review URL: https://codereview.chromium.org/1809013002 Cr-Commit-Position: refs/heads/master@{#381891}
Showing
Please register or sign in to comment