Chromium Code Reviews| Index: remoting/client/jni/jni_runtime_delegate.h |
| diff --git a/remoting/client/jni/chromoting_jni_runtime.h b/remoting/client/jni/jni_runtime_delegate.h |
| similarity index 55% |
| rename from remoting/client/jni/chromoting_jni_runtime.h |
| rename to remoting/client/jni/jni_runtime_delegate.h |
| index 61a2fe7c394261ca7e7730a12fa6f81a22751250..f131c0db32c930f372fdf2d452cbc842eebf9c70 100644 |
| --- a/remoting/client/jni/chromoting_jni_runtime.h |
| +++ b/remoting/client/jni/jni_runtime_delegate.h |
| @@ -2,8 +2,8 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#ifndef REMOTING_CLIENT_JNI_CHROMOTING_JNI_RUNTIME_H_ |
| -#define REMOTING_CLIENT_JNI_CHROMOTING_JNI_RUNTIME_H_ |
| +#ifndef REMOTING_CLIENT_JNI_JNI_RUNTIME_DELEGATE_H_ |
| +#define REMOTING_CLIENT_JNI_JNI_RUNTIME_DELEGATE_H_ |
| #include <jni.h> |
| #include <string> |
| @@ -18,80 +18,54 @@ |
| #include "remoting/protocol/connection_to_host.h" |
| namespace base { |
| -template<typename T> struct DefaultSingletonTraits; |
| +template <typename T> |
| +struct DefaultSingletonTraits; |
| } |
| namespace remoting { |
| -bool RegisterChromotingJniRuntime(JNIEnv* env); |
| +bool RegisterJniRuntimeDelegate(JNIEnv* env); |
|
nicholss
2017/03/10 19:04:28
So for this to work correctly, the JniRuntimeDeleg
|
| // Houses the global resources on which the Chromoting components run |
|
nicholss
2017/03/10 19:04:28
This comment should be updated. Will do.
|
| // (e.g. message loops and task runners). Proxies outgoing JNI calls from its |
| // ChromotingJniInstance member to Java. All its methods should be invoked |
| // exclusively from the UI thread unless otherwise noted. |
| -class ChromotingJniRuntime { |
| +class JniRuntimeDelegate : public ChromotingClientRuntime::Delegate { |
| public: |
| // This class is instantiated at process initialization and persists until |
| - // we close. Its components are reused across |ChromotingJniInstance|s. |
| - static ChromotingJniRuntime* GetInstance(); |
| - |
| - scoped_refptr<AutoThreadTaskRunner> ui_task_runner() { |
| - return runtime_->ui_task_runner(); |
| - } |
| - |
| - scoped_refptr<AutoThreadTaskRunner> network_task_runner() { |
| - return runtime_->network_task_runner(); |
| - } |
| - |
| - scoped_refptr<AutoThreadTaskRunner> display_task_runner() { |
| - return runtime_->display_task_runner(); |
| - } |
| - |
| - scoped_refptr<net::URLRequestContextGetter> url_requester() { |
| - return runtime_->url_requester(); |
| - } |
| - |
| - // Returns the log writer that can be used by ClientTelemetryLogger to send |
| - // out logs. |
| - // Method must be called and returned object must be used on the network |
| - // thread. |
| - TelemetryLogWriter* GetLogWriter(); |
| + // we close. Its components are reused across |JniRuntimeDelegate|s. |
| + static JniRuntimeDelegate* GetInstance(); |
| // Fetch OAuth token for the telemetry logger. Call on UI thread. |
| void FetchAuthToken(); |
| + // remoting::ChromotingClientRuntime::Delegate overrides. |
| + void RuntimeWillShutdown() override; |
| + void RequestAuthTokenForLogger() override; |
| + |
| private: |
| - ChromotingJniRuntime(); |
| + JniRuntimeDelegate(); |
| // Forces a DisconnectFromHost() in case there is any active or failed |
| // connection, then proceeds to tear down the Chromium dependencies on which |
| // all sessions depended. Because destruction only occurs at application exit |
| // after all connections have terminated, it is safe to make unretained |
| // cross-thread calls on the class. |
| - virtual ~ChromotingJniRuntime(); |
| + virtual ~JniRuntimeDelegate(); |
| // Detaches JVM from the current thread, then signals. Doesn't own |waiter|. |
| void DetachFromVmAndSignal(base::WaitableEvent* waiter); |
| - // Starts the logger on the network thread. |
| - void StartLoggerOnNetworkThread(); |
| - |
| // Chromium code's connection to the app message loop. Once created the |
| // MessageLoop will live for the life of the program. |
| std::unique_ptr<base::MessageLoopForUI> ui_loop_; |
| + ChromotingClientRuntime* runtime_; |
| - // Contains threads. |
| - // |
| - std::unique_ptr<ChromotingClientRuntime> runtime_; |
| - |
| - // For logging session stage changes and stats. |
| - std::unique_ptr<TelemetryLogWriter> log_writer_; |
| - |
| - friend struct base::DefaultSingletonTraits<ChromotingJniRuntime>; |
| + friend struct base::DefaultSingletonTraits<JniRuntimeDelegate>; |
| - DISALLOW_COPY_AND_ASSIGN(ChromotingJniRuntime); |
| + DISALLOW_COPY_AND_ASSIGN(JniRuntimeDelegate); |
| }; |
| } // namespace remoting |
| -#endif |
| +#endif // REMOTING_CLIENT_JNI_JNI_RUNTIME_DELEGATE_H_ |