OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "shell/android/native_handler_thread.h" | 5 #include "shell/android/native_handler_thread.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "jni/NativeHandlerThread_jni.h" | 8 #include "jni/NativeHandlerThread_jni.h" |
9 | 9 |
10 namespace shell { | 10 namespace shell { |
11 | 11 |
12 jlong CreateMessageLoop(JNIEnv* env, jobject jcaller) { | 12 jlong CreateMessageLoop(JNIEnv* env, const JavaParamRef<jobject>& jcaller) { |
13 scoped_ptr<base::MessageLoop> loop(new base::MessageLoopForUI); | 13 scoped_ptr<base::MessageLoop> loop(new base::MessageLoopForUI); |
14 base::MessageLoopForUI::current()->Start(); | 14 base::MessageLoopForUI::current()->Start(); |
15 return reinterpret_cast<intptr_t>(loop.release()); | 15 return reinterpret_cast<intptr_t>(loop.release()); |
16 } | 16 } |
17 | 17 |
18 void DeleteMessageLoop(JNIEnv* env, jobject jcaller, jlong message_loop) { | 18 void DeleteMessageLoop(JNIEnv* env, |
| 19 const JavaParamRef<jobject>& jcaller, |
| 20 jlong message_loop) { |
19 scoped_ptr<base::MessageLoop> loop( | 21 scoped_ptr<base::MessageLoop> loop( |
20 reinterpret_cast<base::MessageLoop*>(message_loop)); | 22 reinterpret_cast<base::MessageLoop*>(message_loop)); |
21 loop->QuitNow(); | 23 loop->QuitNow(); |
22 } | 24 } |
23 | 25 |
24 bool RegisterNativeHandlerThreadJni(JNIEnv* env) { | 26 bool RegisterNativeHandlerThreadJni(JNIEnv* env) { |
25 return RegisterNativesImpl(env); | 27 return RegisterNativesImpl(env); |
26 } | 28 } |
27 | 29 |
28 } // namespace shell | 30 } // namespace shell |
OLD | NEW |