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

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

Issue 1551763002: arc-bridge: Expose the Mojo version number of the interfaces (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « no previous file | 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 <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 // thread that this class was created on. 143 // thread that this class was created on.
144 AppInstance* app_instance() { return app_ptr_.get(); } 144 AppInstance* app_instance() { return app_ptr_.get(); }
145 InputInstance* input_instance() { return input_ptr_.get(); } 145 InputInstance* input_instance() { return input_ptr_.get(); }
146 NotificationsInstance* notifications_instance() { 146 NotificationsInstance* notifications_instance() {
147 return notifications_ptr_.get(); 147 return notifications_ptr_.get();
148 } 148 }
149 PowerInstance* power_instance() { return power_ptr_.get(); } 149 PowerInstance* power_instance() { return power_ptr_.get(); }
150 ProcessInstance* process_instance() { return process_ptr_.get(); } 150 ProcessInstance* process_instance() { return process_ptr_.get(); }
151 SettingsInstance* settings_instance() { return settings_ptr_.get(); } 151 SettingsInstance* settings_instance() { return settings_ptr_.get(); }
152 152
153 int32_t app_version() const { return app_ptr_.version(); }
154 int32_t input_version() const { return input_ptr_.version(); }
155 int32_t notifications_version() const { return notifications_ptr_.version(); }
156 int32_t power_version() const { return power_ptr_.version(); }
157 int32_t process_version() const { return process_ptr_.version(); }
158 int32_t settings_version() const { return settings_ptr_.version(); }
159
153 // ArcHost: 160 // ArcHost:
154 void OnAppInstanceReady(AppInstancePtr app_ptr) override; 161 void OnAppInstanceReady(AppInstancePtr app_ptr) override;
155 void OnInputInstanceReady(InputInstancePtr input_ptr) override; 162 void OnInputInstanceReady(InputInstancePtr input_ptr) override;
156 void OnNotificationsInstanceReady( 163 void OnNotificationsInstanceReady(
157 NotificationsInstancePtr notifications_ptr) override; 164 NotificationsInstancePtr notifications_ptr) override;
158 void OnPowerInstanceReady(PowerInstancePtr power_ptr) override; 165 void OnPowerInstanceReady(PowerInstancePtr power_ptr) override;
159 void OnProcessInstanceReady(ProcessInstancePtr process_ptr) override; 166 void OnProcessInstanceReady(ProcessInstancePtr process_ptr) override;
160 void OnSettingsInstanceReady(SettingsInstancePtr process_ptr) override; 167 void OnSettingsInstanceReady(SettingsInstancePtr process_ptr) override;
161 168
162 // Gets the current state of the bridge service. 169 // Gets the current state of the bridge service.
(...skipping 14 matching lines...) Expand all
177 base::ObserverList<Observer>& observer_list() { return observer_list_; } 184 base::ObserverList<Observer>& observer_list() { return observer_list_; }
178 185
179 bool CalledOnValidThread(); 186 bool CalledOnValidThread();
180 187
181 private: 188 private:
182 friend class ArcBridgeTest; 189 friend class ArcBridgeTest;
183 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Basic); 190 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Basic);
184 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Prerequisites); 191 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Prerequisites);
185 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, ShutdownMidStartup); 192 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, ShutdownMidStartup);
186 193
194 // Callbacks for QueryVersion.
195 void OnAppVersionReady(int32_t version);
196 void OnInputVersionReady(int32_t version);
197 void OnNotificationsVersionReady(int32_t version);
198 void OnPowerVersionReady(int32_t version);
199 void OnProcessVersionReady(int32_t version);
200 void OnSettingsVersionReady(int32_t version);
201
187 // Mojo interfaces. 202 // Mojo interfaces.
188 AppInstancePtr app_ptr_; 203 AppInstancePtr app_ptr_;
189 InputInstancePtr input_ptr_; 204 InputInstancePtr input_ptr_;
190 NotificationsInstancePtr notifications_ptr_; 205 NotificationsInstancePtr notifications_ptr_;
191 PowerInstancePtr power_ptr_; 206 PowerInstancePtr power_ptr_;
192 ProcessInstancePtr process_ptr_; 207 ProcessInstancePtr process_ptr_;
193 SettingsInstancePtr settings_ptr_; 208 SettingsInstancePtr settings_ptr_;
194 209
210 // Temporary Mojo interfaces. After a Mojo interface pointer has been
211 // received from the other endpoint, we still need to asynchronously query
212 // its version. While that is going on, we should still return nullptr on
213 // the xxx_instance() functions.
214 // To keep the xxx_instance() functions being trivial, store the instance
215 // pointer in a temporary variable to avoid losing its reference.
216 AppInstancePtr temporary_app_ptr_;
hidehiko 2015/12/29 13:49:20 Instead of making temporary_XXX_ptr_ fields, you c
Luis Héctor Chávez 2015/12/29 16:51:09 That won't work. It would need something like app
hidehiko 2016/01/05 08:05:52 Ah, you're right. QueryVersion is a member of Inte
217 InputInstancePtr temporary_input_ptr_;
218 NotificationsInstancePtr temporary_notifications_ptr_;
219 PowerInstancePtr temporary_power_ptr_;
220 ProcessInstancePtr temporary_process_ptr_;
221 SettingsInstancePtr temporary_settings_ptr_;
222
195 base::ObserverList<Observer> observer_list_; 223 base::ObserverList<Observer> observer_list_;
196 224
197 base::ThreadChecker thread_checker_; 225 base::ThreadChecker thread_checker_;
198 226
199 // If the ARC instance service is available. 227 // If the ARC instance service is available.
200 bool available_; 228 bool available_;
201 229
202 // The current state of the bridge. 230 // The current state of the bridge.
203 ArcBridgeService::State state_; 231 ArcBridgeService::State state_;
204 232
233 // WeakPtrFactory to use callbacks.
234 base::WeakPtrFactory<ArcBridgeService> weak_factory_;
235
205 DISALLOW_COPY_AND_ASSIGN(ArcBridgeService); 236 DISALLOW_COPY_AND_ASSIGN(ArcBridgeService);
206 }; 237 };
207 238
208 } // namespace arc 239 } // namespace arc
209 240
210 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ 241 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | components/arc/arc_bridge_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698