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

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

Issue 1056113004: android_webview: stop leaking Contexts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2311
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 // Initialization guarded by mLock. 72 // Initialization guarded by mLock.
73 private AwBrowserContext mBrowserContext; 73 private AwBrowserContext mBrowserContext;
74 private Statics mStaticMethods; 74 private Statics mStaticMethods;
75 private GeolocationPermissionsAdapter mGeolocationPermissions; 75 private GeolocationPermissionsAdapter mGeolocationPermissions;
76 private CookieManagerAdapter mCookieManager; 76 private CookieManagerAdapter mCookieManager;
77 private WebIconDatabaseAdapter mWebIconDatabase; 77 private WebIconDatabaseAdapter mWebIconDatabase;
78 private WebStorageAdapter mWebStorage; 78 private WebStorageAdapter mWebStorage;
79 private WebViewDatabaseAdapter mWebViewDatabase; 79 private WebViewDatabaseAdapter mWebViewDatabase;
80 private AwDevToolsServer mDevToolsServer; 80 private AwDevToolsServer mDevToolsServer;
81 private Context mWrappedAppContext;
81 82
82 private ArrayList<WeakReference<WebViewChromium>> mWebViewsToStart = 83 private ArrayList<WeakReference<WebViewChromium>> mWebViewsToStart =
83 new ArrayList<WeakReference<WebViewChromium>>(); 84 new ArrayList<WeakReference<WebViewChromium>>();
84 85
85 // Read/write protected by mLock. 86 // Read/write protected by mLock.
86 private boolean mStarted; 87 private boolean mStarted;
87 private AwDataReductionProxyManager mProxyManager; 88 private AwDataReductionProxyManager mProxyManager;
88 89
89 private SharedPreferences mWebViewPrefs; 90 private SharedPreferences mWebViewPrefs;
90 private WebViewDelegate mWebViewDelegate; 91 private WebViewDelegate mWebViewDelegate;
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 return mStarted; 284 return mStarted;
284 } 285 }
285 286
286 void startYourEngines(boolean onMainThread) { 287 void startYourEngines(boolean onMainThread) {
287 synchronized (mLock) { 288 synchronized (mLock) {
288 ensureChromiumStartedLocked(onMainThread); 289 ensureChromiumStartedLocked(onMainThread);
289 } 290 }
290 } 291 }
291 292
292 private Context getWrappedCurrentApplicationContext() { 293 private Context getWrappedCurrentApplicationContext() {
293 return ResourcesContextWrapperFactory.get(mWebViewDelegate.getApplicatio n()); 294 if (mWrappedAppContext == null) {
295 mWrappedAppContext = ResourcesContextWrapperFactory.get(
296 mWebViewDelegate.getApplication());
297 }
298 return mWrappedAppContext;
294 } 299 }
295 300
296 AwBrowserContext getBrowserContext() { 301 AwBrowserContext getBrowserContext() {
297 synchronized (mLock) { 302 synchronized (mLock) {
298 return getBrowserContextLocked(); 303 return getBrowserContextLocked();
299 } 304 }
300 } 305 }
301 306
302 private AwBrowserContext getBrowserContextLocked() { 307 private AwBrowserContext getBrowserContextLocked() {
303 assert Thread.holdsLock(mLock); 308 assert Thread.holdsLock(mLock);
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 browserContext.getHttpAuthDatabase(context)); 475 browserContext.getHttpAuthDatabase(context));
471 } 476 }
472 } 477 }
473 return mWebViewDatabase; 478 return mWebViewDatabase;
474 } 479 }
475 480
476 WebViewDelegate getWebViewDelegate() { 481 WebViewDelegate getWebViewDelegate() {
477 return mWebViewDelegate; 482 return mWebViewDelegate;
478 } 483 }
479 } 484 }
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