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

Unified Diff: components/arc/video/arc_video_bridge.cc

Issue 1596663002: arc-bridge: Introduce the ArcService class (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@master
Patch Set: Rebased + protected ArcService direct instantiation Created 4 years, 11 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
« no previous file with comments | « components/arc/video/arc_video_bridge.h ('k') | ui/arc/notification/arc_notification_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/arc/video/arc_video_bridge.cc
diff --git a/components/arc/video/arc_video_bridge.cc b/components/arc/video/arc_video_bridge.cc
index dddbb398c9195c0ee2a4008df4d7e2d95c6a415c..a57f775882aae5a2d808e02e654ae792cd5bbc11 100644
--- a/components/arc/video/arc_video_bridge.cc
+++ b/components/arc/video/arc_video_bridge.cc
@@ -9,25 +9,16 @@
namespace arc {
ArcVideoBridge::ArcVideoBridge(
+ ArcBridgeService* bridge_service,
scoped_ptr<VideoHostDelegate> video_host_delegate)
- : video_host_delegate_(std::move(video_host_delegate)),
- binding_(video_host_delegate_.get()) {}
-
-ArcVideoBridge::~ArcVideoBridge() {
- arc::ArcBridgeService* bridge_service = arc::ArcBridgeService::Get();
- DCHECK(bridge_service);
- bridge_service->RemoveObserver(this);
+ : ArcService(bridge_service),
+ video_host_delegate_(std::move(video_host_delegate)),
+ binding_(video_host_delegate_.get()) {
+ arc_bridge_service()->AddObserver(this);
}
-void ArcVideoBridge::StartObservingBridgeServiceChanges() {
- arc::ArcBridgeService* bridge_service = arc::ArcBridgeService::Get();
- DCHECK(bridge_service);
- bridge_service->AddObserver(this);
-
- // If VideoInstance was ready before we AddObserver(), we won't get
- // OnVideoInstanceReady events. For such case, we have to call it explicitly.
- if (bridge_service->video_instance())
- OnVideoInstanceReady();
+ArcVideoBridge::~ArcVideoBridge() {
+ arc_bridge_service()->RemoveObserver(this);
}
void ArcVideoBridge::OnStateChanged(arc::ArcBridgeService::State state) {
@@ -41,12 +32,9 @@ void ArcVideoBridge::OnStateChanged(arc::ArcBridgeService::State state) {
}
void ArcVideoBridge::OnVideoInstanceReady() {
- arc::ArcBridgeService* bridge_service = arc::ArcBridgeService::Get();
- DCHECK(bridge_service);
-
arc::VideoHostPtr host;
binding_.Bind(mojo::GetProxy(&host));
- bridge_service->video_instance()->Init(std::move(host));
+ arc_bridge_service()->video_instance()->Init(std::move(host));
}
} // namespace arc
« no previous file with comments | « components/arc/video/arc_video_bridge.h ('k') | ui/arc/notification/arc_notification_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698