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

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

Issue 1921973002: Convert //components/[a-e]* from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 7 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.h ('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 <memory>
8 #include <string> 9 #include <string>
9 #include <vector> 10 #include <vector>
10 11
11 #include "base/files/scoped_file.h" 12 #include "base/files/scoped_file.h"
12 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "components/arc/arc_bridge_bootstrap.h" 15 #include "components/arc/arc_bridge_bootstrap.h"
15 #include "components/arc/arc_bridge_service.h" 16 #include "components/arc/arc_bridge_service.h"
16 #include "mojo/public/cpp/bindings/binding.h" 17 #include "mojo/public/cpp/bindings/binding.h"
17 18
18 namespace base { 19 namespace base {
19 class SequencedTaskRunner; 20 class SequencedTaskRunner;
20 class SingleThreadTaskRunner; 21 class SingleThreadTaskRunner;
21 } // namespace base 22 } // namespace base
22 23
23 namespace arc { 24 namespace arc {
24 25
25 // Real IPC based ArcBridgeService that is used in production. 26 // Real IPC based ArcBridgeService that is used in production.
26 class ArcBridgeServiceImpl : public ArcBridgeService, 27 class ArcBridgeServiceImpl : public ArcBridgeService,
27 public ArcBridgeBootstrap::Delegate { 28 public ArcBridgeBootstrap::Delegate {
28 public: 29 public:
29 explicit ArcBridgeServiceImpl(scoped_ptr<ArcBridgeBootstrap> bootstrap); 30 explicit ArcBridgeServiceImpl(std::unique_ptr<ArcBridgeBootstrap> bootstrap);
30 ~ArcBridgeServiceImpl() override; 31 ~ArcBridgeServiceImpl() override;
31 32
32 void SetDetectedAvailability(bool available) override; 33 void SetDetectedAvailability(bool available) override;
33 34
34 void HandleStartup() override; 35 void HandleStartup() override;
35 36
36 void Shutdown() override; 37 void Shutdown() override;
37 38
38 private: 39 private:
39 friend class ArcBridgeTest; 40 friend class ArcBridgeTest;
40 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Restart); 41 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Restart);
41 42
42 // If all pre-requisites are true (ARC is available, it has been enabled, and 43 // If all pre-requisites are true (ARC is available, it has been enabled, and
43 // the session has started), and ARC is stopped, start ARC. If ARC is running 44 // the session has started), and ARC is stopped, start ARC. If ARC is running
44 // and the pre-requisites stop being true, stop ARC. 45 // and the pre-requisites stop being true, stop ARC.
45 void PrerequisitesChanged(); 46 void PrerequisitesChanged();
46 47
47 // Stops the running instance. 48 // Stops the running instance.
48 void StopInstance(); 49 void StopInstance();
49 50
50 // ArcBridgeBootstrap::Delegate: 51 // ArcBridgeBootstrap::Delegate:
51 void OnConnectionEstablished(mojom::ArcBridgeInstancePtr instance) override; 52 void OnConnectionEstablished(mojom::ArcBridgeInstancePtr instance) override;
52 void OnStopped() override; 53 void OnStopped() override;
53 54
54 // Called when the bridge channel is closed. This typically only happens when 55 // Called when the bridge channel is closed. This typically only happens when
55 // the ARC instance crashes. This is not called during shutdown. 56 // the ARC instance crashes. This is not called during shutdown.
56 void OnChannelClosed(); 57 void OnChannelClosed();
57 58
58 scoped_ptr<ArcBridgeBootstrap> bootstrap_; 59 std::unique_ptr<ArcBridgeBootstrap> bootstrap_;
59 60
60 // Mojo endpoints. 61 // Mojo endpoints.
61 mojo::Binding<mojom::ArcBridgeHost> binding_; 62 mojo::Binding<mojom::ArcBridgeHost> binding_;
62 mojom::ArcBridgeInstancePtr instance_ptr_; 63 mojom::ArcBridgeInstancePtr instance_ptr_;
63 64
64 // If the user's session has started. 65 // If the user's session has started.
65 bool session_started_; 66 bool session_started_;
66 67
67 // If the instance had already been started but the connection to it was 68 // If the instance had already been started but the connection to it was
68 // lost. This should make the instance restart. 69 // lost. This should make the instance restart.
69 bool reconnect_ = false; 70 bool reconnect_ = false;
70 71
71 // WeakPtrFactory to use callbacks. 72 // WeakPtrFactory to use callbacks.
72 base::WeakPtrFactory<ArcBridgeServiceImpl> weak_factory_; 73 base::WeakPtrFactory<ArcBridgeServiceImpl> weak_factory_;
73 74
74 DISALLOW_COPY_AND_ASSIGN(ArcBridgeServiceImpl); 75 DISALLOW_COPY_AND_ASSIGN(ArcBridgeServiceImpl);
75 }; 76 };
76 77
77 } // namespace arc 78 } // namespace arc
78 79
79 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_IMPL_H_ 80 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_IMPL_H_
OLDNEW
« no previous file with comments | « components/arc/arc_bridge_service.h ('k') | components/arc/arc_bridge_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698