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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ContentView.java

Issue 2613863006: Add a ThreadLocal flag to replace the reflection in shouldTriggerDelayedOnCreateInputConnection() (Closed)
Patch Set: fix cast error Created 3 years, 11 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
Index: content/public/android/java/src/org/chromium/content/browser/ContentView.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentView.java b/content/public/android/java/src/org/chromium/content/browser/ContentView.java
index a0857e026c85160b93e9389a17f5edfa4d0abb5d..a1f35b346c9c6771c281672df48ba246a1b8c30b 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ContentView.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentView.java
@@ -24,6 +24,7 @@ import android.widget.FrameLayout;
import org.chromium.base.Log;
import org.chromium.base.TraceEvent;
+import org.chromium.base.annotations.SuppressFBWarnings;
/**
* The containing view for {@link ContentViewCore} that exists in the Android UI hierarchy and
@@ -47,6 +48,19 @@ public class ContentView extends FrameLayout
private int mDesiredWidthMeasureSpec = DEFAULT_MEASURE_SPEC;
private int mDesiredHeightMeasureSpec = DEFAULT_MEASURE_SPEC;
+ private static ThreadLocal<Boolean> sTriggerDelayedOnCreateInputConnection =
+ new ThreadLocal<Boolean>() {
+ @SuppressFBWarnings("CHROMIUM_SYNCHRONIZED_METHOD")
+ @Override
+ protected synchronized Boolean initialValue() {
+ return true;
+ }
+ };
+
+ public void setTriggerDelayedOnCreateInputConnection(final boolean trigger) {
+ sTriggerDelayedOnCreateInputConnection.set(trigger);
+ }
+
/**
* Constructs a new ContentView for the appropriate Android version.
* @param context The Context the view is running in, through which it can
@@ -140,6 +154,8 @@ public class ContentView extends FrameLayout
@Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
+ mContentViewCore.setTriggerDelayedOnCreateInputConnection(
+ sTriggerDelayedOnCreateInputConnection.get());
return mContentViewCore.onCreateInputConnection(outAttrs);
}

Powered by Google App Engine
This is Rietveld 408576698