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

Side by Side Diff: android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java

Issue 1078693003: android_webview: stop leaking Contexts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « android_webview/glue/java/src/com/android/webview/chromium/ResourcesContextWrapperFactory.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package com.android.webview.chromium; 5 package com.android.webview.chromium;
6 6
7 import android.app.ActivityManager; 7 import android.app.ActivityManager;
8 import android.content.ComponentCallbacks2; 8 import android.content.ComponentCallbacks2;
9 import android.content.Context; 9 import android.content.Context;
10 import android.content.Intent; 10 import android.content.Intent;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 72
73 // Initialization guarded by mLock. 73 // Initialization guarded by mLock.
74 private AwBrowserContext mBrowserContext; 74 private AwBrowserContext mBrowserContext;
75 private Statics mStaticMethods; 75 private Statics mStaticMethods;
76 private GeolocationPermissionsAdapter mGeolocationPermissions; 76 private GeolocationPermissionsAdapter mGeolocationPermissions;
77 private CookieManagerAdapter mCookieManager; 77 private CookieManagerAdapter mCookieManager;
78 private WebIconDatabaseAdapter mWebIconDatabase; 78 private WebIconDatabaseAdapter mWebIconDatabase;
79 private WebStorageAdapter mWebStorage; 79 private WebStorageAdapter mWebStorage;
80 private WebViewDatabaseAdapter mWebViewDatabase; 80 private WebViewDatabaseAdapter mWebViewDatabase;
81 private AwDevToolsServer mDevToolsServer; 81 private AwDevToolsServer mDevToolsServer;
82 private Context mWrappedAppContext;
82 83
83 private ArrayList<WeakReference<WebViewChromium>> mWebViewsToStart = 84 private ArrayList<WeakReference<WebViewChromium>> mWebViewsToStart =
84 new ArrayList<WeakReference<WebViewChromium>>(); 85 new ArrayList<WeakReference<WebViewChromium>>();
85 86
86 // Read/write protected by mLock. 87 // Read/write protected by mLock.
87 private boolean mStarted; 88 private boolean mStarted;
88 private AwDataReductionProxyManager mProxyManager; 89 private AwDataReductionProxyManager mProxyManager;
89 90
90 private SharedPreferences mWebViewPrefs; 91 private SharedPreferences mWebViewPrefs;
91 private WebViewDelegate mWebViewDelegate; 92 private WebViewDelegate mWebViewDelegate;
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 return mStarted; 285 return mStarted;
285 } 286 }
286 287
287 void startYourEngines(boolean onMainThread) { 288 void startYourEngines(boolean onMainThread) {
288 synchronized (mLock) { 289 synchronized (mLock) {
289 ensureChromiumStartedLocked(onMainThread); 290 ensureChromiumStartedLocked(onMainThread);
290 } 291 }
291 } 292 }
292 293
293 private Context getWrappedCurrentApplicationContext() { 294 private Context getWrappedCurrentApplicationContext() {
294 return ResourcesContextWrapperFactory.get(mWebViewDelegate.getApplicatio n()); 295 if (mWrappedAppContext == null) {
296 mWrappedAppContext = ResourcesContextWrapperFactory.get(
297 mWebViewDelegate.getApplication());
298 }
299 return mWrappedAppContext;
295 } 300 }
296 301
297 AwBrowserContext getBrowserContext() { 302 AwBrowserContext getBrowserContext() {
298 synchronized (mLock) { 303 synchronized (mLock) {
299 return getBrowserContextLocked(); 304 return getBrowserContextLocked();
300 } 305 }
301 } 306 }
302 307
303 private AwBrowserContext getBrowserContextLocked() { 308 private AwBrowserContext getBrowserContextLocked() {
304 assert Thread.holdsLock(mLock); 309 assert Thread.holdsLock(mLock);
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 browserContext.getHttpAuthDatabase(context)); 467 browserContext.getHttpAuthDatabase(context));
463 } 468 }
464 } 469 }
465 return mWebViewDatabase; 470 return mWebViewDatabase;
466 } 471 }
467 472
468 WebViewDelegate getWebViewDelegate() { 473 WebViewDelegate getWebViewDelegate() {
469 return mWebViewDelegate; 474 return mWebViewDelegate;
470 } 475 }
471 } 476 }
OLDNEW
« no previous file with comments | « android_webview/glue/java/src/com/android/webview/chromium/ResourcesContextWrapperFactory.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698