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 #ifndef BASE_ANDROID_JAVA_HANDLER_THREAD_H_ | 5 #ifndef BASE_ANDROID_JAVA_HANDLER_THREAD_H_ |
6 #define BASE_ANDROID_JAVA_HANDLER_THREAD_H_ | 6 #define BASE_ANDROID_JAVA_HANDLER_THREAD_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "base/android/scoped_java_ref.h" | 12 #include "base/android/scoped_java_ref.h" |
13 | 13 |
14 namespace base { | 14 namespace base { |
15 | 15 |
16 class MessageLoop; | 16 class MessageLoop; |
17 class WaitableEvent; | |
18 | 17 |
19 namespace android { | 18 namespace android { |
20 | 19 |
21 // A Java Thread with a native message loop. To run tasks, post them | 20 // A Java Thread with a native message loop. To run tasks, post them |
22 // to the message loop and they will be scheduled along with Java tasks | 21 // to the message loop and they will be scheduled along with Java tasks |
23 // on the thread. | 22 // on the thread. |
24 // This is useful for callbacks where the receiver expects a thread | 23 // This is useful for callbacks where the receiver expects a thread |
25 // with a prepared Looper. | 24 // with a prepared Looper. |
26 class BASE_EXPORT JavaHandlerThread { | 25 class BASE_EXPORT JavaHandlerThread { |
27 public: | 26 public: |
(...skipping 22 matching lines...) Expand all Loading... |
50 std::unique_ptr<base::MessageLoop> message_loop_; | 49 std::unique_ptr<base::MessageLoop> message_loop_; |
51 | 50 |
52 private: | 51 private: |
53 ScopedJavaGlobalRef<jobject> java_thread_; | 52 ScopedJavaGlobalRef<jobject> java_thread_; |
54 }; | 53 }; |
55 | 54 |
56 } // namespace android | 55 } // namespace android |
57 } // namespace base | 56 } // namespace base |
58 | 57 |
59 #endif // BASE_ANDROID_JAVA_HANDLER_THREAD_H_ | 58 #endif // BASE_ANDROID_JAVA_HANDLER_THREAD_H_ |
OLD | NEW |