Chromium Code Reviews| Index: ui/android/java/src/org/chromium/ui/base/WindowAndroid.java |
| diff --git a/ui/android/java/src/org/chromium/ui/base/WindowAndroid.java b/ui/android/java/src/org/chromium/ui/base/WindowAndroid.java |
| index 27579e6e3ad4a3888f486f246f4f13e1c17e0c20..43091e9f2f6dd9a485474703c5e2db9df14f8e7a 100644 |
| --- a/ui/android/java/src/org/chromium/ui/base/WindowAndroid.java |
| +++ b/ui/android/java/src/org/chromium/ui/base/WindowAndroid.java |
| @@ -76,6 +76,7 @@ public class WindowAndroid { |
| protected Context mApplicationContext; |
| protected SparseArray<IntentCallback> mOutstandingIntents; |
| + protected WeakReference<Context> mDisplayContextRef; |
|
boliu
2015/07/15 06:38:47
Add comment why this is needed
gsennton
2015/07/15 19:26:21
Done.
|
| // Ideally, this would be a SparseArray<String>, but there's no easy way to store a |
| // SparseArray<String> in a bundle during saveInstanceState(). So we use a HashMap and suppress |
| @@ -131,12 +132,13 @@ public class WindowAndroid { |
| * @param context The application context. |
| */ |
| @SuppressLint("UseSparseArrays") |
| - public WindowAndroid(Context context) { |
| + public WindowAndroid(Context context, Context displayContext) { |
|
boliu
2015/07/15 06:38:46
Only need |displayContext|. |context| is always di
gsennton
2015/07/15 19:26:21
Done.
|
| assert context == context.getApplicationContext(); |
| mApplicationContext = context; |
| + mDisplayContextRef = new WeakReference<Context>(displayContext); |
| mOutstandingIntents = new SparseArray<IntentCallback>(); |
| mIntentErrors = new HashMap<Integer, String>(); |
| - mVSyncMonitor = new VSyncMonitor(context, mVSyncListener); |
| + mVSyncMonitor = new VSyncMonitor(displayContext, mVSyncListener); |
| mAccessibilityManager = (AccessibilityManager) |
| context.getSystemService(Context.ACCESSIBILITY_SERVICE); |
| } |
| @@ -562,6 +564,11 @@ public class WindowAndroid { |
| }); |
| } |
| + @CalledByNative |
| + public Context getDisplayContext() { |
|
boliu
2015/07/15 06:38:46
private
Why is this needed at all?
gsennton
2015/07/15 19:26:21
To be called from the native side when creating th
|
| + return mDisplayContextRef.get(); |
| + } |
| + |
| /** |
| * Update whether the placeholder is 'drawn' based on whether an animation is running |
| * or touch exploration is enabled - if either of those are true, we call |