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

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

Issue 2416633002: Remove FOR_EACH_OBSERVER from arc/ since it's being deprecated (Closed)
Patch Set: remove braces Created 4 years, 2 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_bootstrap.h" 5 #include "components/arc/test/fake_arc_bridge_bootstrap.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 11
12 namespace arc { 12 namespace arc {
13 13
14 FakeArcBridgeBootstrap::FakeArcBridgeBootstrap() = default; 14 FakeArcBridgeBootstrap::FakeArcBridgeBootstrap() = default;
15 15
16 FakeArcBridgeBootstrap::~FakeArcBridgeBootstrap() = default; 16 FakeArcBridgeBootstrap::~FakeArcBridgeBootstrap() = default;
17 17
18 void FakeArcBridgeBootstrap::Start() { 18 void FakeArcBridgeBootstrap::Start() {
19 if (boot_failure_emulation_enabled_) { 19 if (boot_failure_emulation_enabled_) {
20 FOR_EACH_OBSERVER(Observer, observer_list_, 20 for (auto& observer : observer_list_)
21 OnStopped(boot_failure_reason_)); 21 observer.OnStopped(boot_failure_reason_);
22 } else if (!boot_suspended_) { 22 } else if (!boot_suspended_) {
23 FOR_EACH_OBSERVER(Observer, observer_list_, OnReady()); 23 for (auto& observer : observer_list_)
24 observer.OnReady();
24 } 25 }
25 } 26 }
26 27
27 void FakeArcBridgeBootstrap::Stop() { 28 void FakeArcBridgeBootstrap::Stop() {
28 StopWithReason(ArcBridgeService::StopReason::SHUTDOWN); 29 StopWithReason(ArcBridgeService::StopReason::SHUTDOWN);
29 } 30 }
30 31
31 void FakeArcBridgeBootstrap::StopWithReason( 32 void FakeArcBridgeBootstrap::StopWithReason(
32 ArcBridgeService::StopReason reason) { 33 ArcBridgeService::StopReason reason) {
33 FOR_EACH_OBSERVER(Observer, observer_list_, OnStopped(reason)); 34 for (auto& observer : observer_list_)
35 observer.OnStopped(reason);
34 } 36 }
35 37
36 void FakeArcBridgeBootstrap::EnableBootFailureEmulation( 38 void FakeArcBridgeBootstrap::EnableBootFailureEmulation(
37 ArcBridgeService::StopReason reason) { 39 ArcBridgeService::StopReason reason) {
38 DCHECK(!boot_failure_emulation_enabled_); 40 DCHECK(!boot_failure_emulation_enabled_);
39 DCHECK(!boot_suspended_); 41 DCHECK(!boot_suspended_);
40 42
41 boot_failure_emulation_enabled_ = true; 43 boot_failure_emulation_enabled_ = true;
42 boot_failure_reason_ = reason; 44 boot_failure_reason_ = reason;
43 } 45 }
44 46
45 void FakeArcBridgeBootstrap::SuspendBoot() { 47 void FakeArcBridgeBootstrap::SuspendBoot() {
46 DCHECK(!boot_failure_emulation_enabled_); 48 DCHECK(!boot_failure_emulation_enabled_);
47 DCHECK(!boot_suspended_); 49 DCHECK(!boot_suspended_);
48 50
49 boot_suspended_ = true; 51 boot_suspended_ = true;
50 } 52 }
51 53
52 // static 54 // static
53 std::unique_ptr<ArcBridgeBootstrap> FakeArcBridgeBootstrap::Create() { 55 std::unique_ptr<ArcBridgeBootstrap> FakeArcBridgeBootstrap::Create() {
54 return base::MakeUnique<FakeArcBridgeBootstrap>(); 56 return base::MakeUnique<FakeArcBridgeBootstrap>();
55 } 57 }
56 58
57 } // namespace arc 59 } // namespace arc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698