Index: mojo/android/system/src/org/chromium/mojo/system/impl/BaseRunLoop.java |
diff --git a/mojo/android/system/src/org/chromium/mojo/system/impl/BaseRunLoop.java b/mojo/android/system/src/org/chromium/mojo/system/impl/BaseRunLoop.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6df53ee03790fb00d3bd0f389448db04dc0741a8 |
--- /dev/null |
+++ b/mojo/android/system/src/org/chromium/mojo/system/impl/BaseRunLoop.java |
@@ -0,0 +1,55 @@ |
+// Copyright 2015 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.mojo.system.impl; |
+ |
+import org.chromium.base.JNINamespace; |
+import org.chromium.mojo.system.RunLoop; |
+ |
+/** |
+ * Implementation of {@link RunLoop} suitable for the base:: message loop implementation. |
+ */ |
+@JNINamespace("mojo::android") |
+class BaseRunLoop implements RunLoop { |
+ /** |
+ * Pointer to the C run loop. |
+ */ |
+ private long mRunLoopID; |
+ |
+ private BaseRunLoop() { |
+ this.mRunLoopID = nativeCreateBaseRunLoop(); |
+ } |
+ |
+ public static RunLoop create() { |
+ return new BaseRunLoop(); |
+ } |
+ |
+ @Override |
+ public void run() { |
+ nativeRun(mRunLoopID); |
+ } |
+ |
+ @Override |
+ public void runUntilIdle() { |
+ nativeRunUntilIdle(mRunLoopID); |
+ } |
+ |
+ @Override |
+ public void quit() { |
+ nativeQuit(mRunLoopID); |
+ nativeDeleteMessageLoop(mRunLoopID); |
qsr
2015/02/05 16:50:07
Hum... I need to think about this. This seems wron
etiennej
2015/02/06 16:22:29
Done.
|
+ } |
+ |
+ @Override |
+ public void postDelayedTask(Runnable runnable, long delay) { |
+ nativePostDelayedTask(mRunLoopID, runnable, delay); |
+ } |
+ |
+ private native long nativeCreateBaseRunLoop(); |
+ private native void nativeRun(long runLoopID); |
+ private native void nativeRunUntilIdle(long runLoopID); |
+ private native void nativeQuit(long runLoopID); |
+ private native void nativePostDelayedTask(long runLoopID, Runnable runnable, long delay); |
+ private native void nativeDeleteMessageLoop(long runLoopID); |
+} |