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

Unified Diff: shell/android/native_handler_thread.cc

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
« no previous file with comments | « shell/android/native_handler_thread.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: shell/android/native_handler_thread.cc
diff --git a/shell/android/native_handler_thread.cc b/shell/android/native_handler_thread.cc
new file mode 100644
index 0000000000000000000000000000000000000000..9d1df5940c1abfbc99218f19bd09de3638d29276
--- /dev/null
+++ b/shell/android/native_handler_thread.cc
@@ -0,0 +1,28 @@
+// 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.
+
+#include "shell/android/native_handler_thread.h"
+
+#include "base/message_loop/message_loop.h"
+#include "jni/NativeHandlerThread_jni.h"
+
+namespace shell {
+
+jlong CreateMessageLoop(JNIEnv* env, jobject jcaller) {
+ scoped_ptr<base::MessageLoop> loop(new base::MessageLoopForUI);
+ base::MessageLoopForUI::current()->Start();
+ return reinterpret_cast<intptr_t>(loop.release());
+}
+
+void DeleteMessageLoop(JNIEnv* env, jobject jcaller, jlong message_loop) {
+ scoped_ptr<base::MessageLoop> loop(
+ reinterpret_cast<base::MessageLoop*>(message_loop));
+ loop->QuitNow();
+}
+
+bool RegisterNativeHandlerThreadJni(JNIEnv* env) {
+ return RegisterNativesImpl(env);
+}
+
+} // namespace shell
« no previous file with comments | « shell/android/native_handler_thread.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698