Bug 1502118 - Add @AnyThread to APIs that can be used from any thread. r=snorp.
authorAgi Sferro <agi@mozilla.com>
Tue, 30 Oct 2018 15:54:10 +0000
changeset 443541 aed3a7740a8624be2835e3e87247d39a84b293f2
parent 443540 f38363e53ca4880ead82217921e4fe421a42956a
child 443542 c26e3232d3a3fc5c4c15eb60036a139db763e5f6
push id34961
push useraciure@mozilla.com
push dateTue, 30 Oct 2018 22:06:02 +0000
treeherdermozilla-central@a9bd3dd38b19 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs1502118
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1502118 - Add @AnyThread to APIs that can be used from any thread. r=snorp. This patch adds @AnyThread to any API that can be explicitely called from any thread. Depends on D10239 Differential Revision: https://phabricator.services.mozilla.com/D10240
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/SessionTextInput.java
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java
@@ -36,16 +36,17 @@ import android.database.Cursor;
 import android.graphics.RectF;
 import android.net.Uri;
 import android.os.Binder;
 import android.os.IBinder;
 import android.os.IInterface;
 import android.os.Parcel;
 import android.os.Parcelable;
 import android.os.SystemClock;
+import android.support.annotation.AnyThread;
 import android.support.annotation.IntDef;
 import android.support.annotation.Nullable;
 import android.support.annotation.NonNull;
 import android.support.annotation.StringDef;
 import android.support.annotation.UiThread;
 import android.util.Base64;
 import android.util.Log;
 import android.view.Surface;
@@ -1099,16 +1100,17 @@ public class GeckoSession extends LayerS
         }
     }
 
     /**
      * Get the SessionTextInput instance for this session. May be called on any thread.
      *
      * @return SessionTextInput instance.
      */
+    @AnyThread
     public @NonNull SessionTextInput getTextInput() {
         // May be called on any thread.
         return mTextInput;
     }
 
     /**
       * Get the SessionAccessibility instance for this session.
       *
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/SessionTextInput.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/SessionTextInput.java
@@ -18,16 +18,17 @@ import org.mozilla.gecko.util.ThreadUtil
 
 import android.annotation.TargetApi;
 import android.app.Activity;
 import android.content.Context;
 import android.graphics.Rect;
 import android.graphics.RectF;
 import android.os.Build;
 import android.os.Handler;
+import android.support.annotation.AnyThread;
 import android.support.annotation.NonNull;
 import android.support.annotation.Nullable;
 import android.support.annotation.UiThread;
 import android.text.Editable;
 import android.text.InputType;
 import android.util.Log;
 import android.util.SparseArray;
 import android.view.KeyEvent;
@@ -334,16 +335,17 @@ public final class SessionTextInput {
      *         return super.getHandler();
      *     }
      *     return getSession().getTextInput().getHandler(super.getHandler());
      * }</pre>
      *
      * @param defHandler Handler returned by the system {@code getHandler} implementation.
      * @return Handler to return to the system through {@code getHandler}.
      */
+    @AnyThread
     public synchronized @NonNull Handler getHandler(final @NonNull Handler defHandler) {
         // May be called on any thread.
         if (mInputConnection != null) {
             return mInputConnection.getHandler(defHandler);
         }
         return defHandler;
     }
 
@@ -384,16 +386,17 @@ public final class SessionTextInput {
      * Get an {@link android.view.inputmethod.InputConnection} instance. In viewless mode,
      * this method still fills out the {@link android.view.inputmethod.EditorInfo} object,
      * but the return value will always be null.
      *
      * @param attrs EditorInfo instance to be filled on return.
      * @return InputConnection instance, or null if there is no active input
      *         (or if in viewless mode).
      */
+    @AnyThread
     public synchronized @Nullable InputConnection onCreateInputConnection(
             final @NonNull EditorInfo attrs) {
         // May be called on any thread.
         mEditable.onCreateInputConnection(attrs);
 
         if (!mQueue.isReady() || mInputConnection == null) {
             return null;
         }