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

Side by Side Diff: components/arc/test/fake_arc_bridge_service.cc

Issue 2558313002: Remove explicit singletonness of ArcBridgeService part 5. (Closed)
Patch Set: Created 4 years 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 #include "components/arc/test/fake_arc_bridge_service.h" 5 #include "components/arc/test/fake_arc_bridge_service.h"
6 6
7 namespace arc { 7 namespace arc {
8 8
9 extern ArcBridgeService* g_arc_bridge_service; 9 FakeArcBridgeService::FakeArcBridgeService() = default;
10
11 FakeArcBridgeService::FakeArcBridgeService() {
12 DCHECK(!g_arc_bridge_service);
13 g_arc_bridge_service = this;
14 }
15 10
16 FakeArcBridgeService::~FakeArcBridgeService() { 11 FakeArcBridgeService::~FakeArcBridgeService() {
17 DCHECK(g_arc_bridge_service == this);
18 g_arc_bridge_service = nullptr;
19 SetStopped(); 12 SetStopped();
20 } 13 }
21 14
22 void FakeArcBridgeService::RequestStart() { 15 void FakeArcBridgeService::RequestStart() {
23 SetReady(); 16 SetReady();
24 } 17 }
25 18
26 void FakeArcBridgeService::RequestStop() { 19 void FakeArcBridgeService::RequestStop() {
27 SetStopped(); 20 SetStopped();
28 } 21 }
(...skipping 10 matching lines...) Expand all
39 void FakeArcBridgeService::SetStopped() { 32 void FakeArcBridgeService::SetStopped() {
40 if (state() != State::STOPPED) 33 if (state() != State::STOPPED)
41 SetState(State::STOPPED); 34 SetState(State::STOPPED);
42 } 35 }
43 36
44 bool FakeArcBridgeService::HasObserver(const Observer* observer) { 37 bool FakeArcBridgeService::HasObserver(const Observer* observer) {
45 return observer_list().HasObserver(observer); 38 return observer_list().HasObserver(observer);
46 } 39 }
47 40
48 } // namespace arc 41 } // namespace arc
OLDNEW
« components/arc/arc_bridge_service_impl.cc ('K') | « components/arc/arc_bridge_service_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698