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

Unified Diff: mojo/android/system/src/org/chromium/mojo/system/impl/CoreImpl.java

Issue 898853006: Java content handler for Android. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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: mojo/android/system/src/org/chromium/mojo/system/impl/CoreImpl.java
diff --git a/mojo/android/system/src/org/chromium/mojo/system/impl/CoreImpl.java b/mojo/android/system/src/org/chromium/mojo/system/impl/CoreImpl.java
index 19b2d29fabb61c061968ab41baa1349eead62091..208cd026c312faef2f3045b679743e7c5028a8d3 100644
--- a/mojo/android/system/src/org/chromium/mojo/system/impl/CoreImpl.java
+++ b/mojo/android/system/src/org/chromium/mojo/system/impl/CoreImpl.java
@@ -16,6 +16,7 @@ import org.chromium.mojo.system.MessagePipeHandle;
import org.chromium.mojo.system.MojoException;
import org.chromium.mojo.system.MojoResult;
import org.chromium.mojo.system.Pair;
+import org.chromium.mojo.system.RunLoop;
import org.chromium.mojo.system.SharedBufferHandle;
import org.chromium.mojo.system.SharedBufferHandle.DuplicateOptions;
import org.chromium.mojo.system.SharedBufferHandle.MapFlags;
@@ -55,6 +56,11 @@ public class CoreImpl implements Core, AsyncWaiter {
private static class LazyHolder { private static final Core INSTANCE = new CoreImpl(); }
/**
+ * The run loop for the current thread.
+ */
+ private ThreadLocal<RunLoop> mCurrentRunLoop = new ThreadLocal<RunLoop>();
+
+ /**
* @return the instance.
*/
public static Core getInstance() {
@@ -206,6 +212,32 @@ public class CoreImpl implements Core, AsyncWaiter {
}
/**
+ * @see Core#createDefaultRunLoop()
+ */
+ @Override
+ public RunLoop createDefaultRunLoop() {
+ RunLoop runLoop = BaseRunLoop.create();
+ setCurrentRunLoop(runLoop);
+ return runLoop;
+ }
+
+ /**
+ * @see Core#setCurrentRunLoop(RunLoop)
+ */
+ @Override
+ public void setCurrentRunLoop(RunLoop runLoop) {
+ mCurrentRunLoop.set(runLoop);
+ }
+
+ /**
+ * @see Core#getCurrentRunLoop()
+ */
+ @Override
+ public RunLoop getCurrentRunLoop() {
+ return mCurrentRunLoop.get();
+ }
+
+ /**
* @see AsyncWaiter#asyncWait(Handle, Core.HandleSignals, long, Callback)
*/
@Override

Powered by Google App Engine
This is Rietveld 408576698