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

Side by Side Diff: components/arc/power/arc_power_bridge.cc

Issue 1596663002: arc-bridge: Introduce the ArcService class (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@master
Patch Set: Addressed 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
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/power/arc_power_bridge.h" 5 #include "components/arc/power/arc_power_bridge.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "chromeos/dbus/power_policy_controller.h" 11 #include "chromeos/dbus/power_policy_controller.h"
12 #include "components/arc/arc_service_manager.h" 12 #include "components/arc/arc_service_manager.h"
13 13
14 namespace arc { 14 namespace arc {
15 15
16 ArcPowerBridge::ArcPowerBridge(ArcBridgeService* arc_bridge_service) 16 ArcPowerBridge::ArcPowerBridge(ArcBridgeService* arc_bridge_service)
17 : arc_bridge_service_(arc_bridge_service), binding_(this) { 17 : arc_bridge_service_(arc_bridge_service), binding_(this) {
18 arc_bridge_service->AddObserver(this); 18 DCHECK(arc_bridge_service_);
19 if (arc_bridge_service->power_instance()) 19 arc_bridge_service_->AddObserver(this);
20 if (arc_bridge_service_->power_instance())
20 OnPowerInstanceReady(); 21 OnPowerInstanceReady();
21 } 22 }
22 23
23 ArcPowerBridge::~ArcPowerBridge() { 24 ArcPowerBridge::~ArcPowerBridge() {
24 arc_bridge_service_->RemoveObserver(this); 25 arc_bridge_service_->RemoveObserver(this);
25 ReleaseAllDisplayWakeLocks(); 26 ReleaseAllDisplayWakeLocks();
26 } 27 }
27 28
28 void ArcPowerBridge::OnStateChanged(ArcBridgeService::State state) { 29 void ArcPowerBridge::OnStateChanged(ArcBridgeService::State state) {
29 if (state == ArcBridgeService::State::STOPPING) 30 if (state == ArcBridgeService::State::STOPPING)
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 chromeos::PowerPolicyController* controller = 100 chromeos::PowerPolicyController* controller =
100 chromeos::PowerPolicyController::Get(); 101 chromeos::PowerPolicyController::Get();
101 102
102 for (const auto& it : wake_locks_) { 103 for (const auto& it : wake_locks_) {
103 controller->RemoveWakeLock(it.second); 104 controller->RemoveWakeLock(it.second);
104 } 105 }
105 wake_locks_.clear(); 106 wake_locks_.clear();
106 } 107 }
107 108
108 } // namespace arc 109 } // namespace arc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698