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

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

Issue 1548833002: arc-bridge: Restart ARC instance on crash (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@master
Patch Set: Addressed more feedback 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 | « components/arc/arc_bridge_bootstrap.cc ('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 <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 // Notifies life cycle events of ArcBridgeService. 67 // Notifies life cycle events of ArcBridgeService.
68 class Observer { 68 class Observer {
69 public: 69 public:
70 // Called whenever the state of the bridge has changed. 70 // Called whenever the state of the bridge has changed.
71 virtual void OnStateChanged(State state) {} 71 virtual void OnStateChanged(State state) {}
72 72
73 // Called whenever ARC's availability has changed for this system. 73 // Called whenever ARC's availability has changed for this system.
74 virtual void OnAvailableChanged(bool available) {} 74 virtual void OnAvailableChanged(bool available) {}
75 75
76 // Called whenever the ARC app list is ready. 76 // Called whenever the ARC app interface state changes.
77 virtual void OnAppInstanceReady() {} 77 virtual void OnAppInstanceReady() {}
78 virtual void OnAppInstanceClosed() {}
78 79
79 // Called whenever the ARC input is ready. 80 // Called whenever the ARC input interface state changes.
80 virtual void OnInputInstanceReady() {} 81 virtual void OnInputInstanceReady() {}
82 virtual void OnInputInstanceClosed() {}
81 83
82 // Called whenever the ARC notification is ready. 84 // Called whenever the ARC notification interface state changes.
83 virtual void OnNotificationsInstanceReady() {} 85 virtual void OnNotificationsInstanceReady() {}
86 virtual void OnNotificationsInstanceClosed() {}
84 87
85 // Called whenever the ARC power is ready. 88 // Called whenever the ARC power interface state changes.
86 virtual void OnPowerInstanceReady() {} 89 virtual void OnPowerInstanceReady() {}
90 virtual void OnPowerInstanceClosed() {}
87 91
88 // Called whenever the ARC process is ready. 92 // Called whenever the ARC process interface state changes.
89 virtual void OnProcessInstanceReady() {} 93 virtual void OnProcessInstanceReady() {}
94 virtual void OnProcessInstanceClosed() {}
90 95
91 // Called whenever the ARC settings is ready. 96 // Called whenever the ARC settings interface state changes.
92 virtual void OnSettingsInstanceReady() {} 97 virtual void OnSettingsInstanceReady() {}
98 virtual void OnSettingsInstanceClosed() {}
93 99
94 protected: 100 protected:
95 virtual ~Observer() {} 101 virtual ~Observer() {}
96 }; 102 };
97 103
98 ~ArcBridgeService() override; 104 ~ArcBridgeService() override;
99 105
100 // Gets the global instance of the ARC Bridge Service. This can only be 106 // Gets the global instance of the ARC Bridge Service. This can only be
101 // called on the thread that this class was created on. 107 // called on the thread that this class was created on.
102 static ArcBridgeService* Get(); 108 static ArcBridgeService* Get();
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 // Changes the current state and notifies all observers. 171 // Changes the current state and notifies all observers.
166 void SetState(State state); 172 void SetState(State state);
167 173
168 // Changes the current availability and notifies all observers. 174 // Changes the current availability and notifies all observers.
169 void SetAvailable(bool availability); 175 void SetAvailable(bool availability);
170 176
171 base::ObserverList<Observer>& observer_list() { return observer_list_; } 177 base::ObserverList<Observer>& observer_list() { return observer_list_; }
172 178
173 bool CalledOnValidThread(); 179 bool CalledOnValidThread();
174 180
181 // Closes all Mojo channels.
182 void CloseAllChannels();
183
175 private: 184 private:
176 friend class ArcBridgeTest; 185 friend class ArcBridgeTest;
177 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Basic); 186 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Basic);
178 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Prerequisites); 187 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Prerequisites);
179 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, ShutdownMidStartup); 188 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, ShutdownMidStartup);
189 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Restart);
190
191 // Called when one of the individual channels is closed.
192 void CloseAppChannel();
193 void CloseInputChannel();
194 void CloseNotificationsChannel();
195 void ClosePowerChannel();
196 void CloseProcessChannel();
197 void CloseSettingsChannel();
180 198
181 // Callbacks for QueryVersion. 199 // Callbacks for QueryVersion.
182 void OnAppVersionReady(int32_t version); 200 void OnAppVersionReady(int32_t version);
183 void OnInputVersionReady(int32_t version); 201 void OnInputVersionReady(int32_t version);
184 void OnNotificationsVersionReady(int32_t version); 202 void OnNotificationsVersionReady(int32_t version);
185 void OnPowerVersionReady(int32_t version); 203 void OnPowerVersionReady(int32_t version);
186 void OnProcessVersionReady(int32_t version); 204 void OnProcessVersionReady(int32_t version);
187 void OnSettingsVersionReady(int32_t version); 205 void OnSettingsVersionReady(int32_t version);
188 206
189 // Mojo interfaces. 207 // Mojo interfaces.
(...skipping 29 matching lines...) Expand all
219 237
220 // WeakPtrFactory to use callbacks. 238 // WeakPtrFactory to use callbacks.
221 base::WeakPtrFactory<ArcBridgeService> weak_factory_; 239 base::WeakPtrFactory<ArcBridgeService> weak_factory_;
222 240
223 DISALLOW_COPY_AND_ASSIGN(ArcBridgeService); 241 DISALLOW_COPY_AND_ASSIGN(ArcBridgeService);
224 }; 242 };
225 243
226 } // namespace arc 244 } // namespace arc
227 245
228 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_ 246 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_H_
OLDNEW
« no previous file with comments | « components/arc/arc_bridge_bootstrap.cc ('k') | components/arc/arc_bridge_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698