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

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

Issue 2720303002: Do nothing on OnSessionStopped if ARC is being restarted. (Closed)
Patch Set: Created 3 years, 9 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_session.h" 5 #include "components/arc/arc_session.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <grp.h> 8 #include <grp.h>
9 #include <poll.h> 9 #include <poll.h>
10 #include <unistd.h> 10 #include <unistd.h>
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 OnStopped(reason); 593 OnStopped(reason);
594 } 594 }
595 595
596 void ArcSessionImpl::OnStopped(ArcSessionObserver::StopReason reason) { 596 void ArcSessionImpl::OnStopped(ArcSessionObserver::StopReason reason) {
597 DCHECK(thread_checker_.CalledOnValidThread()); 597 DCHECK(thread_checker_.CalledOnValidThread());
598 // OnStopped() should be called once per instance. 598 // OnStopped() should be called once per instance.
599 DCHECK_NE(state_, State::STOPPED); 599 DCHECK_NE(state_, State::STOPPED);
600 VLOG(2) << "ARC session is stopped."; 600 VLOG(2) << "ARC session is stopped.";
601 arc_bridge_host_.reset(); 601 arc_bridge_host_.reset();
602 state_ = State::STOPPED; 602 state_ = State::STOPPED;
603 for (auto& observer : observer_list_) 603 for (auto& observer : observer_list_) {
604 observer.OnSessionStopped(reason); 604 // ArcSessionImpl won't restart by itself.
605 observer.OnSessionStopped(reason, false /* restarting */);
hidehiko 2017/02/28 16:33:48 Note: Alternative approach would be splitting ArcS
Yusuke Sato 2017/02/28 21:07:17 I'd actually prefer to split the interface. * ASM
Yusuke Sato 2017/02/28 23:13:53 Sorry there was a typo. I mean, I'd like AS and AS
hidehiko 2017/03/01 09:10:05 So, done. Split the observer into two: ArcSession:
606 }
605 } 607 }
606 608
607 void ArcSessionImpl::OnShutdown() { 609 void ArcSessionImpl::OnShutdown() {
608 DCHECK(thread_checker_.CalledOnValidThread()); 610 DCHECK(thread_checker_.CalledOnValidThread());
609 stop_requested_ = true; 611 stop_requested_ = true;
610 if (state_ == State::STOPPED) 612 if (state_ == State::STOPPED)
611 return; 613 return;
612 614
613 // Here, the message loop is already stopped, and the Chrome will be soon 615 // Here, the message loop is already stopped, and the Chrome will be soon
614 // shutdown. Thus, it is not necessary to take care about restarting case. 616 // shutdown. Thus, it is not necessary to take care about restarting case.
(...skipping 29 matching lines...) Expand all
644 646
645 // static 647 // static
646 std::unique_ptr<ArcSession> ArcSession::Create( 648 std::unique_ptr<ArcSession> ArcSession::Create(
647 ArcBridgeService* arc_bridge_service, 649 ArcBridgeService* arc_bridge_service,
648 const scoped_refptr<base::TaskRunner>& blocking_task_runner) { 650 const scoped_refptr<base::TaskRunner>& blocking_task_runner) {
649 return base::MakeUnique<ArcSessionImpl>(arc_bridge_service, 651 return base::MakeUnique<ArcSessionImpl>(arc_bridge_service,
650 blocking_task_runner); 652 blocking_task_runner);
651 } 653 }
652 654
653 } // namespace arc 655 } // namespace arc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698