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

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

Issue 1456913002: Use thread with looper and native message loop for vsync service. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: 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/VsyncFactory.java
diff --git a/shell/android/apk/src/org/chromium/mojo/shell/VsyncFactory.java b/shell/android/apk/src/org/chromium/mojo/shell/VsyncFactory.java
index b159ce2099eca7bb04cdfa9f2713ff8058f54035..c050af31be37a1de98c4b0c45a2c914d4a2205e7 100644
--- a/shell/android/apk/src/org/chromium/mojo/shell/VsyncFactory.java
+++ b/shell/android/apk/src/org/chromium/mojo/shell/VsyncFactory.java
@@ -4,11 +4,11 @@
package org.chromium.mojo.shell;
+import android.os.Handler;
import android.os.Looper;
import org.chromium.mojo.application.ServiceFactoryBinder;
import org.chromium.mojo.bindings.InterfaceRequest;
-import org.chromium.mojo.system.impl.CoreImpl;
import org.chromium.mojo.vsync.VSyncProviderImpl;
import org.chromium.mojom.vsync.VSyncProvider;
@@ -16,16 +16,21 @@ import org.chromium.mojom.vsync.VSyncProvider;
* A ServiceFactoryBinder for the vsync service.
*/
final class VsyncFactory implements ServiceFactoryBinder<VSyncProvider> {
- private final Looper mLooper;
+ private final Handler mHandler;
public VsyncFactory(Looper looper) {
- mLooper = looper;
+ mHandler = new Handler(looper);
}
@Override
- public void bind(InterfaceRequest<VSyncProvider> request) {
- VSyncProviderImpl implementation = new VSyncProviderImpl(CoreImpl.getInstance(), mLooper);
- implementation.setBinding(VSyncProvider.MANAGER.bind(implementation, request));
+ public void bind(final InterfaceRequest<VSyncProvider> request) {
+ mHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ VSyncProviderImpl implementation = new VSyncProviderImpl();
+ implementation.setBinding(VSyncProvider.MANAGER.bind(implementation, request));
+ }
+ });
}
@Override
« no previous file with comments | « shell/android/apk/src/org/chromium/mojo/shell/NativeHandlerThread.java ('k') | shell/android/library_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698