Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Issue 1078693003: android_webview: stop leaking Contexts. (Closed)

Created:
5 years, 8 months ago by Torne
Modified:
5 years, 8 months ago
CC:
chromium-reviews, android-webview-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

android_webview: stop leaking Contexts. We were leaking activity Contexts in ResourcesContextWrapperFactory's cache of wrapped contexts, because WeakHashMap only references its *keys* weakly, and the ContextWrapper objects used as values in the hashmap have a strong reference to the Context being used as a key, so nothing was ever removed from the map. Fix this by deleting the cache entirely, as it's not really necessary; the number of wrapped contexts we create is already bounded to two per WebView (one for the activity context and one for the application context), and the objects are very small, so it's not worth the complexity of trying to avoid lifetime issues while reusing them. We do still need to ensure that WebViewChromiumFactoryProvider always uses the same wrapper for the application context, though, since in some initialisation paths we set the application context more than once and the underlying code only permits that if the same context object is used each time. BUG=473146 Committed: https://crrev.com/33f1cb1b80896a97041e4b87457e4f036d7a7ad9 Cr-Commit-Position: refs/heads/master@{#324425}

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+64 lines, -63 lines) Patch
M android_webview/glue/java/src/com/android/webview/chromium/ResourcesContextWrapperFactory.java View 1 chunk +58 lines, -62 lines 0 comments Download
M android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java View 2 chunks +6 lines, -1 line 0 comments Download

Messages

Total messages: 7 (2 generated)
Torne
5 years, 8 months ago (2015-04-09 13:02:58 UTC) #2
mnaganov (inactive)
lgtm
5 years, 8 months ago (2015-04-09 13:07:31 UTC) #3
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1078693003/1
5 years, 8 months ago (2015-04-09 13:16:38 UTC) #5
commit-bot: I haz the power
Committed patchset #1 (id:1)
5 years, 8 months ago (2015-04-09 13:25:21 UTC) #6
commit-bot: I haz the power
5 years, 8 months ago (2015-04-09 13:26:10 UTC) #7
Message was sent while issue was closed.
Patchset 1 (id:??) landed as
https://crrev.com/33f1cb1b80896a97041e4b87457e4f036d7a7ad9
Cr-Commit-Position: refs/heads/master@{#324425}

Powered by Google App Engine
This is Rietveld 408576698