Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(333)

Unified Diff: remoting/client/ios/chromoting_client_runtime_ios.h

Issue 1764503002: Adding container class for chromoting client runtimes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moving impl to iOS, adding public interface. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: remoting/client/ios/chromoting_client_runtime_ios.h
diff --git a/remoting/client/ios/chromoting_client_runtime_ios.h b/remoting/client/ios/chromoting_client_runtime_ios.h
new file mode 100644
index 0000000000000000000000000000000000000000..1e2e94255015cfd019dc8e3acf1218aaf552cbb2
--- /dev/null
+++ b/remoting/client/ios/chromoting_client_runtime_ios.h
@@ -0,0 +1,74 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef REMOTING_CLIENT_IOS_CHROMOTING_CLIENT_RUNTIME_IOS_H_
+#define REMOTING_CLIENT_IOS_CHROMOTING_CLIENT_RUNTIME_IOS_H_
+
+#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/message_loop/message_loop.h"
+#include "net/url_request/url_request_context_getter.h"
+#include "remoting/base/auto_thread.h"
+#include "remoting/client/chromoting_client_runtime.h"
+
+namespace base {
+template <typename T>
+struct DefaultSingletonTraits;
+}
+
+// Houses the global resources on which the Chromoting components run
+// (e.g. message loops and task runners).
+namespace remoting {
+
+class ChromotingClientRuntimeIos : pulbic ChromotingClientRuntime {
+ public:
+ // This class is instantiated at process initialization and persists until
+ // we close. Its components are reused across |ChromotingClientRuntime|s.
+ static ChromotingClientRuntimeIos* GetInstance();
+
+ scoped_refptr<AutoThreadTaskRunner> network_task_runner() override {
+ return network_task_runner_;
+ }
+
+ scoped_refptr<AutoThreadTaskRunner> display_task_runner() override {
+ return ui_task_runner_;
+ }
+
+ scoped_refptr<AutoThreadTaskRunner> file_task_runner() override {
+ return file_task_runner_;
+ }
+
+ scoped_refptr<net::URLRequestContextGetter> url_requester() override {
+ return url_requester_;
+ }
+
+ protected:
+ ChromotingClientRuntime();
+ // 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 ~ChromotingClientRuntime();
+
+ private:
+ // Chromium code's connection to the app message loop. Once created the
+ // MessageLoop will live for the life of the program.
+ base::MessageLoop* ui_loop_;
+
+ // References to native threads.
+ scoped_refptr<AutoThreadTaskRunner> ui_task_runner_;
+ scoped_refptr<AutoThreadTaskRunner> network_task_runner_;
+ scoped_refptr<AutoThreadTaskRunner> file_task_runner_;
+
+ scoped_refptr<net::URLRequestContextGetter> url_requester_;
+
+ friend struct base::DefaultSingletonTraits<ChromotingClientRuntime>;
+
+ DISALLOW_COPY_AND_ASSIGN(ChromotingClientRuntimeIos);
+};
+
+} // namespace remoting
+
+#endif // REMOTING_CLIENT_IOS_CHROMOTING_CLIENT_RUNTIME_IOS_H_

Powered by Google App Engine
This is Rietveld 408576698