Chromium Code Reviews| Index: content/public/android/java/src/org/chromium/content/browser/input/ThreadedInputConnectionFactory.java |
| diff --git a/content/public/android/java/src/org/chromium/content/browser/input/ThreadedInputConnectionFactory.java b/content/public/android/java/src/org/chromium/content/browser/input/ThreadedInputConnectionFactory.java |
| index d3ed0fc2fc21afff95b6654cc804cb731e4b9ed6..5dec39a36ebfe8f7d93cdb8b33d39dd4ce743722 100644 |
| --- a/content/public/android/java/src/org/chromium/content/browser/input/ThreadedInputConnectionFactory.java |
| +++ b/content/public/android/java/src/org/chromium/content/browser/input/ThreadedInputConnectionFactory.java |
| @@ -11,6 +11,7 @@ import android.view.inputmethod.EditorInfo; |
| import org.chromium.base.Log; |
| import org.chromium.base.VisibleForTesting; |
| +import org.chromium.base.annotations.SuppressFBWarnings; |
| /** |
| * A factory class for {@link ThreadedInputConnection}. The class also includes triggering |
| @@ -37,6 +38,15 @@ public class ThreadedInputConnectionFactory implements ChromiumBaseInputConnecti |
| private CheckInvalidator mCheckInvalidator; |
| private boolean mReentrantTriggering; |
| + private static ThreadLocal<Boolean> sTriggerDelayedOnCreateInputConnection = |
| + new ThreadLocal<Boolean>() { |
| + @SuppressFBWarnings("CHROMIUM_SYNCHRONIZED_METHOD") |
| + @Override |
| + protected synchronized Boolean initialValue() { |
| + return true; |
| + } |
| + }; |
| + |
| // Initialization-on-demand holder for Handler. |
| private static class LazyHandlerHolder { |
| // Note that we never exit this thread to avoid lifetime or thread-safety issues. |
| @@ -71,6 +81,11 @@ public class ThreadedInputConnectionFactory implements ChromiumBaseInputConnecti |
| } |
| @Override |
| + public void setTriggerDelayedOnCreateInputConnection(final boolean trigger) { |
| + sTriggerDelayedOnCreateInputConnection.set(trigger); |
| + } |
| + |
| + @Override |
| public Handler getHandler() { |
| return LazyHandlerHolder.sHandler; |
| } |
| @@ -106,6 +121,10 @@ public class ThreadedInputConnectionFactory implements ChromiumBaseInputConnecti |
| return true; |
| } |
| + private boolean shouldTriggerDelayedOnCreateInputConnection2() { |
| + return sTriggerDelayedOnCreateInputConnection.get(); |
| + } |
| + |
| @Override |
| public ThreadedInputConnection initializeAndGet(View view, ImeAdapter imeAdapter, int inputType, |
| int inputFlags, int inputMode, int selectionStart, int selectionEnd, |
| @@ -124,6 +143,9 @@ public class ThreadedInputConnectionFactory implements ChromiumBaseInputConnecti |
| // mServedConnecting. |
| if (mCheckInvalidator != null) mCheckInvalidator.invalidate(); |
|
yabinh
2017/01/09 07:33:11
Keep the old method for debugging.
|
| + assert shouldTriggerDelayedOnCreateInputConnection() |
| + == shouldTriggerDelayedOnCreateInputConnection2(); |
| + |
| if (shouldTriggerDelayedOnCreateInputConnection()) { |
| triggerDelayedOnCreateInputConnection(view); |
| return null; |