Bug 1502118 - Add @UiThread to methods that call assertOnUiThread. r=snorp.

Differential Revision: https://phabricator.services.mozilla.com/D10237

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Agi Sferro 2018-10-30 15:51:41 +00:00
Родитель 8bf2befd09
Коммит f066fe1f81
3 изменённых файлов: 21 добавлений и 0 удалений

Просмотреть файл

@ -18,6 +18,7 @@ import android.content.Context;
import android.os.Process;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.UiThread;
import android.text.TextUtils;
import android.util.Log;
@ -98,6 +99,7 @@ public final class GeckoRuntime implements Parcelable {
* @param context An application context for the default runtime.
* @return The (static) default runtime for the context.
*/
@UiThread
public static synchronized @NonNull GeckoRuntime getDefault(final @NonNull Context context) {
ThreadUtils.assertOnUiThread();
if (DEBUG) {
@ -240,6 +242,7 @@ public final class GeckoRuntime implements Parcelable {
* @param context The context of the runtime.
* @return An initialized runtime.
*/
@UiThread
public static @NonNull GeckoRuntime create(final @NonNull Context context) {
return create(context, new GeckoRuntimeSettings());
}
@ -256,6 +259,7 @@ public final class GeckoRuntime implements Parcelable {
* @param settings The settings for the runtime.
* @return An initialized runtime.
*/
@UiThread
public static @NonNull GeckoRuntime create(final @NonNull Context context,
final @NonNull GeckoRuntimeSettings settings) {
ThreadUtils.assertOnUiThread();
@ -329,6 +333,7 @@ public final class GeckoRuntime implements Parcelable {
*
* @return The telemetry object.
*/
@UiThread
public RuntimeTelemetry getTelemetry() {
ThreadUtils.assertOnUiThread();

Просмотреть файл

@ -45,6 +45,7 @@ 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;
@ -1021,6 +1022,7 @@ public class GeckoSession extends LayerSession
* @see #close
* @see #isOpen
*/
@UiThread
public void open(final @NonNull GeckoRuntime runtime) {
ThreadUtils.assertOnUiThread();
@ -1070,6 +1072,7 @@ public class GeckoSession extends LayerSession
* @see #open
* @see #isOpen
*/
@UiThread
public void close() {
ThreadUtils.assertOnUiThread();
@ -1111,6 +1114,7 @@ public class GeckoSession extends LayerSession
*
* @return SessionAccessibility instance.
*/
@UiThread
public @NonNull SessionAccessibility getAccessibility() {
ThreadUtils.assertOnUiThread();
if (mAccessibility != null) { return mAccessibility; }
@ -1519,6 +1523,7 @@ public class GeckoSession extends LayerSession
* @return GeckoDisplay instance.
* @see #releaseDisplay(GeckoDisplay)
*/
@UiThread
public @NonNull GeckoDisplay acquireDisplay() {
ThreadUtils.assertOnUiThread();
@ -1538,6 +1543,7 @@ public class GeckoSession extends LayerSession
* @param display Acquired GeckoDisplay instance.
* @see #acquireDisplay()
*/
@UiThread
public void releaseDisplay(final @NonNull GeckoDisplay display) {
ThreadUtils.assertOnUiThread();

Просмотреть файл

@ -25,6 +25,7 @@ import android.os.Build;
import android.os.Handler;
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;
@ -352,6 +353,7 @@ public final class SessionTextInput {
* @return Current text input View or null if not set.
* @see #setView(View)
*/
@UiThread
public @Nullable View getView() {
ThreadUtils.assertOnUiThread();
return mInputConnection != null ? mInputConnection.getView() : null;
@ -366,6 +368,7 @@ public final class SessionTextInput {
* @param view Text input View or null to clear current View.
* @see #getView()
*/
@UiThread
public synchronized void setView(final @Nullable View view) {
ThreadUtils.assertOnUiThread();
@ -404,6 +407,7 @@ public final class SessionTextInput {
* @param event KeyEvent instance.
* @return True if the event was handled.
*/
@UiThread
public boolean onKeyPreIme(final int keyCode, final @NonNull KeyEvent event) {
ThreadUtils.assertOnUiThread();
return mEditable.onKeyPreIme(getView(), keyCode, event);
@ -416,6 +420,7 @@ public final class SessionTextInput {
* @param event KeyEvent instance.
* @return True if the event was handled.
*/
@UiThread
public boolean onKeyDown(final int keyCode, final @NonNull KeyEvent event) {
ThreadUtils.assertOnUiThread();
return mEditable.onKeyDown(getView(), keyCode, event);
@ -428,6 +433,7 @@ public final class SessionTextInput {
* @param event KeyEvent instance.
* @return True if the event was handled.
*/
@UiThread
public boolean onKeyUp(final int keyCode, final @NonNull KeyEvent event) {
ThreadUtils.assertOnUiThread();
return mEditable.onKeyUp(getView(), keyCode, event);
@ -440,6 +446,7 @@ public final class SessionTextInput {
* @param event KeyEvent instance.
* @return True if the event was handled.
*/
@UiThread
public boolean onKeyLongPress(final int keyCode, final @NonNull KeyEvent event) {
ThreadUtils.assertOnUiThread();
return mEditable.onKeyLongPress(getView(), keyCode, event);
@ -453,6 +460,7 @@ public final class SessionTextInput {
* @param event KeyEvent instance.
* @return True if the event was handled.
*/
@UiThread
public boolean onKeyMultiple(final int keyCode, final int repeatCount,
final @NonNull KeyEvent event) {
ThreadUtils.assertOnUiThread();
@ -464,6 +472,7 @@ public final class SessionTextInput {
*
* @param delegate TextInputDelegate instance or null to restore to default.
*/
@UiThread
public void setDelegate(@Nullable final GeckoSession.TextInputDelegate delegate) {
ThreadUtils.assertOnUiThread();
mDelegate = delegate;
@ -474,6 +483,7 @@ public final class SessionTextInput {
*
* @return TextInputDelegate instance or a default instance if no delegate has been set.
*/
@UiThread
public GeckoSession.TextInputDelegate getDelegate() {
ThreadUtils.assertOnUiThread();
if (mDelegate == null) {