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

Unified Diff: components/arc/arc_session_runner.cc

Issue 2720303002: Do nothing on OnSessionStopped if ARC is being restarted. (Closed)
Patch Set: 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..6cefdcaa79cbc9a717e1cca7f0e2c880694c5518 100644
--- a/components/arc/arc_session_runner.cc
+++ b/components/arc/arc_session_runner.cc
@@ -156,11 +156,15 @@ void ArcSessionRunner::OnSessionReady() {
observer.OnSessionReady();
}
-void ArcSessionRunner::OnSessionStopped(StopReason stop_reason) {
+void ArcSessionRunner::OnSessionStopped(StopReason stop_reason,
+ bool restarting) {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK_NE(state_, State::STOPPED);
DCHECK(arc_session_);
DCHECK(!restart_timer_.IsRunning());
+ // Because ArcSession won't restart automatically by itself, |restarting|
Yusuke Sato 2017/02/28 21:07:17 Then you can remove L165-167 :)
hidehiko 2017/03/01 09:10:05 Done.
+ // should be always false.
+ DCHECK(!restarting);
VLOG(0) << "ARC stopped: " << stop_reason;
arc_session_->RemoveObserver(this);
@@ -188,13 +192,12 @@ void ArcSessionRunner::OnSessionStopped(StopReason stop_reason) {
restart_timer_.Start(FROM_HERE, restart_delay_,
base::Bind(&ArcSessionRunner::StartArcSession,
weak_ptr_factory_.GetWeakPtr()));
+ restarting = true; // Overwrite the passing argument to true.
hidehiko 2017/02/28 16:33:48 Note: another approach will be; not calling OnSess
}
- // 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