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

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
« no previous file with comments | « mojo/android/system/src/org/chromium/mojo/system/impl/BaseRunLoop.java ('k') | mojo/public/java/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..a32e1f347b88ff0f8cfffda40a7ba5d9c890d13c 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<BaseRunLoop> mCurrentRunLoop = new ThreadLocal<BaseRunLoop>();
+
+ /**
* @return the instance.
*/
public static Core getInstance() {
@@ -206,6 +212,34 @@ public class CoreImpl implements Core, AsyncWaiter {
}
/**
+ * @see Core#createDefaultRunLoop()
+ */
+ @Override
+ public RunLoop createDefaultRunLoop() {
+ if (mCurrentRunLoop.get() != null) {
+ throw new MojoException(MojoResult.FAILED_PRECONDITION);
+ }
+ BaseRunLoop runLoop = new BaseRunLoop(this);
+ mCurrentRunLoop.set(runLoop);
+ return runLoop;
+ }
+
+ /**
+ * @see Core#getCurrentRunLoop()
+ */
+ @Override
+ public RunLoop getCurrentRunLoop() {
+ return mCurrentRunLoop.get();
+ }
+
+ /**
+ * Remove the current run loop.
+ */
+ void clearCurrentRunLoop() {
+ mCurrentRunLoop.remove();
+ }
+
+ /**
* @see AsyncWaiter#asyncWait(Handle, Core.HandleSignals, long, Callback)
*/
@Override
« no previous file with comments | « mojo/android/system/src/org/chromium/mojo/system/impl/BaseRunLoop.java ('k') | mojo/public/java/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698