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

Side by Side Diff: components/arc/arc_bridge_service_impl.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_service.cc ('k') | components/arc/arc_bridge_service_impl.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_IMPL_H_ 5 #ifndef COMPONENTS_ARC_ARC_BRIDGE_SERVICE_IMPL_H_
6 #define COMPONENTS_ARC_ARC_BRIDGE_SERVICE_IMPL_H_ 6 #define COMPONENTS_ARC_ARC_BRIDGE_SERVICE_IMPL_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 19 matching lines...) Expand all
30 ~ArcBridgeServiceImpl() override; 30 ~ArcBridgeServiceImpl() override;
31 31
32 void DetectAvailability() override; 32 void DetectAvailability() override;
33 33
34 void HandleStartup() override; 34 void HandleStartup() override;
35 35
36 void Shutdown() override; 36 void Shutdown() override;
37 37
38 private: 38 private:
39 friend class ArcBridgeTest; 39 friend class ArcBridgeTest;
40 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Basic); 40 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Restart);
41 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Prerequisites);
42 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, ShutdownMidStartup);
43 41
44 // If all pre-requisites are true (ARC is available, it has been enabled, and 42 // If all pre-requisites are true (ARC is available, it has been enabled, and
45 // the session has started), and ARC is stopped, start ARC. If ARC is running 43 // the session has started), and ARC is stopped, start ARC. If ARC is running
46 // and the pre-requisites stop being true, stop ARC. 44 // and the pre-requisites stop being true, stop ARC.
47 void PrerequisitesChanged(); 45 void PrerequisitesChanged();
48 46
49 // Stops the running instance. 47 // Stops the running instance.
50 void StopInstance(); 48 void StopInstance();
51 49
52 // ArcBridgeBootstrap::Delegate: 50 // ArcBridgeBootstrap::Delegate:
53 void OnConnectionEstablished(ArcBridgeInstancePtr instance) override; 51 void OnConnectionEstablished(ArcBridgeInstancePtr instance) override;
54 void OnStopped() override; 52 void OnStopped() override;
55 53
56 // DBus callbacks. 54 // DBus callbacks.
57 void OnArcAvailable(bool available); 55 void OnArcAvailable(bool available);
58 56
57 // Called when the bridge channel is closed. This typically only happens when
58 // the ARC instance crashes. This is not called during shutdown.
59 void OnChannelClosed();
60
59 scoped_ptr<ArcBridgeBootstrap> bootstrap_; 61 scoped_ptr<ArcBridgeBootstrap> bootstrap_;
60 62
61 // Mojo endpoints. 63 // Mojo endpoints.
62 mojo::Binding<ArcBridgeHost> binding_; 64 mojo::Binding<ArcBridgeHost> binding_;
63 ArcBridgeInstancePtr instance_ptr_; 65 ArcBridgeInstancePtr instance_ptr_;
64 66
65 // If the user's session has started. 67 // If the user's session has started.
66 bool session_started_; 68 bool session_started_;
67 69
70 // If the instance had already been started but the connection to it was
71 // lost. This should make the instance restart.
72 bool reconnect_ = false;
73
68 // WeakPtrFactory to use callbacks. 74 // WeakPtrFactory to use callbacks.
69 base::WeakPtrFactory<ArcBridgeServiceImpl> weak_factory_; 75 base::WeakPtrFactory<ArcBridgeServiceImpl> weak_factory_;
70 76
71 DISALLOW_COPY_AND_ASSIGN(ArcBridgeServiceImpl); 77 DISALLOW_COPY_AND_ASSIGN(ArcBridgeServiceImpl);
72 }; 78 };
73 79
74 } // namespace arc 80 } // namespace arc
75 81
76 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_IMPL_H_ 82 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_IMPL_H_
OLDNEW
« no previous file with comments | « components/arc/arc_bridge_service.cc ('k') | components/arc/arc_bridge_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698