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 REMOTING_CLIENT_JNI_CHROMOTING_JNI_RUNTIME_H_ | 5 #ifndef REMOTING_CLIENT_JNI_CHROMOTING_JNI_RUNTIME_H_ |
6 #define REMOTING_CLIENT_JNI_CHROMOTING_JNI_RUNTIME_H_ | 6 #define REMOTING_CLIENT_JNI_CHROMOTING_JNI_RUNTIME_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/android/scoped_java_ref.h" | 11 #include "base/android/scoped_java_ref.h" |
12 #include "base/at_exit.h" | |
13 #include "net/url_request/url_request_context_getter.h" | 12 #include "net/url_request/url_request_context_getter.h" |
14 #include "remoting/base/auto_thread.h" | 13 #include "remoting/base/auto_thread.h" |
15 #include "remoting/client/jni/chromoting_jni_instance.h" | 14 #include "remoting/client/jni/chromoting_jni_instance.h" |
16 #include "remoting/protocol/connection_to_host.h" | 15 #include "remoting/protocol/connection_to_host.h" |
17 | 16 |
18 template<typename T> struct DefaultSingletonTraits; | 17 template<typename T> struct DefaultSingletonTraits; |
19 | 18 |
20 namespace remoting { | 19 namespace remoting { |
21 | 20 |
22 bool RegisterJni(JNIEnv* env); | 21 bool RegisterJni(JNIEnv* env); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 // Forces a DisconnectFromHost() in case there is any active or failed | 116 // Forces a DisconnectFromHost() in case there is any active or failed |
118 // connection, then proceeds to tear down the Chromium dependencies on which | 117 // connection, then proceeds to tear down the Chromium dependencies on which |
119 // all sessions depended. Because destruction only occurs at application exit | 118 // all sessions depended. Because destruction only occurs at application exit |
120 // after all connections have terminated, it is safe to make unretained | 119 // after all connections have terminated, it is safe to make unretained |
121 // cross-thread calls on the class. | 120 // cross-thread calls on the class. |
122 virtual ~ChromotingJniRuntime(); | 121 virtual ~ChromotingJniRuntime(); |
123 | 122 |
124 // Detaches JVM from the current thread, then signals. Doesn't own |waiter|. | 123 // Detaches JVM from the current thread, then signals. Doesn't own |waiter|. |
125 void DetachFromVmAndSignal(base::WaitableEvent* waiter); | 124 void DetachFromVmAndSignal(base::WaitableEvent* waiter); |
126 | 125 |
127 // Used by the Chromium libraries to clean up the base and net libraries' JNI | |
128 // bindings. It must persist for the lifetime of the singleton. | |
129 scoped_ptr<base::AtExitManager> at_exit_manager_; | |
130 | |
131 // Chromium code's connection to the Java message loop. | 126 // Chromium code's connection to the Java message loop. |
132 scoped_ptr<base::MessageLoopForUI> ui_loop_; | 127 scoped_ptr<base::MessageLoopForUI> ui_loop_; |
133 | 128 |
134 // References to native threads. | 129 // References to native threads. |
135 scoped_refptr<AutoThreadTaskRunner> ui_task_runner_; | 130 scoped_refptr<AutoThreadTaskRunner> ui_task_runner_; |
136 scoped_refptr<AutoThreadTaskRunner> network_task_runner_; | 131 scoped_refptr<AutoThreadTaskRunner> network_task_runner_; |
137 scoped_refptr<AutoThreadTaskRunner> display_task_runner_; | 132 scoped_refptr<AutoThreadTaskRunner> display_task_runner_; |
138 | 133 |
139 scoped_refptr<net::URLRequestContextGetter> url_requester_; | 134 scoped_refptr<net::URLRequestContextGetter> url_requester_; |
140 | 135 |
141 // Contains all connection-specific state. | 136 // Contains all connection-specific state. |
142 scoped_refptr<ChromotingJniInstance> session_; | 137 scoped_refptr<ChromotingJniInstance> session_; |
143 | 138 |
144 friend struct DefaultSingletonTraits<ChromotingJniRuntime>; | 139 friend struct DefaultSingletonTraits<ChromotingJniRuntime>; |
145 | 140 |
146 DISALLOW_COPY_AND_ASSIGN(ChromotingJniRuntime); | 141 DISALLOW_COPY_AND_ASSIGN(ChromotingJniRuntime); |
147 }; | 142 }; |
148 | 143 |
149 } // namespace remoting | 144 } // namespace remoting |
150 | 145 |
151 #endif | 146 #endif |
OLD | NEW |