Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(187)

Unified Diff: components/devtools_bridge/android/java/src/org/chromium/components/devtools_bridge/util/LooperExecutor.java

Issue 1142463003: Remove devtools_bridge component (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/devtools_bridge/android/java/src/org/chromium/components/devtools_bridge/util/LooperExecutor.java
diff --git a/components/devtools_bridge/android/java/src/org/chromium/components/devtools_bridge/util/LooperExecutor.java b/components/devtools_bridge/android/java/src/org/chromium/components/devtools_bridge/util/LooperExecutor.java
deleted file mode 100644
index ce383be38984a22a93c21838eca6452d531d6718..0000000000000000000000000000000000000000
--- a/components/devtools_bridge/android/java/src/org/chromium/components/devtools_bridge/util/LooperExecutor.java
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.components.devtools_bridge.util;
-
-import android.content.Context;
-import android.os.Handler;
-
-import org.chromium.components.devtools_bridge.SessionBase;
-
-/**
- * Implementation of SessionBase.Executor on top of android's handler.
- */
-public class LooperExecutor implements SessionBase.Executor {
- private final Handler mHandler;
-
- public LooperExecutor(Handler handler) {
- mHandler = handler;
- }
-
- public static LooperExecutor newInstanceForMainLooper(Context context) {
- return new LooperExecutor(new Handler(context.getMainLooper()));
- }
-
- @Override
- public SessionBase.Cancellable postOnSessionThread(int delayMs, Runnable runnable) {
- CancellableTask task = new CancellableTask(runnable);
- mHandler.postDelayed(task, delayMs);
- return task;
- }
-
- @Override
- public boolean isCalledOnSessionThread() {
- return mHandler.getLooper().getThread() == Thread.currentThread();
- }
-
- private final class CancellableTask implements SessionBase.Cancellable, Runnable {
- private Runnable mTask;
-
- public CancellableTask(Runnable task) {
- mTask = task;
- }
-
- @Override
- public void run() {
- if (mTask != null) mTask.run();
- }
-
- @Override
- public void cancel() {
- mHandler.removeCallbacks(this);
- mTask = null;
- }
- }
-}

Powered by Google App Engine
This is Rietveld 408576698