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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Agi Sferro 2018-10-30 15:54:10 +00:00
parent e5460c7403
commit 1390e64ce3
2 changed files with 5 additions and 0 deletions

View File

@ -41,6 +41,7 @@ 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;
@ -1104,6 +1105,7 @@ public class GeckoSession extends LayerSession
*
* @return SessionTextInput instance.
*/
@AnyThread
public @NonNull SessionTextInput getTextInput() {
// May be called on any thread.
return mTextInput;

View File

@ -23,6 +23,7 @@ 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;
@ -339,6 +340,7 @@ public final class SessionTextInput {
* @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) {
@ -389,6 +391,7 @@ public final class SessionTextInput {
* @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.