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

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

Issue 2436763004: More graceful shutdown for ArcSession. (Closed)
Patch Set: Add StopArcInstance 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
« no previous file with comments | « components/arc/test/fake_arc_session.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_session.h" 5 #include "components/arc/test/fake_arc_session.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"
(...skipping 11 matching lines...) Expand all
22 } else if (!boot_suspended_) { 22 } else if (!boot_suspended_) {
23 for (auto& observer : observer_list_) 23 for (auto& observer : observer_list_)
24 observer.OnReady(); 24 observer.OnReady();
25 } 25 }
26 } 26 }
27 27
28 void FakeArcSession::Stop() { 28 void FakeArcSession::Stop() {
29 StopWithReason(ArcBridgeService::StopReason::SHUTDOWN); 29 StopWithReason(ArcBridgeService::StopReason::SHUTDOWN);
30 } 30 }
31 31
32 void FakeArcSession::OnShutdown() {
33 StopWithReason(ArcBridgeService::StopReason::SHUTDOWN);
34 }
35
32 void FakeArcSession::StopWithReason(ArcBridgeService::StopReason reason) { 36 void FakeArcSession::StopWithReason(ArcBridgeService::StopReason reason) {
33 for (auto& observer : observer_list_) 37 for (auto& observer : observer_list_)
34 observer.OnStopped(reason); 38 observer.OnStopped(reason);
35 } 39 }
36 40
37 void FakeArcSession::EnableBootFailureEmulation( 41 void FakeArcSession::EnableBootFailureEmulation(
38 ArcBridgeService::StopReason reason) { 42 ArcBridgeService::StopReason reason) {
39 DCHECK(!boot_failure_emulation_enabled_); 43 DCHECK(!boot_failure_emulation_enabled_);
40 DCHECK(!boot_suspended_); 44 DCHECK(!boot_suspended_);
41 45
42 boot_failure_emulation_enabled_ = true; 46 boot_failure_emulation_enabled_ = true;
43 boot_failure_reason_ = reason; 47 boot_failure_reason_ = reason;
44 } 48 }
45 49
46 void FakeArcSession::SuspendBoot() { 50 void FakeArcSession::SuspendBoot() {
47 DCHECK(!boot_failure_emulation_enabled_); 51 DCHECK(!boot_failure_emulation_enabled_);
48 DCHECK(!boot_suspended_); 52 DCHECK(!boot_suspended_);
49 53
50 boot_suspended_ = true; 54 boot_suspended_ = true;
51 } 55 }
52 56
53 // static 57 // static
54 std::unique_ptr<ArcSession> FakeArcSession::Create() { 58 std::unique_ptr<ArcSession> FakeArcSession::Create() {
55 return base::MakeUnique<FakeArcSession>(); 59 return base::MakeUnique<FakeArcSession>();
56 } 60 }
57 61
58 } // namespace arc 62 } // namespace arc
OLDNEW
« no previous file with comments | « components/arc/test/fake_arc_session.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698