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

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwContents.java

Issue 1831373003: aw: Remove WindowAndroid caching (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/java/src/org/chromium/android_webview/AwContents.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java
index 046ccfccecb9e2b2281b33dc4b7e558345fc8cc6..13326792ff3b8bc9c673f6f4854698b0caf3b303 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContents.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
@@ -82,7 +82,6 @@ import java.net.URL;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
-import java.util.WeakHashMap;
import java.util.concurrent.Callable;
/**
@@ -921,31 +920,16 @@ public class AwContents implements SmartClipProvider,
return mWindowAndroid;
}
}
- private static WindowAndroidWrapper sCachedWindowAndroid;
- private static WeakHashMap<Context, WindowAndroidWrapper> sActivityContextWindowMap;
- // getWindowAndroid is only called on UI thread, so there are no threading issues with lazy
- // initialization.
- @SuppressFBWarnings("LI_LAZY_INIT_STATIC")
- private static WindowAndroidWrapper getWindowAndroid(Context context) {
+ private static WindowAndroidWrapper createWindowAndroid(Context context) {
// TODO(boliu): WebView does not currently initialize ApplicationStatus, crbug.com/470582.
boolean contextWrapsActivity = activityFromContext(context) != null;
if (!contextWrapsActivity) {
- if (sCachedWindowAndroid == null) {
- sCachedWindowAndroid = new WindowAndroidWrapper(new WindowAndroid(context));
- }
- return sCachedWindowAndroid;
+ return new WindowAndroidWrapper(new WindowAndroid(context));
}
- if (sActivityContextWindowMap == null) sActivityContextWindowMap = new WeakHashMap<>();
- WindowAndroidWrapper activityWindowAndroid = sActivityContextWindowMap.get(context);
- if (activityWindowAndroid == null) {
- final boolean listenToActivityState = false;
- activityWindowAndroid = new WindowAndroidWrapper(
- new ActivityWindowAndroid(context, listenToActivityState));
- sActivityContextWindowMap.put(context, activityWindowAndroid);
- }
- return activityWindowAndroid;
+ final boolean listenToActivityState = false;
+ return new WindowAndroidWrapper(new ActivityWindowAndroid(context, listenToActivityState));
}
@VisibleForTesting
@@ -979,7 +963,7 @@ public class AwContents implements SmartClipProvider,
WebContents webContents = nativeGetWebContents(mNativeAwContents);
- mWindowAndroid = getWindowAndroid(mContext);
+ mWindowAndroid = createWindowAndroid(mContext);
mContentViewCore = createAndInitializeContentViewCore(mContainerView, mContext,
mInternalAccessAdapter, webContents, new AwGestureStateListener(),
mContentViewClient, mZoomControls, mWindowAndroid.getWindowAndroid());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698