| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/android/java_handler_thread.h" | 5 #include "base/android/java_handler_thread.h" |
| 6 | 6 |
| 7 #include <jni.h> | 7 #include <jni.h> |
| 8 | 8 |
| 9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
| 10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 reinterpret_cast<intptr_t>(&initialize_event)); | 39 reinterpret_cast<intptr_t>(&initialize_event)); |
| 40 // Wait for thread to be initialized so it is ready to be used when Start | 40 // Wait for thread to be initialized so it is ready to be used when Start |
| 41 // returns. | 41 // returns. |
| 42 base::ThreadRestrictions::ScopedAllowWait wait_allowed; | 42 base::ThreadRestrictions::ScopedAllowWait wait_allowed; |
| 43 initialize_event.Wait(); | 43 initialize_event.Wait(); |
| 44 } | 44 } |
| 45 | 45 |
| 46 void JavaHandlerThread::Stop() { | 46 void JavaHandlerThread::Stop() { |
| 47 } | 47 } |
| 48 | 48 |
| 49 void JavaHandlerThread::InitializeThread(JNIEnv* env, jobject obj, jint event) { | 49 void JavaHandlerThread::InitializeThread(JNIEnv* env, jobject obj, |
| 50 jlong event) { |
| 50 // TYPE_JAVA to get the Android java style message loop. | 51 // TYPE_JAVA to get the Android java style message loop. |
| 51 message_loop_.reset(new base::MessageLoop(base::MessageLoop::TYPE_JAVA)); | 52 message_loop_.reset(new base::MessageLoop(base::MessageLoop::TYPE_JAVA)); |
| 52 static_cast<MessageLoopForUI*>(message_loop_.get())->Start(); | 53 static_cast<MessageLoopForUI*>(message_loop_.get())->Start(); |
| 53 reinterpret_cast<base::WaitableEvent*>(event)->Signal(); | 54 reinterpret_cast<base::WaitableEvent*>(event)->Signal(); |
| 54 } | 55 } |
| 55 | 56 |
| 56 // static | 57 // static |
| 57 bool JavaHandlerThread::RegisterBindings(JNIEnv* env) { | 58 bool JavaHandlerThread::RegisterBindings(JNIEnv* env) { |
| 58 return RegisterNativesImpl(env); | 59 return RegisterNativesImpl(env); |
| 59 } | 60 } |
| 60 | 61 |
| 61 } // namespace android | 62 } // namespace android |
| 62 } // namespace base | 63 } // namespace base |
| OLD | NEW |