| OLD | NEW |
| 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 21 matching lines...) Expand all Loading... |
| 32 #include "chromecast/browser/cast_memory_pressure_monitor.h" | 32 #include "chromecast/browser/cast_memory_pressure_monitor.h" |
| 33 #include "chromecast/browser/cast_net_log.h" | 33 #include "chromecast/browser/cast_net_log.h" |
| 34 #include "chromecast/browser/devtools/remote_debugging_server.h" | 34 #include "chromecast/browser/devtools/remote_debugging_server.h" |
| 35 #include "chromecast/browser/geolocation/cast_access_token_store.h" | 35 #include "chromecast/browser/geolocation/cast_access_token_store.h" |
| 36 #include "chromecast/browser/media/media_caps_impl.h" | 36 #include "chromecast/browser/media/media_caps_impl.h" |
| 37 #include "chromecast/browser/metrics/cast_metrics_prefs.h" | 37 #include "chromecast/browser/metrics/cast_metrics_prefs.h" |
| 38 #include "chromecast/browser/metrics/cast_metrics_service_client.h" | 38 #include "chromecast/browser/metrics/cast_metrics_service_client.h" |
| 39 #include "chromecast/browser/pref_service_helper.h" | 39 #include "chromecast/browser/pref_service_helper.h" |
| 40 #include "chromecast/browser/url_request_context_factory.h" | 40 #include "chromecast/browser/url_request_context_factory.h" |
| 41 #include "chromecast/chromecast_features.h" | 41 #include "chromecast/chromecast_features.h" |
| 42 #include "chromecast/common/global_descriptors.h" | |
| 43 #include "chromecast/common/platform_client_auth.h" | 42 #include "chromecast/common/platform_client_auth.h" |
| 44 #include "chromecast/media/base/key_systems_common.h" | 43 #include "chromecast/media/base/key_systems_common.h" |
| 45 #include "chromecast/media/base/media_resource_tracker.h" | 44 #include "chromecast/media/base/media_resource_tracker.h" |
| 46 #include "chromecast/media/base/video_plane_controller.h" | 45 #include "chromecast/media/base/video_plane_controller.h" |
| 47 #include "chromecast/media/cma/backend/media_pipeline_backend_manager.h" | 46 #include "chromecast/media/cma/backend/media_pipeline_backend_manager.h" |
| 48 #include "chromecast/net/connectivity_checker.h" | 47 #include "chromecast/net/connectivity_checker.h" |
| 49 #include "chromecast/public/cast_media_shlib.h" | 48 #include "chromecast/public/cast_media_shlib.h" |
| 50 #include "chromecast/public/cast_sys_info.h" | 49 #include "chromecast/public/cast_sys_info.h" |
| 51 #include "chromecast/service/cast_service.h" | 50 #include "chromecast/service/cast_service.h" |
| 52 #include "components/prefs/pref_registry_simple.h" | 51 #include "components/prefs/pref_registry_simple.h" |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 // before destroying media_pipeline_backend_manager_. This is guaranteed | 289 // before destroying media_pipeline_backend_manager_. This is guaranteed |
| 291 // once the AudioManager is destroyed; the AudioManager destruction is | 290 // once the AudioManager is destroyed; the AudioManager destruction is |
| 292 // posted to the media thread in the BrowserMainLoop destructor, just before | 291 // posted to the media thread in the BrowserMainLoop destructor, just before |
| 293 // the BrowserMainParts are destroyed (ie, here). Therefore, if we delete | 292 // the BrowserMainParts are destroyed (ie, here). Therefore, if we delete |
| 294 // the media_pipeline_backend_manager_ using DeleteSoon on the media thread, | 293 // the media_pipeline_backend_manager_ using DeleteSoon on the media thread, |
| 295 // it is guaranteed that the AudioManager and all AudioOutputStreams have | 294 // it is guaranteed that the AudioManager and all AudioOutputStreams have |
| 296 // been destroyed before media_pipeline_backend_manager_ is destroyed. | 295 // been destroyed before media_pipeline_backend_manager_ is destroyed. |
| 297 media_thread_->task_runner()->DeleteSoon( | 296 media_thread_->task_runner()->DeleteSoon( |
| 298 FROM_HERE, media_pipeline_backend_manager_.release()); | 297 FROM_HERE, media_pipeline_backend_manager_.release()); |
| 299 } | 298 } |
| 300 #else | |
| 301 breakpad::CrashDumpObserver::GetInstance()->UnregisterClient( | |
| 302 crash_dump_manager_.get()); | |
| 303 #endif // !defined(OS_ANDROID) | 299 #endif // !defined(OS_ANDROID) |
| 304 } | 300 } |
| 305 | 301 |
| 306 scoped_refptr<base::SingleThreadTaskRunner> | 302 scoped_refptr<base::SingleThreadTaskRunner> |
| 307 CastBrowserMainParts::GetMediaTaskRunner() { | 303 CastBrowserMainParts::GetMediaTaskRunner() { |
| 308 #if defined(OS_ANDROID) | 304 #if defined(OS_ANDROID) |
| 309 return nullptr; | 305 return nullptr; |
| 310 #else | 306 #else |
| 311 if (!media_thread_) { | 307 if (!media_thread_) { |
| 312 media_thread_.reset(new base::Thread("CastMediaThread")); | 308 media_thread_.reset(new base::Thread("CastMediaThread")); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 } | 382 } |
| 387 | 383 |
| 388 int CastBrowserMainParts::PreCreateThreads() { | 384 int CastBrowserMainParts::PreCreateThreads() { |
| 389 #if defined(OS_ANDROID) | 385 #if defined(OS_ANDROID) |
| 390 // GPU process is started immediately after threads are created, requiring | 386 // GPU process is started immediately after threads are created, requiring |
| 391 // CrashDumpManager to be initialized beforehand. | 387 // CrashDumpManager to be initialized beforehand. |
| 392 base::FilePath crash_dumps_dir; | 388 base::FilePath crash_dumps_dir; |
| 393 if (!chromecast::CrashHandler::GetCrashDumpLocation(&crash_dumps_dir)) { | 389 if (!chromecast::CrashHandler::GetCrashDumpLocation(&crash_dumps_dir)) { |
| 394 LOG(ERROR) << "Could not find crash dump location."; | 390 LOG(ERROR) << "Could not find crash dump location."; |
| 395 } | 391 } |
| 396 crash_dump_manager_ = base::MakeUnique<breakpad::CrashDumpManager>( | 392 cast_browser_process_->SetCrashDumpManager( |
| 397 crash_dumps_dir, kAndroidMinidumpDescriptor); | 393 base::MakeUnique<breakpad::CrashDumpManager>(crash_dumps_dir)); |
| 398 breakpad::CrashDumpObserver::GetInstance()->RegisterClient( | |
| 399 crash_dump_manager_.get()); | |
| 400 #else | 394 #else |
| 401 base::FilePath home_dir; | 395 base::FilePath home_dir; |
| 402 CHECK(PathService::Get(DIR_CAST_HOME, &home_dir)); | 396 CHECK(PathService::Get(DIR_CAST_HOME, &home_dir)); |
| 403 if (!base::CreateDirectory(home_dir)) | 397 if (!base::CreateDirectory(home_dir)) |
| 404 return 1; | 398 return 1; |
| 405 | 399 |
| 406 // Hook for internal code | 400 // Hook for internal code |
| 407 cast_browser_process_->browser_client()->PreCreateThreads(); | 401 cast_browser_process_->browser_client()->PreCreateThreads(); |
| 408 | 402 |
| 409 // Set GL strings so GPU config code can make correct feature blacklisting/ | 403 // Set GL strings so GPU config code can make correct feature blacklisting/ |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 | 540 |
| 547 void CastBrowserMainParts::PostDestroyThreads() { | 541 void CastBrowserMainParts::PostDestroyThreads() { |
| 548 #if !defined(OS_ANDROID) | 542 #if !defined(OS_ANDROID) |
| 549 media_resource_tracker_->FinalizeAndDestroy(); | 543 media_resource_tracker_->FinalizeAndDestroy(); |
| 550 media_resource_tracker_ = nullptr; | 544 media_resource_tracker_ = nullptr; |
| 551 #endif | 545 #endif |
| 552 } | 546 } |
| 553 | 547 |
| 554 } // namespace shell | 548 } // namespace shell |
| 555 } // namespace chromecast | 549 } // namespace chromecast |
| OLD | NEW |