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

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: 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_CONTEXT_H_
Lambros 2016/03/03 19:15:08 Fix header guard.
6 #define REMOTING_CLIENT_CHROMOTING_CLIENT_CONTEXT_H_
7
8 #include "base/bind.h"
9 #include "base/macros.h"
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h"
Lambros 2016/03/03 19:15:08 not used?
12 #include "base/memory/weak_ptr.h"
Lambros 2016/03/03 19:15:08 not used?
13 #include "base/message_loop/message_loop.h"
14 #include "net/url_request/url_request_context_getter.h"
15 #include "remoting/base/auto_thread.h"
16 #include "remoting/base/url_request_context_getter.h"
Lambros 2016/03/03 19:15:08 I think this should be "net/url_request/url_reques
17 #include "remoting/client/chromoting_client.h"
Lambros 2016/03/03 19:15:08 not used? (this, and all the ones below as well)
18 #include "remoting/protocol/connection_to_host.h"
19 #include "remoting/protocol/transport_context.h"
20
21 namespace base {
22 template<typename T> struct DefaultSingletonTraits;
23 }
24
25 // Houses the global resources on which the Chromoting components run
26 // (e.g. message loops and task runners).
27 namespace remoting {
28
29 class ChromotingClientRuntime {
30 public:
31 // This class is instantiated at process initialization and persists until
32 // we close. Its components are reused across |ChromotingJniInstance|s.
Lambros 2016/03/03 19:15:08 Jni is specific to Android.
33 static ChromotingClientRuntime* GetInstance();
34
35 scoped_refptr<AutoThreadTaskRunner> network_task_runner() {
36 return network_task_runner_;
37 }
38
39 scoped_refptr<AutoThreadTaskRunner> display_task_runner() {
40 return ui_task_runner_;
41 }
42
43 scoped_refptr<AutoThreadTaskRunner> file_task_runner() {
44 return file_task_runner_;
45 }
46
47 scoped_refptr<net::URLRequestContextGetter> url_requester() {
48 return url_requester_;
49 }
50
51 protected:
52 ChromotingClientRuntime();
53 // Forces a DisconnectFromHost() in case there is any active or failed
54 // connection, then proceeds to tear down the Chromium dependencies on which
55 // all sessions depended. Because destruction only occurs at application exit
56 // after all connections have terminated, it is safe to make unretained
57 // cross-thread calls on the class.
58 virtual ~ChromotingClientRuntime();
59
60 private:
61 // Chromium code's connection to the app message loop. Once created the
62 // MessageLoop will live for the life of the program. An attempt was made to
63 // create the primary message loop earlier in the programs life, but a
64 // MessageLoop requires ARC to be disabled.
Lambros 2016/03/03 19:15:08 ARC is Mac-specific, but this file is cross-platfo
65 base::MessageLoop* ui_loop_;
66
67 // References to native threads.
68 scoped_refptr<AutoThreadTaskRunner> ui_task_runner_;
69 scoped_refptr<AutoThreadTaskRunner> network_task_runner_;
70 scoped_refptr<AutoThreadTaskRunner> file_task_runner_;
71
72 scoped_refptr<net::URLRequestContextGetter> url_requester_;
73
74 friend struct base::DefaultSingletonTraits<ChromotingClientRuntime>;
75
76 DISALLOW_COPY_AND_ASSIGN(ChromotingClientRuntime);
77 };
78
79 } // namespace remoting
80
81 #endif // REMOTING_CLIENT_CHROMOTING_CLIENT_CONTEXT_H_
OLDNEW
« no previous file with comments | « no previous file | remoting/client/chromoting_client_runtime.cc » ('j') | remoting/client/chromoting_client_runtime.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698