This repository has been archived by the owner on Apr 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
branch 2357: Fix leak from android Context
The Activity, which is normally the Context instance, holds the view tree, which in turns can prevent native side from garbage collected. So native code cannot hold strongly to the Context object. There are two instances where Context is leaking: 1) Currently native holds ContentViewAndroidDelegate which holds the Context. Stop holding the Context and just use get the context for the container view, which is already held weakly. This means acquireAnchorView can return null when the java peer has been garbage collected, but native side has not been destroyed yet. This is never a problem in chrome. This happens to not be a problem in webview, because all callers of acquireAnchorView already guarantees the ContentViewCore is still alive. 2) CaptionManager uses the Context (instead of Application Context) and never unregisters it in WebView. This keeps a dangling reference all the way to the Context used to register in Android framework code. In this CL, only fix the webview leak by using the Application Context. There is still the problem that the CaptionManager is unregistered which will be fixed in the future. Modify the webview gc test to catch this case. BUG=478719, 469803 Review URL: https://codereview.chromium.org/1092323002 Cr-Commit-Position: refs/heads/master@{#325961} (cherry picked from commit 157d438) TBR=boliu@chromium.org Review URL: https://codereview.chromium.org/1050823005 Cr-Commit-Position: refs/branch-heads/2357@{#176} Cr-Branched-From: 59d4494-refs/heads/master@{#323860}
- Loading branch information
Bo Liu
committed
Apr 21, 2015
1 parent
5aba40c
commit e9e41f7
Showing
3 changed files
with
109 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters