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

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

Issue 2416633002: Remove FOR_EACH_OBSERVER from arc/ since it's being deprecated (Closed)
Patch Set: remove braces Created 4 years, 2 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_bootstrap.h" 5 #include "components/arc/arc_bridge_bootstrap.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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 return; 476 return;
477 } 477 }
478 478
479 mojom::ArcBridgeInstancePtr instance; 479 mojom::ArcBridgeInstancePtr instance;
480 instance.Bind(mojo::InterfacePtrInfo<mojom::ArcBridgeInstance>( 480 instance.Bind(mojo::InterfacePtrInfo<mojom::ArcBridgeInstance>(
481 std::move(server_pipe), 0u)); 481 std::move(server_pipe), 0u));
482 arc_bridge_host_.reset(new ArcBridgeHostImpl(std::move(instance))); 482 arc_bridge_host_.reset(new ArcBridgeHostImpl(std::move(instance)));
483 483
484 VLOG(2) << "Mojo is connected. ARC is running."; 484 VLOG(2) << "Mojo is connected. ARC is running.";
485 state_ = State::RUNNING; 485 state_ = State::RUNNING;
486 FOR_EACH_OBSERVER(ArcBridgeBootstrap::Observer, observer_list_, OnReady()); 486 for (auto& observer : observer_list_)
487 observer.OnReady();
487 } 488 }
488 489
489 void ArcBridgeBootstrapImpl::Stop() { 490 void ArcBridgeBootstrapImpl::Stop() {
490 DCHECK(thread_checker_.CalledOnValidThread()); 491 DCHECK(thread_checker_.CalledOnValidThread());
491 VLOG(2) << "Stopping ARC session is requested."; 492 VLOG(2) << "Stopping ARC session is requested.";
492 493
493 // For second time or later, just do nothing. 494 // For second time or later, just do nothing.
494 // It is already in the stopping phase. 495 // It is already in the stopping phase.
495 if (stop_requested_) 496 if (stop_requested_)
496 return; 497 return;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 OnStopped(reason); 575 OnStopped(reason);
575 } 576 }
576 577
577 void ArcBridgeBootstrapImpl::OnStopped(ArcBridgeService::StopReason reason) { 578 void ArcBridgeBootstrapImpl::OnStopped(ArcBridgeService::StopReason reason) {
578 DCHECK(thread_checker_.CalledOnValidThread()); 579 DCHECK(thread_checker_.CalledOnValidThread());
579 // OnStopped() should be called once per instance. 580 // OnStopped() should be called once per instance.
580 DCHECK_NE(state_, State::STOPPED); 581 DCHECK_NE(state_, State::STOPPED);
581 VLOG(2) << "ARC session is stopped."; 582 VLOG(2) << "ARC session is stopped.";
582 arc_bridge_host_.reset(); 583 arc_bridge_host_.reset();
583 state_ = State::STOPPED; 584 state_ = State::STOPPED;
584 FOR_EACH_OBSERVER(ArcBridgeBootstrap::Observer, observer_list_, 585 for (auto& observer : observer_list_)
585 OnStopped(reason)); 586 observer.OnStopped(reason);
586 } 587 }
587 588
588 } // namespace 589 } // namespace
589 590
590 ArcBridgeBootstrap::ArcBridgeBootstrap() = default; 591 ArcBridgeBootstrap::ArcBridgeBootstrap() = default;
591 ArcBridgeBootstrap::~ArcBridgeBootstrap() = default; 592 ArcBridgeBootstrap::~ArcBridgeBootstrap() = default;
592 593
593 void ArcBridgeBootstrap::AddObserver(Observer* observer) { 594 void ArcBridgeBootstrap::AddObserver(Observer* observer) {
594 observer_list_.AddObserver(observer); 595 observer_list_.AddObserver(observer);
595 } 596 }
596 597
597 void ArcBridgeBootstrap::RemoveObserver(Observer* observer) { 598 void ArcBridgeBootstrap::RemoveObserver(Observer* observer) {
598 observer_list_.RemoveObserver(observer); 599 observer_list_.RemoveObserver(observer);
599 } 600 }
600 601
601 // static 602 // static
602 std::unique_ptr<ArcBridgeBootstrap> ArcBridgeBootstrap::Create() { 603 std::unique_ptr<ArcBridgeBootstrap> ArcBridgeBootstrap::Create() {
603 return base::MakeUnique<ArcBridgeBootstrapImpl>(); 604 return base::MakeUnique<ArcBridgeBootstrapImpl>();
604 } 605 }
605 606
606 } // namespace arc 607 } // namespace arc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698