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

Side by Side Diff: components/arc/arc_bridge_service.cc

Issue 2106663004: arc: Initial implemetation of Chrome sync for Arc packages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. More refactor. Fix unit_test related to refactor. Created 4 years, 5 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/arc_bridge_service.h" 5 #include "components/arc/arc_bridge_service.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/sequenced_task_runner.h" 10 #include "base/sequenced_task_runner.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 observer_list_.RemoveObserver(observer); 54 observer_list_.RemoveObserver(observer);
55 } 55 }
56 56
57 void ArcBridgeService::SetState(State state) { 57 void ArcBridgeService::SetState(State state) {
58 DCHECK(CalledOnValidThread()); 58 DCHECK(CalledOnValidThread());
59 DCHECK_NE(state_, state); 59 DCHECK_NE(state_, state);
60 state_ = state; 60 state_ = state;
61 VLOG(2) << "State: " << static_cast<uint32_t>(state_); 61 VLOG(2) << "State: " << static_cast<uint32_t>(state_);
62 if (state_ == State::READY) 62 if (state_ == State::READY)
63 FOR_EACH_OBSERVER(Observer, observer_list(), OnBridgeReady()); 63 FOR_EACH_OBSERVER(Observer, observer_list(), OnBridgeReady());
64 else if (state == State::STOPPED) 64 else if (state == State::STOPPED) {
65 FOR_EACH_OBSERVER(Observer, observer_list(), OnBridgeStopped(stop_reason_)); 65 FOR_EACH_OBSERVER(Observer, observer_list(), OnBridgeStopped(stop_reason_));
66 app_.CloseChannel();
Luis Héctor Chávez 2016/07/20 00:01:15 Hmmmm I don't like this. Is there any way you can
67 }
66 } 68 }
67 69
68 void ArcBridgeService::SetAvailable(bool available) { 70 void ArcBridgeService::SetAvailable(bool available) {
69 DCHECK(CalledOnValidThread()); 71 DCHECK(CalledOnValidThread());
70 DCHECK_NE(available_, available); 72 DCHECK_NE(available_, available);
71 available_ = available; 73 available_ = available;
72 FOR_EACH_OBSERVER(Observer, observer_list(), OnAvailableChanged(available_)); 74 FOR_EACH_OBSERVER(Observer, observer_list(), OnAvailableChanged(available_));
73 } 75 }
74 76
75 void ArcBridgeService::SetStopReason(StopReason stop_reason) { 77 void ArcBridgeService::SetStopReason(StopReason stop_reason) {
76 DCHECK(CalledOnValidThread()); 78 DCHECK(CalledOnValidThread());
77 stop_reason_ = stop_reason; 79 stop_reason_ = stop_reason;
78 } 80 }
79 81
80 bool ArcBridgeService::CalledOnValidThread() { 82 bool ArcBridgeService::CalledOnValidThread() {
81 return thread_checker_.CalledOnValidThread(); 83 return thread_checker_.CalledOnValidThread();
82 } 84 }
83 85
84 } // namespace arc 86 } // namespace arc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698