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

Unified Diff: shell/android/apk/src/org/chromium/mojo/shell/JavaApplicationRegistry.java

Issue 1458453003: Add mojo service to get notified of vsync. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Follow review Created 5 years, 1 month 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: shell/android/apk/src/org/chromium/mojo/shell/JavaApplicationRegistry.java
diff --git a/shell/android/apk/src/org/chromium/mojo/shell/JavaApplicationRegistry.java b/shell/android/apk/src/org/chromium/mojo/shell/JavaApplicationRegistry.java
index b0e81db1e71e7574162ad711934e3452a3875e1b..67241c10b798da448ce50d20bbfa238adaf381c6 100644
--- a/shell/android/apk/src/org/chromium/mojo/shell/JavaApplicationRegistry.java
+++ b/shell/android/apk/src/org/chromium/mojo/shell/JavaApplicationRegistry.java
@@ -4,6 +4,8 @@
package org.chromium.mojo.shell;
+import android.os.HandlerThread;
+
import org.chromium.base.ApplicationStatus;
import org.chromium.base.CalledByNative;
import org.chromium.base.JNINamespace;
@@ -30,6 +32,8 @@ import java.util.Map;
@JNINamespace("shell")
public class JavaApplicationRegistry {
private final Map<String, ApplicationDelegate> mApplicationDelegateMap = new HashMap<>();
+ // Thread with a Looper required to get callbacks from the android framework..
+ private final HandlerThread mHandlerThread = new HandlerThread("FrameworkThread");
private static final class ApplicationRunnable implements Runnable {
private final ApplicationDelegate mApplicationDelegate;
@@ -51,7 +55,9 @@ public class JavaApplicationRegistry {
}
}
- private JavaApplicationRegistry() {}
+ private JavaApplicationRegistry() {
+ mHandlerThread.start();
+ }
private void registerApplicationDelegate(String url, ApplicationDelegate applicationDelegate) {
mApplicationDelegateMap.put(url, applicationDelegate);
@@ -97,6 +103,9 @@ public class JavaApplicationRegistry {
registry.registerApplicationDelegate("mojo:sharing", new SharingApplicationDelegate());
registry.registerApplicationDelegate(
"mojo:native_viewport_support", new NativeViewportSupportApplicationDelegate());
+ registry.registerApplicationDelegate(
+ "mojo:vsync", new ServiceProviderFactoryApplicationDelegate(
+ new VsyncFactory(registry.mHandlerThread.getLooper())));
return registry;
}

Powered by Google App Engine
This is Rietveld 408576698