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

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

Issue 2133503002: arc: Revamp the ArcBridgeService interface (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@master
Patch Set: Fix ui_arc_unittests Created 4 years, 5 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
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 <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 public: 68 public:
69 // Called whenever the state of the bridge has changed. 69 // Called whenever the state of the bridge has changed.
70 // TODO(lchavez): Rename to OnStateChangedForTest 70 // TODO(lchavez): Rename to OnStateChangedForTest
71 virtual void OnStateChanged(State state) {} 71 virtual void OnStateChanged(State state) {}
72 virtual void OnBridgeReady() {} 72 virtual void OnBridgeReady() {}
73 virtual void OnBridgeStopped() {} 73 virtual void OnBridgeStopped() {}
74 74
75 // Called whenever ARC's availability has changed for this system. 75 // Called whenever ARC's availability has changed for this system.
76 virtual void OnAvailableChanged(bool available) {} 76 virtual void OnAvailableChanged(bool available) {}
77 77
78 // Called whenever the ARC app interface state changes.
79 virtual void OnAppInstanceReady() {}
80 virtual void OnAppInstanceClosed() {}
81
82 // Called whenever the ARC audio interface state changes.
83 virtual void OnAudioInstanceReady() {}
84 virtual void OnAudioInstanceClosed() {}
85
86 // Called whenever the ARC auth interface state changes.
87 virtual void OnAuthInstanceReady() {}
88 virtual void OnAuthInstanceClosed() {}
89
90 // Called whenever ARC Bluetooth instance is ready.
91 virtual void OnBluetoothInstanceReady() {}
92 virtual void OnBluetoothInstanceClosed() {}
93
94 // Called whenever the ARC clipboard interface state changes.
95 virtual void OnClipboardInstanceReady() {}
96 virtual void OnClipboardInstanceClosed() {}
97
98 // Called whenever the ARC crash collector interface state changes.
99 virtual void OnCrashCollectorInstanceReady() {}
100 virtual void OnCrashCollectorInstanceClosed() {}
101
102 // Called whenever the ARC file system interface state changes.
103 virtual void OnFileSystemInstanceReady() {}
104 virtual void OnFileSystemInstanceClosed() {}
105
106 // Called whenever the ARC IME interface state changes.
107 virtual void OnImeInstanceReady() {}
108 virtual void OnImeInstanceClosed() {}
109
110 // Called whenever the ARC intent helper interface state changes.
111 virtual void OnIntentHelperInstanceReady() {}
112 virtual void OnIntentHelperInstanceClosed() {}
113
114 // Called whenever the ARC metrics interface state changes.
115 virtual void OnMetricsInstanceReady() {}
116 virtual void OnMetricsInstanceClosed() {}
117
118 // Called whenever the ARC notification interface state changes.
119 virtual void OnNotificationsInstanceReady() {}
120 virtual void OnNotificationsInstanceClosed() {}
121
122 // Called whenever the ARC net interface state changes.
123 virtual void OnNetInstanceReady() {}
124 virtual void OnNetInstanceClosed() {}
125
126 // Called whenever the ARC OBB mounter interface state changes.
127 virtual void OnObbMounterInstanceReady() {}
128 virtual void OnObbMounterInstanceClosed() {}
129
130 // Called whenever the ARC policy interface state changes.
131 virtual void OnPolicyInstanceReady() {}
132 virtual void OnPolicyInstanceClosed() {}
133
134 // Called whenever the ARC power interface state changes.
135 virtual void OnPowerInstanceReady() {}
136 virtual void OnPowerInstanceClosed() {}
137
138 // Called whenever the ARC process interface state changes.
139 virtual void OnProcessInstanceReady() {}
140 virtual void OnProcessInstanceClosed() {}
141
142 // Called whenever the ARC storage manager interface state changes.
143 virtual void OnStorageManagerInstanceReady() {}
144 virtual void OnStorageManagerInstanceClosed() {}
145
146 // Called whenever the ARC video interface state changes.
147 virtual void OnVideoInstanceReady() {}
148 virtual void OnVideoInstanceClosed() {}
149
150 // Called whenever the ARC window manager interface state changes.
151 virtual void OnWindowManagerInstanceReady() {}
152 virtual void OnWindowManagerInstanceClosed() {}
153
154 protected: 78 protected:
155 virtual ~Observer() {} 79 virtual ~Observer() {}
156 }; 80 };
157 81
82 // Notifies about connection events for individual instances.
83 template <typename T>
hidehiko 2016/07/11 05:24:53 Could you comment that T needs to be a mojo interf
Luis Héctor Chávez 2016/07/11 17:13:34 Done.
84 class InstanceObserver {
hidehiko 2016/07/11 05:24:53 InstanceObserver and InstanceHolder looks enough b
Luis Héctor Chávez 2016/07/11 17:13:34 Done.
85 public:
86 // Called once the instance is ready. It is guaranteed that |instance| will
87 // not be null.
88 virtual void OnInstanceReady(T* instance, uint32_t version) {}
89
90 // The parameter is always nullptr, but is required to be able to
91 // distinguish between implementations of InstanceObserver for different
92 // types.
93 virtual void OnInstanceClosed(T*) {}
hidehiko 2016/07/11 05:24:53 Could you get rid of T*? I'm guessing that it is
Luis Héctor Chávez 2016/07/11 17:13:34 I can't :/ The metrics service tries needs to wait
94
95 protected:
96 virtual ~InstanceObserver() {}
hidehiko 2016/07/11 05:24:53 nit: s/{}/= default/
Luis Héctor Chávez 2016/07/11 17:13:34 Done.
97 };
98
99 template <typename T>
100 class InstanceHolder {
101 public:
102 InstanceHolder() : weak_factory_(this) {}
103
104 // Gets the Mojo interface for all the instance services. This will return
105 // nullptr if that particular service is not ready yet. Use an
106 // InstanceObserver if you want to be notified when this is ready. This can
107 // only be called on the thread that this class was created on.
108 T* instance() const { return raw_ptr_; }
hidehiko 2016/07/11 05:24:53 To access the raw pointer of T, there are two ways
Luis Héctor Chávez 2016/07/11 17:13:34 I'd prefer to not keep the ptr since it is more er
109 uint32_t version() const { return version_; }
110
111 // Adds or removes observers. This can only be called on the thread that
112 // this class was created on. RemoveObserver does nothing if |observer| is
113 // not in the list.
114 void AddObserver(InstanceObserver<T>* observer) {
115 DCHECK(thread_checker_.CalledOnValidThread());
116 observer_list_.AddObserver(observer);
117
118 if (instance())
119 observer->OnInstanceReady(instance(), version());
120 }
121
122 void RemoveObserver(InstanceObserver<T>* observer) {
123 DCHECK(thread_checker_.CalledOnValidThread());
124 observer_list_.RemoveObserver(observer);
125 }
126
127 // Called when the channel is closed.
128 void CloseChannel() {
129 if (!ptr_)
130 return;
131
132 ptr_.reset();
133 raw_ptr_ = nullptr;
134 version_ = 0;
135 if (observer_list_.might_have_observers()) {
hidehiko 2016/07/11 05:24:53 FOR_EACH_OBSERVER(InstanceObserver<T>, observer_li
Luis Héctor Chávez 2016/07/11 17:13:34 It doesn't since it needs the 'typename' since Ins
Luis Héctor Chávez 2016/07/11 20:10:44 Filed https://bugs.chromium.org/p/chromium/issues/
136 typename base::ObserverList<InstanceObserver<T>>::Iterator it(
137 &observer_list_);
138 InstanceObserver<T>* obs;
139 while ((obs = it.GetNext()) != nullptr)
140 obs->OnInstanceClosed(instance());
141 }
142 }
143
144 // Sets the interface pointer to |ptr|, once the version is determined. This
145 // will eventually invoke SetInstance(), which will notify the observers.
146 void OnInstanceReady(mojo::InterfacePtr<T> ptr) {
147 temporary_ptr_ = std::move(ptr);
148 temporary_ptr_.QueryVersion(base::Bind(&InstanceHolder<T>::OnVersionReady,
149 weak_factory_.GetWeakPtr()));
150 }
151
152 // This method is not intended to be called directly. Normally it is called
153 // by OnInstanceReady once the version of the instance is determined, but it
154 // is also exposed so that tests can directly inject a raw pointer+version
155 // combination.
156 void SetInstance(T* raw_ptr, uint32_t raw_version = T::Version_) {
157 raw_ptr_ = raw_ptr;
158 version_ = raw_version;
159 if (observer_list_.might_have_observers()) {
hidehiko 2016/07/11 05:24:53 Ditto for FOR_EACH_OBSERVER.
Luis Héctor Chávez 2016/07/11 17:13:34 Acknowledged.
160 typename base::ObserverList<InstanceObserver<T>>::Iterator it(
161 &observer_list_);
162 InstanceObserver<T>* obs;
163 while ((obs = it.GetNext()) != nullptr)
164 obs->OnInstanceReady(instance(), version());
165 }
166 }
167
168 private:
169 void OnVersionReady(uint32_t version) {
170 ptr_ = std::move(temporary_ptr_);
171 ptr_.set_connection_error_handler(base::Bind(
172 &InstanceHolder<T>::CloseChannel, weak_factory_.GetWeakPtr()));
173 SetInstance(ptr_.get(), version);
174 }
175
176 // These two are copies of the contents of ptr_. They are provided here just
177 // so that tests can provide non-mojo implementations.
178 T* raw_ptr_ = nullptr;
179 uint32_t version_ = 0;
180
181 mojo::InterfacePtr<T> ptr_;
182
183 // Temporary Mojo interfaces. After a Mojo interface pointer has been
184 // received from the other endpoint, we still need to asynchronously query
185 // its version. While that is going on, we should still return nullptr on
186 // the instance() function.
187 // To keep the instance() functions being trivial, store the instance
188 // pointer in a temporary variable to avoid losing its reference.
189 mojo::InterfacePtr<T> temporary_ptr_;
190
191 base::ThreadChecker thread_checker_;
192 base::ObserverList<InstanceObserver<T>> observer_list_;
193 base::WeakPtrFactory<InstanceHolder<T>> weak_factory_;
hidehiko 2016/07/11 05:24:53 Could you comment that this needs to be the last m
Luis Héctor Chávez 2016/07/11 17:13:34 Sure
194
195 DISALLOW_COPY_AND_ASSIGN(InstanceHolder<T>);
196 };
197
158 ~ArcBridgeService() override; 198 ~ArcBridgeService() override;
159 199
160 // Gets the global instance of the ARC Bridge Service. This can only be 200 // Gets the global instance of the ARC Bridge Service. This can only be
161 // called on the thread that this class was created on. 201 // called on the thread that this class was created on.
162 static ArcBridgeService* Get(); 202 static ArcBridgeService* Get();
163 203
164 // Return true if ARC has been enabled through a commandline 204 // Return true if ARC has been enabled through a commandline
165 // switch. 205 // switch.
166 static bool GetEnabled(const base::CommandLine* command_line); 206 static bool GetEnabled(const base::CommandLine* command_line);
167 207
(...skipping 10 matching lines...) Expand all
178 // Shutdown() should be called when the browser is shutting down. This can 218 // Shutdown() should be called when the browser is shutting down. This can
179 // only be called on the thread that this class was created on. 219 // only be called on the thread that this class was created on.
180 virtual void Shutdown() = 0; 220 virtual void Shutdown() = 0;
181 221
182 // Adds or removes observers. This can only be called on the thread that this 222 // Adds or removes observers. This can only be called on the thread that this
183 // class was created on. RemoveObserver does nothing if |observer| is not in 223 // class was created on. RemoveObserver does nothing if |observer| is not in
184 // the list. 224 // the list.
185 void AddObserver(Observer* observer); 225 void AddObserver(Observer* observer);
186 void RemoveObserver(Observer* observer); 226 void RemoveObserver(Observer* observer);
187 227
188 // Gets the Mojo interface for all the instance services. This will return 228 InstanceHolder<mojom::AppInstance>* app() { return &app_; }
189 // nullptr if that particular service is not ready yet. Use an Observer if 229 InstanceHolder<mojom::AudioInstance>* audio() { return &audio_; }
190 // you want to be notified when this is ready. This can only be called on the 230 InstanceHolder<mojom::AuthInstance>* auth() { return &auth_; }
191 // thread that this class was created on. 231 InstanceHolder<mojom::BluetoothInstance>* bluetooth() { return &bluetooth_; }
192 mojom::AppInstance* app_instance() { return app_ptr_.get(); } 232 InstanceHolder<mojom::ClipboardInstance>* clipboard() { return &clipboard_; }
193 mojom::AudioInstance* audio_instance() { return audio_ptr_.get(); } 233 InstanceHolder<mojom::CrashCollectorInstance>* crash_collector() {
194 mojom::AuthInstance* auth_instance() { return auth_ptr_.get(); } 234 return &crash_collector_;
195 mojom::BluetoothInstance* bluetooth_instance() {
196 return bluetooth_ptr_.get();
197 } 235 }
198 mojom::ClipboardInstance* clipboard_instance() { 236 InstanceHolder<mojom::FileSystemInstance>* file_system() {
199 return clipboard_ptr_.get(); 237 return &file_system_;
200 } 238 }
201 mojom::CrashCollectorInstance* crash_collector_instance() { 239 InstanceHolder<mojom::ImeInstance>* ime() { return &ime_; }
202 return crash_collector_ptr_.get(); 240 InstanceHolder<mojom::IntentHelperInstance>* intent_helper() {
241 return &intent_helper_;
203 } 242 }
204 mojom::FileSystemInstance* file_system_instance() { 243 InstanceHolder<mojom::MetricsInstance>* metrics() { return &metrics_; }
205 return file_system_ptr_.get(); 244 InstanceHolder<mojom::NetInstance>* net() { return &net_; }
245 InstanceHolder<mojom::NotificationsInstance>* notifications() {
246 return &notifications_;
206 } 247 }
207 mojom::ImeInstance* ime_instance() { return ime_ptr_.get(); } 248 InstanceHolder<mojom::ObbMounterInstance>* obb_mounter() {
208 mojom::IntentHelperInstance* intent_helper_instance() { 249 return &obb_mounter_;
209 return intent_helper_ptr_.get();
210 } 250 }
211 mojom::MetricsInstance* metrics_instance() { return metrics_ptr_.get(); } 251 InstanceHolder<mojom::PolicyInstance>* policy() { return &policy_; }
212 mojom::NetInstance* net_instance() { return net_ptr_.get(); } 252 InstanceHolder<mojom::PowerInstance>* power() { return &power_; }
213 mojom::NotificationsInstance* notifications_instance() { 253 InstanceHolder<mojom::ProcessInstance>* process() { return &process_; }
214 return notifications_ptr_.get(); 254 InstanceHolder<mojom::StorageManagerInstance>* storage_manager() {
255 return &storage_manager_;
215 } 256 }
216 mojom::ObbMounterInstance* obb_mounter_instance() { 257 InstanceHolder<mojom::VideoInstance>* video() { return &video_; }
217 return obb_mounter_ptr_.get(); 258 InstanceHolder<mojom::WindowManagerInstance>* window_manager() {
218 } 259 return &window_manager_;
219 mojom::PolicyInstance* policy_instance() { return policy_ptr_.get(); }
220 mojom::PowerInstance* power_instance() { return power_ptr_.get(); }
221 mojom::ProcessInstance* process_instance() { return process_ptr_.get(); }
222 mojom::StorageManagerInstance* storage_manager_instance() {
223 return storage_manager_ptr_.get();
224 }
225 mojom::VideoInstance* video_instance() { return video_ptr_.get(); }
226 mojom::WindowManagerInstance* window_manager_instance() {
227 return window_manager_ptr_.get();
228 }
229
230 int32_t app_version() const { return app_ptr_.version(); }
231 int32_t audio_version() const { return audio_ptr_.version(); }
232 int32_t bluetooth_version() const { return bluetooth_ptr_.version(); }
233 int32_t auth_version() const { return auth_ptr_.version(); }
234 int32_t clipboard_version() const { return clipboard_ptr_.version(); }
235 int32_t crash_collector_version() const {
236 return crash_collector_ptr_.version();
237 }
238 int32_t file_system_version() const { return file_system_ptr_.version(); }
239 int32_t ime_version() const { return ime_ptr_.version(); }
240 int32_t intent_helper_version() const { return intent_helper_ptr_.version(); }
241 int32_t metrics_version() const { return metrics_ptr_.version(); }
242 int32_t net_version() const { return net_ptr_.version(); }
243 int32_t notifications_version() const { return notifications_ptr_.version(); }
244 int32_t obb_mounter_version() const { return obb_mounter_ptr_.version(); }
245 int32_t policy_version() const { return policy_ptr_.version(); }
246 int32_t power_version() const { return power_ptr_.version(); }
247 int32_t process_version() const { return process_ptr_.version(); }
248 int32_t storage_manager_version() const {
249 return storage_manager_ptr_.version();
250 }
251 int32_t video_version() const { return video_ptr_.version(); }
252 int32_t window_manager_version() const {
253 return window_manager_ptr_.version();
254 } 260 }
255 261
256 // ArcHost: 262 // ArcHost:
257 void OnAppInstanceReady(mojom::AppInstancePtr app_ptr) override; 263 void OnAppInstanceReady(mojom::AppInstancePtr app_ptr) override;
hidehiko 2016/07/11 05:24:53 Clarification: Not necessary to do in this CL (mor
hidehiko 2016/07/11 06:09:32 Oh, your CL following this one actually did the Ar
Luis Héctor Chávez 2016/07/11 17:13:34 Acknowledged.
258 void OnAudioInstanceReady(mojom::AudioInstancePtr audio_ptr) override; 264 void OnAudioInstanceReady(mojom::AudioInstancePtr audio_ptr) override;
259 void OnAuthInstanceReady(mojom::AuthInstancePtr auth_ptr) override; 265 void OnAuthInstanceReady(mojom::AuthInstancePtr auth_ptr) override;
260 void OnBluetoothInstanceReady( 266 void OnBluetoothInstanceReady(
261 mojom::BluetoothInstancePtr bluetooth_ptr) override; 267 mojom::BluetoothInstancePtr bluetooth_ptr) override;
262 void OnClipboardInstanceReady( 268 void OnClipboardInstanceReady(
263 mojom::ClipboardInstancePtr clipboard_ptr) override; 269 mojom::ClipboardInstancePtr clipboard_ptr) override;
264 void OnCrashCollectorInstanceReady( 270 void OnCrashCollectorInstanceReady(
265 mojom::CrashCollectorInstancePtr crash_collector_ptr) override; 271 mojom::CrashCollectorInstancePtr crash_collector_ptr) override;
266 void OnFileSystemInstanceReady( 272 void OnFileSystemInstanceReady(
267 mojom::FileSystemInstancePtr file_system_ptr) override; 273 mojom::FileSystemInstancePtr file_system_ptr) override;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 // Closes all Mojo channels. 311 // Closes all Mojo channels.
306 void CloseAllChannels(); 312 void CloseAllChannels();
307 313
308 private: 314 private:
309 friend class ArcBridgeTest; 315 friend class ArcBridgeTest;
310 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Basic); 316 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Basic);
311 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Prerequisites); 317 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Prerequisites);
312 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, ShutdownMidStartup); 318 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, ShutdownMidStartup);
313 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Restart); 319 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Restart);
314 320
315 // Called when one of the individual channels is closed. 321 // Instance holders.
316 void CloseAppChannel(); 322 InstanceHolder<mojom::AppInstance> app_;
317 void CloseAudioChannel(); 323 InstanceHolder<mojom::AudioInstance> audio_;
318 void CloseAuthChannel(); 324 InstanceHolder<mojom::AuthInstance> auth_;
319 void CloseBluetoothChannel(); 325 InstanceHolder<mojom::BluetoothInstance> bluetooth_;
320 void CloseClipboardChannel(); 326 InstanceHolder<mojom::ClipboardInstance> clipboard_;
321 void CloseCrashCollectorChannel(); 327 InstanceHolder<mojom::CrashCollectorInstance> crash_collector_;
322 void CloseFileSystemChannel(); 328 InstanceHolder<mojom::FileSystemInstance> file_system_;
323 void CloseImeChannel(); 329 InstanceHolder<mojom::ImeInstance> ime_;
324 void CloseIntentHelperChannel(); 330 InstanceHolder<mojom::IntentHelperInstance> intent_helper_;
325 void CloseMetricsChannel(); 331 InstanceHolder<mojom::MetricsInstance> metrics_;
326 void CloseNetChannel(); 332 InstanceHolder<mojom::NetInstance> net_;
327 void CloseNotificationsChannel(); 333 InstanceHolder<mojom::NotificationsInstance> notifications_;
328 void CloseObbMounterChannel(); 334 InstanceHolder<mojom::ObbMounterInstance> obb_mounter_;
329 void ClosePolicyChannel(); 335 InstanceHolder<mojom::PolicyInstance> policy_;
330 void ClosePowerChannel(); 336 InstanceHolder<mojom::PowerInstance> power_;
331 void CloseProcessChannel(); 337 InstanceHolder<mojom::ProcessInstance> process_;
332 void CloseStorageManagerChannel(); 338 InstanceHolder<mojom::StorageManagerInstance> storage_manager_;
333 void CloseVideoChannel(); 339 InstanceHolder<mojom::VideoInstance> video_;
334 void CloseWindowManagerChannel(); 340 InstanceHolder<mojom::WindowManagerInstance> window_manager_;
335
336 // Callbacks for QueryVersion.
337 void OnAppVersionReady(uint32_t version);
338 void OnAudioVersionReady(uint32_t version);
339 void OnAuthVersionReady(uint32_t version);
340 void OnBluetoothVersionReady(uint32_t version);
341 void OnClipboardVersionReady(uint32_t version);
342 void OnCrashCollectorVersionReady(uint32_t version);
343 void OnFileSystemVersionReady(uint32_t version);
344 void OnImeVersionReady(uint32_t version);
345 void OnIntentHelperVersionReady(uint32_t version);
346 void OnMetricsVersionReady(uint32_t version);
347 void OnNetVersionReady(uint32_t version);
348 void OnNotificationsVersionReady(uint32_t version);
349 void OnObbMounterVersionReady(uint32_t version);
350 void OnPolicyVersionReady(uint32_t version);
351 void OnPowerVersionReady(uint32_t version);
352 void OnProcessVersionReady(uint32_t version);
353 void OnStorageManagerVersionReady(uint32_t version);
354 void OnVideoVersionReady(uint32_t version);
355 void OnWindowManagerVersionReady(uint32_t version);
356
357 // Mojo interfaces.
358 mojom::AppInstancePtr app_ptr_;
359 mojom::AudioInstancePtr audio_ptr_;
360 mojom::AuthInstancePtr auth_ptr_;
361 mojom::BluetoothInstancePtr bluetooth_ptr_;
362 mojom::ClipboardInstancePtr clipboard_ptr_;
363 mojom::CrashCollectorInstancePtr crash_collector_ptr_;
364 mojom::FileSystemInstancePtr file_system_ptr_;
365 mojom::ImeInstancePtr ime_ptr_;
366 mojom::IntentHelperInstancePtr intent_helper_ptr_;
367 mojom::MetricsInstancePtr metrics_ptr_;
368 mojom::NetInstancePtr net_ptr_;
369 mojom::NotificationsInstancePtr notifications_ptr_;
370 mojom::ObbMounterInstancePtr obb_mounter_ptr_;
371 mojom::PolicyInstancePtr policy_ptr_;
372 mojom::PowerInstancePtr power_ptr_;
373 mojom::ProcessInstancePtr process_ptr_;
374 mojom::StorageManagerInstancePtr storage_manager_ptr_;
375 mojom::VideoInstancePtr video_ptr_;
376 mojom::WindowManagerInstancePtr window_manager_ptr_;
377
378 // Temporary Mojo interfaces. After a Mojo interface pointer has been
379 // received from the other endpoint, we still need to asynchronously query
380 // its version. While that is going on, we should still return nullptr on
381 // the xxx_instance() functions.
382 // To keep the xxx_instance() functions being trivial, store the instance
383 // pointer in a temporary variable to avoid losing its reference.
384 mojom::AppInstancePtr temporary_app_ptr_;
385 mojom::AudioInstancePtr temporary_audio_ptr_;
386 mojom::AuthInstancePtr temporary_auth_ptr_;
387 mojom::BluetoothInstancePtr temporary_bluetooth_ptr_;
388 mojom::ClipboardInstancePtr temporary_clipboard_ptr_;
389 mojom::CrashCollectorInstancePtr temporary_crash_collector_ptr_;
390 mojom::FileSystemInstancePtr temporary_file_system_ptr_;
391 mojom::ImeInstancePtr temporary_ime_ptr_;
392 mojom::IntentHelperInstancePtr temporary_intent_helper_ptr_;
393 mojom::MetricsInstancePtr temporary_metrics_ptr_;
394 mojom::NetInstancePtr temporary_net_ptr_;
395 mojom::NotificationsInstancePtr temporary_notifications_ptr_;
396 mojom::ObbMounterInstancePtr temporary_obb_mounter_ptr_;
397 mojom::PolicyInstancePtr temporary_policy_ptr_;
398 mojom::PowerInstancePtr temporary_power_ptr_;
399 mojom::ProcessInstancePtr temporary_process_ptr_;
400 mojom::StorageManagerInstancePtr temporary_storage_manager_ptr_;
401 mojom::VideoInstancePtr temporary_video_ptr_;
402 mojom::WindowManagerInstancePtr temporary_window_manager_ptr_;
403 341
404 base::ObserverList<Observer> observer_list_; 342 base::ObserverList<Observer> observer_list_;
405 343
406 base::ThreadChecker thread_checker_; 344 base::ThreadChecker thread_checker_;
407 345
408 // If the ARC instance service is available. 346 // If the ARC instance service is available.
409 bool available_; 347 bool available_;
410 348
411 // The current state of the bridge. 349 // The current state of the bridge.
412 ArcBridgeService::State state_; 350 ArcBridgeService::State state_;
413 351
414 // WeakPtrFactory to use callbacks. 352 // WeakPtrFactory to use callbacks.
415 base::WeakPtrFactory<ArcBridgeService> weak_factory_; 353 base::WeakPtrFactory<ArcBridgeService> weak_factory_;
416 354
417 DISALLOW_COPY_AND_ASSIGN(ArcBridgeService); 355 DISALLOW_COPY_AND_ASSIGN(ArcBridgeService);
418 }; 356 };
419 357
420 } // namespace arc 358 } // namespace arc
421 359
422 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ 360 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698