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

Side by Side Diff: components/arc/arc_bridge_service.h

Issue 1456133005: arc-bridge: establish connections with arc video accelerator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gpu-arc-accelerator
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « components/arc/DEPS ('k') | components/arc/arc_bridge_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ 5 #ifndef COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_
6 #define COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ 6 #define COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/observer_list.h" 9 #include "base/observer_list.h"
10 #include "base/sequenced_task_runner.h" 10 #include "base/sequenced_task_runner.h"
11 #include "ipc/ipc_channel_handle.h"
11 #include "ipc/ipc_channel_proxy.h" 12 #include "ipc/ipc_channel_proxy.h"
12 #include "ipc/ipc_listener.h" 13 #include "ipc/ipc_listener.h"
13 #include "ipc/ipc_message.h" 14 #include "ipc/ipc_message.h"
14 15
16 namespace content {
17 class GpuArcAcceleratorHost;
18 }
19
15 namespace arc { 20 namespace arc {
16 21
17 // The Chrome-side service that handles ARC instances and ARC bridge creation. 22 // The Chrome-side service that handles ARC instances and ARC bridge creation.
18 // This service handles the lifetime of ARC instances and sets up the 23 // This service handles the lifetime of ARC instances and sets up the
19 // communication channel (the ARC bridge) used to send and receive messages. 24 // communication channel (the ARC bridge) used to send and receive messages.
20 class ArcBridgeService : public IPC::Listener { 25 class ArcBridgeService : public IPC::Listener, public IPC::Sender {
21 public: 26 public:
22 // The possible states of the bridge. In the normal flow, the state changes 27 // The possible states of the bridge. In the normal flow, the state changes
23 // in the following sequence: 28 // in the following sequence:
24 // 29 //
25 // STOPPED 30 // STOPPED
26 // SetAvailable(true) + HandleStartup() -> SocketConnect() -> 31 // SetAvailable(true) + HandleStartup() -> SocketConnect() ->
27 // CONNECTING 32 // CONNECTING
28 // Connect() -> 33 // Connect() ->
29 // CONNECTED 34 // CONNECTED
30 // SocketConnectAfterSetSocketPermissions() -> 35 // SocketConnectAfterSetSocketPermissions() ->
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 78
74 ArcBridgeService( 79 ArcBridgeService(
75 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner, 80 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner,
76 const scoped_refptr<base::SequencedTaskRunner>& file_task_runner); 81 const scoped_refptr<base::SequencedTaskRunner>& file_task_runner);
77 ~ArcBridgeService() override; 82 ~ArcBridgeService() override;
78 83
79 // Gets the global instance of the ARC Bridge Service. This can only be 84 // Gets the global instance of the ARC Bridge Service. This can only be
80 // called on the thread that this class was created on. 85 // called on the thread that this class was created on.
81 static ArcBridgeService* Get(); 86 static ArcBridgeService* Get();
82 87
88 // IPC::Sender:
89 bool Send(IPC::Message* message) override;
90
83 // DetectAvailability() should be called once D-Bus is available. It will 91 // DetectAvailability() should be called once D-Bus is available. It will
84 // call CheckArcAvailability() on the session_manager. This can only be 92 // call CheckArcAvailability() on the session_manager. This can only be
85 // called on the thread that this class was created on. 93 // called on the thread that this class was created on.
86 void DetectAvailability(); 94 void DetectAvailability();
87 95
88 // HandleStartup() should be called upon profile startup. This will only 96 // HandleStartup() should be called upon profile startup. This will only
89 // launch an instance if the instance service is available and it is enabled. 97 // launch an instance if the instance service is available and it is enabled.
90 // This can only be called on the thread that this class was created on. 98 // This can only be called on the thread that this class was created on.
91 void HandleStartup(); 99 void HandleStartup();
92 100
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 void SocketConnectAfterSetSocketPermissions(const base::FilePath& socket_path, 149 void SocketConnectAfterSetSocketPermissions(const base::FilePath& socket_path,
142 bool socket_permissions_success); 150 bool socket_permissions_success);
143 151
144 // Stops the running instance. 152 // Stops the running instance.
145 void StopInstance(); 153 void StopInstance();
146 154
147 // Called when the ARC instance has finished setting up and is ready for user 155 // Called when the ARC instance has finished setting up and is ready for user
148 // interaction. 156 // interaction.
149 void OnInstanceReady(); 157 void OnInstanceReady();
150 158
159 void OnCreateArcVideoAccelerator(uint32_t device_type,
160 IPC::Message* reply_msg);
161 void ReplyCreateArcVideoAccelerator(IPC::Message* reply,
162 IPC::ChannelHandle handle,
163 uint32_t result);
164
151 // Changes the current state and notifies all observers. 165 // Changes the current state and notifies all observers.
152 void SetState(State state); 166 void SetState(State state);
153 167
154 // IPC::Listener: 168 // IPC::Listener:
155 bool OnMessageReceived(const IPC::Message& message) override; 169 bool OnMessageReceived(const IPC::Message& message) override;
156 170
157 // DBus callbacks. 171 // DBus callbacks.
158 void OnArcAvailable(bool available); 172 void OnArcAvailable(bool available);
159 void OnInstanceStarted(bool success); 173 void OnInstanceStarted(bool success);
160 void OnInstanceStopped(bool success); 174 void OnInstanceStopped(bool success);
161 175
176 scoped_ptr<content::GpuArcAcceleratorHost> gpu_arc_accelerator_host_;
162 scoped_refptr<base::SequencedTaskRunner> origin_task_runner_; 177 scoped_refptr<base::SequencedTaskRunner> origin_task_runner_;
163 scoped_refptr<base::SingleThreadTaskRunner> ipc_task_runner_; 178 scoped_refptr<base::SingleThreadTaskRunner> ipc_task_runner_;
164 scoped_refptr<base::SequencedTaskRunner> file_task_runner_; 179 scoped_refptr<base::SequencedTaskRunner> file_task_runner_;
165 180
166 scoped_ptr<IPC::ChannelProxy> ipc_channel_; 181 scoped_ptr<IPC::ChannelProxy> ipc_channel_;
167 182
168 base::ObserverList<Observer> observer_list_; 183 base::ObserverList<Observer> observer_list_;
169 184
170 // If the user's session has started. 185 // If the user's session has started.
171 bool session_started_; 186 bool session_started_;
172 187
173 // If the ARC instance service is available. 188 // If the ARC instance service is available.
174 bool available_; 189 bool available_;
175 190
176 // The current state of the bridge. 191 // The current state of the bridge.
177 ArcBridgeService::State state_; 192 ArcBridgeService::State state_;
178 193
179 // WeakPtrFactory to use callbacks. 194 // WeakPtrFactory to use callbacks.
180 base::WeakPtrFactory<ArcBridgeService> weak_factory_; 195 base::WeakPtrFactory<ArcBridgeService> weak_factory_;
181 196
182 DISALLOW_COPY_AND_ASSIGN(ArcBridgeService); 197 DISALLOW_COPY_AND_ASSIGN(ArcBridgeService);
183 }; 198 };
184 199
185 } // namespace arc 200 } // namespace arc
186 201
187 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ 202 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_
OLDNEW
« no previous file with comments | « components/arc/DEPS ('k') | components/arc/arc_bridge_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698