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

Unified Diff: components/arc/arc_session_runner.cc

Issue 2720303002: Do nothing on OnSessionStopped if ARC is being restarted. (Closed)
Patch Set: Address comments. Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: components/arc/arc_session_runner.cc
diff --git a/components/arc/arc_session_runner.cc b/components/arc/arc_session_runner.cc
index 571a2c5d2996abb49c69484f41a864092c634131..bb43b1213bb67ad7911083cbdca7ea78ead78b0d 100644
--- a/components/arc/arc_session_runner.cc
+++ b/components/arc/arc_session_runner.cc
@@ -7,7 +7,6 @@
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/task_runner.h"
-#include "components/arc/arc_session.h"
namespace arc {
@@ -29,12 +28,12 @@ ArcSessionRunner::~ArcSessionRunner() {
arc_session_->RemoveObserver(this);
}
-void ArcSessionRunner::AddObserver(ArcSessionObserver* observer) {
+void ArcSessionRunner::AddObserver(Observer* observer) {
DCHECK(thread_checker_.CalledOnValidThread());
observer_list_.AddObserver(observer);
}
-void ArcSessionRunner::RemoveObserver(ArcSessionObserver* observer) {
+void ArcSessionRunner::RemoveObserver(Observer* observer) {
DCHECK(thread_checker_.CalledOnValidThread());
observer_list_.RemoveObserver(observer);
}
@@ -151,12 +150,9 @@ void ArcSessionRunner::OnSessionReady() {
VLOG(0) << "ARC ready";
state_ = State::RUNNING;
-
- for (auto& observer : observer_list_)
- observer.OnSessionReady();
}
-void ArcSessionRunner::OnSessionStopped(StopReason stop_reason) {
+void ArcSessionRunner::OnSessionStopped(ArcStopReason stop_reason) {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK_NE(state_, State::STOPPED);
DCHECK(arc_session_);
@@ -173,6 +169,7 @@ void ArcSessionRunner::OnSessionStopped(StopReason stop_reason) {
// Otherwise, do nothing.
// If STARTING, ARC instance has not been booted properly, so do not
// restart it automatically.
+ bool restarting = false;
Luis Héctor Chávez 2017/03/01 18:26:53 maybe make this const bool restarting = (state ==
hidehiko 2017/03/01 18:43:02 Done.
if (state_ == State::RUNNING ||
(state_ == State::STOPPING && run_requested_)) {
// This check is for RUNNING case. In RUNNING case |run_requested_| should
@@ -188,13 +185,12 @@ void ArcSessionRunner::OnSessionStopped(StopReason stop_reason) {
restart_timer_.Start(FROM_HERE, restart_delay_,
base::Bind(&ArcSessionRunner::StartArcSession,
weak_ptr_factory_.GetWeakPtr()));
+ restarting = true;
}
- // TODO(hidehiko): Consider to let observers know whether there is scheduled
- // restarting event, or not.
state_ = State::STOPPED;
for (auto& observer : observer_list_)
- observer.OnSessionStopped(stop_reason);
+ observer.OnSessionStopped(stop_reason, restarting);
}
} // namespace arc

Powered by Google App Engine
This is Rietveld 408576698