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

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: Updated based on feedback. Removed unused includes. 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
14 namespace base {
15 template<typename T> struct DefaultSingletonTraits;
16 }
17
18 // Houses the global resources on which the Chromoting components run
19 // (e.g. message loops and task runners).
20 namespace remoting {
21
22 class ChromotingClientRuntime {
23 public:
24 // This class is instantiated at process initialization and persists until
25 // we close. Its components are reused across |ChromotingClientRuntime|s.
26 static ChromotingClientRuntime* GetInstance();
27
28 scoped_refptr<AutoThreadTaskRunner> network_task_runner() {
29 return network_task_runner_;
30 }
31
32 scoped_refptr<AutoThreadTaskRunner> display_task_runner() {
33 return ui_task_runner_;
34 }
35
36 scoped_refptr<AutoThreadTaskRunner> file_task_runner() {
37 return file_task_runner_;
38 }
39
40 scoped_refptr<net::URLRequestContextGetter> url_requester() {
41 return url_requester_;
42 }
43
44 protected:
45 ChromotingClientRuntime();
46 // Forces a DisconnectFromHost() in case there is any active or failed
47 // connection, then proceeds to tear down the Chromium dependencies on which
48 // all sessions depended. Because destruction only occurs at application exit
49 // after all connections have terminated, it is safe to make unretained
50 // cross-thread calls on the class.
51 virtual ~ChromotingClientRuntime();
52
53 private:
54 // Chromium code's connection to the app message loop. Once created the
55 // MessageLoop will live for the life of the program.
56 base::MessageLoop* ui_loop_;
57
58 // References to native threads.
59 scoped_refptr<AutoThreadTaskRunner> ui_task_runner_;
60 scoped_refptr<AutoThreadTaskRunner> network_task_runner_;
61 scoped_refptr<AutoThreadTaskRunner> file_task_runner_;
62
63 scoped_refptr<net::URLRequestContextGetter> url_requester_;
64
65 friend struct base::DefaultSingletonTraits<ChromotingClientRuntime>;
66
67 DISALLOW_COPY_AND_ASSIGN(ChromotingClientRuntime);
68 };
69
70 } // namespace remoting
71
72 #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/chromoting_client_runtime.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698