| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.content.browser; | 5 package org.chromium.content.browser; |
| 6 | 6 |
| 7 import android.os.Handler; | 7 import android.os.Handler; |
| 8 import android.os.Looper; | 8 import android.os.Looper; |
| 9 | 9 |
| 10 import org.chromium.base.JavaHandlerThread; | 10 import org.chromium.base.JavaHandlerThread; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 } | 35 } |
| 36 | 36 |
| 37 public static void removeCallbacks(Runnable r) { | 37 public static void removeCallbacks(Runnable r) { |
| 38 sHandler.removeCallbacks(r); | 38 sHandler.removeCallbacks(r); |
| 39 } | 39 } |
| 40 | 40 |
| 41 public static boolean runningOnLauncherThread() { | 41 public static boolean runningOnLauncherThread() { |
| 42 return sHandler.getLooper() == Looper.myLooper(); | 42 return sHandler.getLooper() == Looper.myLooper(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 public static Handler getHandler() { |
| 46 return sHandler; |
| 47 } |
| 48 |
| 45 @VisibleForTesting | 49 @VisibleForTesting |
| 46 public static void setCurrentThreadAsLauncherThread() { | 50 public static void setCurrentThreadAsLauncherThread() { |
| 47 sHandler = new Handler(); | 51 sHandler = new Handler(); |
| 48 } | 52 } |
| 49 | 53 |
| 50 @VisibleForTesting | 54 @VisibleForTesting |
| 51 public static void setLauncherThreadAsLauncherThread() { | 55 public static void setLauncherThreadAsLauncherThread() { |
| 52 sHandler = sThreadHandler; | 56 sHandler = sThreadHandler; |
| 53 } | 57 } |
| 54 | 58 |
| 55 @CalledByNative | 59 @CalledByNative |
| 56 private static JavaHandlerThread getHandlerThread() { | 60 private static JavaHandlerThread getHandlerThread() { |
| 57 return sThread; | 61 return sThread; |
| 58 } | 62 } |
| 59 | 63 |
| 60 private LauncherThread() {} | 64 private LauncherThread() {} |
| 61 } | 65 } |
| OLD | NEW |