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

Side by Side Diff: remoting/client/chromoting_client_runtime.h

Issue 1764503002: Adding container class for chromoting client runtimes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing ios version, using runtime in jni runtime. Created 4 years, 9 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef REMOTING_CLIENT_CHROMOTING_CLIENT_RUNTIME_H_
6 #define REMOTING_CLIENT_CHROMOTING_CLIENT_RUNTIME_H_
7
8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h"
11 #include "net/url_request/url_request_context_getter.h"
12 #include "remoting/base/auto_thread.h"
13 #include "remoting/client/chromoting_client_runtime.h"
14
15 namespace base {
16 template <typename T>
17 struct DefaultSingletonTraits;
18 }
19
20 // Houses the global resources on which the Chromoting components run
21 // (e.g. message loops and task runners).
22 namespace remoting {
23
24 class ChromotingClientRuntime {
25 public:
26 // This class is instantiated at process initialization and persists until
27 // we close. Its components are reused across |ChromotingClientRuntime|s.
28 static ChromotingClientRuntime* GetInstance();
29
30 scoped_refptr<AutoThreadTaskRunner> network_task_runner() {
31 return network_task_runner_;
32 }
33
34 scoped_refptr<AutoThreadTaskRunner> display_task_runner() {
35 return ui_task_runner_;
36 }
37
38 scoped_refptr<AutoThreadTaskRunner> file_task_runner() {
39 return file_task_runner_;
40 }
41
42 scoped_refptr<net::URLRequestContextGetter> url_requester() {
43 return url_requester_;
44 }
45
46 protected:
47 ChromotingClientRuntime();
48 // Forces a DisconnectFromHost() in case there is any active or failed
49 // connection, then proceeds to tear down the Chromium dependencies on which
50 // all sessions depended. Because destruction only occurs at application exit
51 // after all connections have terminated, it is safe to make unretained
52 // cross-thread calls on the class.
53 virtual ~ChromotingClientRuntime();
54
55 private:
56 // Chromium code's connection to the app message loop. Once created the
57 // MessageLoop will live for the life of the program.
58 base::MessageLoop* ui_loop_;
59
60 // References to native threads.
61 scoped_refptr<AutoThreadTaskRunner> ui_task_runner_;
62 scoped_refptr<AutoThreadTaskRunner> network_task_runner_;
63 scoped_refptr<AutoThreadTaskRunner> file_task_runner_;
64
65 scoped_refptr<net::URLRequestContextGetter> url_requester_;
66
67 friend struct base::DefaultSingletonTraits<ChromotingClientRuntime>;
68
69 DISALLOW_COPY_AND_ASSIGN(ChromotingClientRuntime);
70 };
71
72 } // namespace remoting
73
74 #endif // REMOTING_CLIENT_CHROMOTING_CLIENT_RUNTIME_H_
OLDNEW
« no previous file with comments | « no previous file | remoting/client/chromoting_client_runtime.cc » ('j') | remoting/client/jni/chromoting_jni_runtime.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698