Chromium Code Reviews| 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_INSTANCE_H_ | 5 #ifndef REMOTING_CLIENT_JNI_CHROMOTING_JNI_INSTANCE_H_ |
| 6 #define REMOTING_CLIENT_JNI_CHROMOTING_JNI_INSTANCE_H_ | 6 #define REMOTING_CLIENT_JNI_CHROMOTING_JNI_INSTANCE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 | 25 |
| 26 namespace remoting { | 26 namespace remoting { |
| 27 | 27 |
| 28 namespace protocol { | 28 namespace protocol { |
| 29 class ClipboardEvent; | 29 class ClipboardEvent; |
| 30 class PerformanceTracker; | 30 class PerformanceTracker; |
| 31 class VideoRenderer; | 31 class VideoRenderer; |
| 32 } // namespace protocol | 32 } // namespace protocol |
| 33 | 33 |
| 34 class AudioPlayerAndroid; | 34 class AudioPlayerAndroid; |
| 35 class ChromotingJniRuntime; | 35 class ChromotingClientRuntime; |
| 36 class JniClient; | 36 class JniClient; |
| 37 class JniPairingSecretFetcher; | 37 class JniPairingSecretFetcher; |
| 38 | 38 |
| 39 // ChromotingJniInstance is scoped to the session. | 39 // ChromotingJniInstance is scoped to the session. |
| 40 // This class is Created on the UI thread but thereafter it is used and | 40 // This class is Created on the UI thread but thereafter it is used and |
| 41 // destroyed on the network thread. Except where indicated, all methods are | 41 // destroyed on the network thread. Except where indicated, all methods are |
| 42 // called on the network thread. | 42 // called on the network thread. |
| 43 class ChromotingJniInstance | 43 class ChromotingJniInstance |
| 44 : public ClientUserInterface, | 44 : public ClientUserInterface, |
| 45 public protocol::ClipboardStub { | 45 public protocol::ClipboardStub { |
| 46 public: | 46 public: |
| 47 // Initiates a connection with the specified host. Call from the UI thread. | 47 // Initiates a connection with the specified host. Call from the UI thread. |
| 48 // The instance does not take ownership of |jni_runtime|. To connect with an | 48 // The instance does not take ownership of |jni_runtime|. To connect with an |
| 49 // unpaired host, pass in |pairing_id| and |pairing_secret| as empty strings. | 49 // unpaired host, pass in |pairing_id| and |pairing_secret| as empty strings. |
| 50 ChromotingJniInstance(ChromotingJniRuntime* jni_runtime, | 50 ChromotingJniInstance(base::WeakPtr<JniClient> jni_client, |
|
nicholss
2017/03/10 19:04:28
So this is a change I am not 100% sure about, I ch
Yuwei
2017/03/10 20:18:53
Maybe the real runtime object is good enough for t
| |
| 51 base::WeakPtr<JniClient> jni_client, | |
| 52 base::WeakPtr<JniPairingSecretFetcher> secret_fetcher, | 51 base::WeakPtr<JniPairingSecretFetcher> secret_fetcher, |
| 53 std::unique_ptr<protocol::CursorShapeStub> cursor_stub, | 52 std::unique_ptr<protocol::CursorShapeStub> cursor_stub, |
| 54 std::unique_ptr<protocol::VideoRenderer> video_renderer, | 53 std::unique_ptr<protocol::VideoRenderer> video_renderer, |
| 55 const ConnectToHostInfo& info); | 54 const ConnectToHostInfo& info); |
| 56 | 55 |
| 57 ~ChromotingJniInstance() override; | 56 ~ChromotingJniInstance() override; |
| 58 | 57 |
| 59 // Starts the connection. Can be called on any thread. | 58 // Starts the connection. Can be called on any thread. |
| 60 void Connect(); | 59 void Connect(); |
| 61 | 60 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 void EnableStatsLogging(bool enabled); | 134 void EnableStatsLogging(bool enabled); |
| 136 | 135 |
| 137 // If logging is enabled, logs the current connection statistics, and | 136 // If logging is enabled, logs the current connection statistics, and |
| 138 // triggers another call to this function after the logging time interval. | 137 // triggers another call to this function after the logging time interval. |
| 139 // Called on the network thread. | 138 // Called on the network thread. |
| 140 void LogPerfStats(); | 139 void LogPerfStats(); |
| 141 | 140 |
| 142 // Releases the resource in the right order. | 141 // Releases the resource in the right order. |
| 143 void ReleaseResources(); | 142 void ReleaseResources(); |
| 144 | 143 |
| 145 // Used to obtain task runner references and make calls to Java methods. | 144 // Used to obtain task runner references. |
| 146 ChromotingJniRuntime* jni_runtime_; | 145 ChromotingClientRuntime* runtime_; |
| 147 | 146 |
| 148 base::WeakPtr<JniClient> jni_client_; | 147 base::WeakPtr<JniClient> jni_client_; |
| 149 | 148 |
| 150 base::WeakPtr<JniPairingSecretFetcher> secret_fetcher_; | 149 base::WeakPtr<JniPairingSecretFetcher> secret_fetcher_; |
| 151 | 150 |
| 152 ConnectToHostInfo connection_info_; | 151 ConnectToHostInfo connection_info_; |
| 153 | 152 |
| 154 protocol::ClientAuthenticationConfig client_auth_config_; | 153 protocol::ClientAuthenticationConfig client_auth_config_; |
| 155 | 154 |
| 156 // This group of variables is to be used on the network thread. | 155 // This group of variables is to be used on the network thread. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 192 | 191 |
| 193 base::WeakPtr<ChromotingJniInstance> weak_ptr_; | 192 base::WeakPtr<ChromotingJniInstance> weak_ptr_; |
| 194 base::WeakPtrFactory<ChromotingJniInstance> weak_factory_; | 193 base::WeakPtrFactory<ChromotingJniInstance> weak_factory_; |
| 195 | 194 |
| 196 DISALLOW_COPY_AND_ASSIGN(ChromotingJniInstance); | 195 DISALLOW_COPY_AND_ASSIGN(ChromotingJniInstance); |
| 197 }; | 196 }; |
| 198 | 197 |
| 199 } // namespace remoting | 198 } // namespace remoting |
| 200 | 199 |
| 201 #endif // REMOTING_CLIENT_JNI_CHROMOTING_JNI_INSTANCE_H_ | 200 #endif // REMOTING_CLIENT_JNI_CHROMOTING_JNI_INSTANCE_H_ |
| OLD | NEW |