OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef BASE_THREADING_JAVA_THREAD_H_ |
| 6 #define BASE_THREADING_JAVA_THREAD_H_ |
| 7 |
| 8 #include <jni.h> |
| 9 |
| 10 #include "base/android/scoped_java_ref.h" |
| 11 #include "base/memory/scoped_ptr.h" |
| 12 |
| 13 namespace base { |
| 14 |
| 15 class MessageLoop; |
| 16 class WaitableEvent; |
| 17 |
| 18 namespace android { |
| 19 |
| 20 class JavaThread { |
| 21 public: |
| 22 JavaThread(const char* name); |
| 23 virtual ~JavaThread() {} |
| 24 |
| 25 base::MessageLoop* message_loop() const { return message_loop_.get(); } |
| 26 void Start(); |
| 27 void Stop(); |
| 28 |
| 29 // Called from java |
| 30 void InitializeThread(JNIEnv* env, jobject obj); |
| 31 |
| 32 static bool RegisterBindings(JNIEnv* env); |
| 33 |
| 34 private: |
| 35 scoped_ptr<base::MessageLoop> message_loop_; |
| 36 base::WaitableEvent* waitable_event_; |
| 37 ScopedJavaGlobalRef<jobject> java_thread_; |
| 38 }; |
| 39 |
| 40 } // namespace android |
| 41 |
| 42 } // namespace base |
| 43 |
| 44 #endif // BASE_THREADING_JAVA_THREAD_H_ |
OLD | NEW |