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

Side by Side Diff: chromecast/browser/cast_browser_main_parts.cc

Issue 1824723003: [chromecast] Pass media task runner to VideoPlaneController. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: fixed android build Created 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chromecast/browser/cast_browser_main_parts.h" 5 #include "chromecast/browser/cast_browser_main_parts.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 parameters_(parameters), 244 parameters_(parameters),
245 url_request_context_factory_(url_request_context_factory), 245 url_request_context_factory_(url_request_context_factory),
246 net_log_(new CastNetLog()) { 246 net_log_(new CastNetLog()) {
247 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 247 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
248 AddDefaultCommandLineSwitches(command_line); 248 AddDefaultCommandLineSwitches(command_line);
249 } 249 }
250 250
251 CastBrowserMainParts::~CastBrowserMainParts() { 251 CastBrowserMainParts::~CastBrowserMainParts() {
252 } 252 }
253 253
254 scoped_refptr<base::SingleThreadTaskRunner>
255 CastBrowserMainParts::GetMediaTaskRunner() const {
256 // TODO(alokp): Obtain task runner from a local thread or mojo media app.
257 return media::MediaMessageLoop::GetTaskRunner();
258 }
259
254 void CastBrowserMainParts::PreMainMessageLoopStart() { 260 void CastBrowserMainParts::PreMainMessageLoopStart() {
255 // GroupedHistograms needs to be initialized before any threads are created 261 // GroupedHistograms needs to be initialized before any threads are created
256 // to prevent race conditions between calls to Preregister and those threads 262 // to prevent race conditions between calls to Preregister and those threads
257 // attempting to collect metrics. 263 // attempting to collect metrics.
258 // This call must also be before NetworkChangeNotifier, as it generates 264 // This call must also be before NetworkChangeNotifier, as it generates
259 // Net/DNS metrics. 265 // Net/DNS metrics.
260 metrics::PreregisterAllGroupedHistograms(); 266 metrics::PreregisterAllGroupedHistograms();
261 267
262 #if defined(OS_ANDROID) 268 #if defined(OS_ANDROID)
263 net::NetworkChangeNotifier::SetFactory( 269 net::NetworkChangeNotifier::SetFactory(
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 new RemoteDebuggingServer(cast_browser_process_->browser_client()-> 382 new RemoteDebuggingServer(cast_browser_process_->browser_client()->
377 EnableRemoteDebuggingImmediately()))); 383 EnableRemoteDebuggingImmediately())));
378 384
379 media::CastMediaShlib::Initialize(cmd_line->argv()); 385 media::CastMediaShlib::Initialize(cmd_line->argv());
380 ::media::InitializeMediaLibrary(); 386 ::media::InitializeMediaLibrary();
381 387
382 #if defined(USE_AURA) && !defined(DISABLE_DISPLAY) 388 #if defined(USE_AURA) && !defined(DISABLE_DISPLAY)
383 // TODO(halliwell) move audio builds to use ozone_platform_cast, then can 389 // TODO(halliwell) move audio builds to use ozone_platform_cast, then can
384 // simplify this by removing DISABLE_DISPLAY condition. Should then also 390 // simplify this by removing DISABLE_DISPLAY condition. Should then also
385 // assert(ozone_platform_cast) in BUILD.gn where it depends on //ui/ozone. 391 // assert(ozone_platform_cast) in BUILD.gn where it depends on //ui/ozone.
392 video_plane_controller_.reset(
393 new media::VideoPlaneController(GetMediaTaskRunner()));
394 cast_browser_process_->cast_screen()->SetDisplayResizeCallback(
395 base::Bind(&media::VideoPlaneController::SetGraphicsPlaneResolution,
396 base::Unretained(video_plane_controller_.get())));
386 ui::OverlayManagerCast::SetOverlayCompositedCallback( 397 ui::OverlayManagerCast::SetOverlayCompositedCallback(
387 base::Bind(&media::VideoPlaneController::SetGeometry, 398 base::Bind(&media::VideoPlaneController::SetGeometry,
388 base::Unretained(media::VideoPlaneController::GetInstance()))); 399 base::Unretained(video_plane_controller_.get())));
389 #endif 400 #endif
390 401
391 cast_browser_process_->SetCastService( 402 cast_browser_process_->SetCastService(
392 cast_browser_process_->browser_client()->CreateCastService( 403 cast_browser_process_->browser_client()->CreateCastService(
393 cast_browser_process_->browser_context(), 404 cast_browser_process_->browser_context(),
394 cast_browser_process_->pref_service(), 405 cast_browser_process_->pref_service(),
395 url_request_context_factory_->GetSystemGetter())); 406 url_request_context_factory_->GetSystemGetter(),
407 video_plane_controller_.get()));
396 cast_browser_process_->cast_service()->Initialize(); 408 cast_browser_process_->cast_service()->Initialize();
397 409
398 // Initializing metrics service and network delegates must happen after cast 410 // Initializing metrics service and network delegates must happen after cast
399 // service is intialized because CastMetricsServiceClient and 411 // service is intialized because CastMetricsServiceClient and
400 // CastNetworkDelegate may use components initialized by cast service. 412 // CastNetworkDelegate may use components initialized by cast service.
401 cast_browser_process_->metrics_service_client() 413 cast_browser_process_->metrics_service_client()
402 ->Initialize(cast_browser_process_->cast_service()); 414 ->Initialize(cast_browser_process_->cast_service());
403 url_request_context_factory_->InitializeNetworkDelegates(); 415 url_request_context_factory_->InitializeNetworkDelegates();
404 416
405 cast_browser_process_->cast_service()->Start(); 417 cast_browser_process_->cast_service()->Start();
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 cast_browser_process_.reset(); 457 cast_browser_process_.reset();
446 458
447 #if defined(USE_AURA) 459 #if defined(USE_AURA)
448 aura::Env::DeleteInstance(); 460 aura::Env::DeleteInstance();
449 #endif 461 #endif
450 462
451 DeregisterKillOnAlarm(); 463 DeregisterKillOnAlarm();
452 #endif 464 #endif
453 } 465 }
454 466
467 void CastBrowserMainParts::PostDestroyThreads() {
468 // Finalize CastMediaShlib on media thread to ensure it's not accessed
469 // after Finalize.
470 GetMediaTaskRunner()->PostTask(FROM_HERE,
471 base::Bind(&media::CastMediaShlib::Finalize));
472 }
473
455 } // namespace shell 474 } // namespace shell
456 } // namespace chromecast 475 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/browser/cast_browser_main_parts.h ('k') | chromecast/browser/cast_content_browser_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698