| 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 20 matching lines...) Expand all Loading... |
| 31 #include "chromecast/browser/cast_content_browser_client.h" | 31 #include "chromecast/browser/cast_content_browser_client.h" |
| 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/metrics/cast_metrics_prefs.h" | 36 #include "chromecast/browser/metrics/cast_metrics_prefs.h" |
| 37 #include "chromecast/browser/metrics/cast_metrics_service_client.h" | 37 #include "chromecast/browser/metrics/cast_metrics_service_client.h" |
| 38 #include "chromecast/browser/pref_service_helper.h" | 38 #include "chromecast/browser/pref_service_helper.h" |
| 39 #include "chromecast/browser/url_request_context_factory.h" | 39 #include "chromecast/browser/url_request_context_factory.h" |
| 40 #include "chromecast/chromecast_features.h" | 40 #include "chromecast/chromecast_features.h" |
| 41 #include "chromecast/common/global_descriptors.h" |
| 41 #include "chromecast/common/platform_client_auth.h" | 42 #include "chromecast/common/platform_client_auth.h" |
| 42 #include "chromecast/media/base/key_systems_common.h" | 43 #include "chromecast/media/base/key_systems_common.h" |
| 43 #include "chromecast/media/base/media_resource_tracker.h" | 44 #include "chromecast/media/base/media_resource_tracker.h" |
| 44 #include "chromecast/media/base/video_plane_controller.h" | 45 #include "chromecast/media/base/video_plane_controller.h" |
| 45 #include "chromecast/media/cma/backend/media_pipeline_backend_manager.h" | 46 #include "chromecast/media/cma/backend/media_pipeline_backend_manager.h" |
| 46 #include "chromecast/net/connectivity_checker.h" | 47 #include "chromecast/net/connectivity_checker.h" |
| 47 #include "chromecast/public/cast_media_shlib.h" | 48 #include "chromecast/public/cast_media_shlib.h" |
| 48 #include "chromecast/public/cast_sys_info.h" | 49 #include "chromecast/public/cast_sys_info.h" |
| 49 #include "chromecast/service/cast_service.h" | 50 #include "chromecast/service/cast_service.h" |
| 50 #include "components/prefs/pref_registry_simple.h" | 51 #include "components/prefs/pref_registry_simple.h" |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 // before destroying media_pipeline_backend_manager_. This is guaranteed | 286 // before destroying media_pipeline_backend_manager_. This is guaranteed |
| 286 // once the AudioManager is destroyed; the AudioManager destruction is | 287 // once the AudioManager is destroyed; the AudioManager destruction is |
| 287 // posted to the media thread in the BrowserMainLoop destructor, just before | 288 // posted to the media thread in the BrowserMainLoop destructor, just before |
| 288 // the BrowserMainParts are destroyed (ie, here). Therefore, if we delete | 289 // the BrowserMainParts are destroyed (ie, here). Therefore, if we delete |
| 289 // the media_pipeline_backend_manager_ using DeleteSoon on the media thread, | 290 // the media_pipeline_backend_manager_ using DeleteSoon on the media thread, |
| 290 // it is guaranteed that the AudioManager and all AudioOutputStreams have | 291 // it is guaranteed that the AudioManager and all AudioOutputStreams have |
| 291 // been destroyed before media_pipeline_backend_manager_ is destroyed. | 292 // been destroyed before media_pipeline_backend_manager_ is destroyed. |
| 292 media_thread_->task_runner()->DeleteSoon( | 293 media_thread_->task_runner()->DeleteSoon( |
| 293 FROM_HERE, media_pipeline_backend_manager_.release()); | 294 FROM_HERE, media_pipeline_backend_manager_.release()); |
| 294 } | 295 } |
| 296 #else |
| 297 breakpad::CrashDumpObserver::GetInstance()->UnregisterClient( |
| 298 crash_dump_manager_.get()); |
| 295 #endif // !defined(OS_ANDROID) | 299 #endif // !defined(OS_ANDROID) |
| 296 } | 300 } |
| 297 | 301 |
| 298 scoped_refptr<base::SingleThreadTaskRunner> | 302 scoped_refptr<base::SingleThreadTaskRunner> |
| 299 CastBrowserMainParts::GetMediaTaskRunner() { | 303 CastBrowserMainParts::GetMediaTaskRunner() { |
| 300 #if defined(OS_ANDROID) | 304 #if defined(OS_ANDROID) |
| 301 return nullptr; | 305 return nullptr; |
| 302 #else | 306 #else |
| 303 if (!media_thread_) { | 307 if (!media_thread_) { |
| 304 media_thread_.reset(new base::Thread("CastMediaThread")); | 308 media_thread_.reset(new base::Thread("CastMediaThread")); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 } | 375 } |
| 372 | 376 |
| 373 int CastBrowserMainParts::PreCreateThreads() { | 377 int CastBrowserMainParts::PreCreateThreads() { |
| 374 #if defined(OS_ANDROID) | 378 #if defined(OS_ANDROID) |
| 375 // GPU process is started immediately after threads are created, requiring | 379 // GPU process is started immediately after threads are created, requiring |
| 376 // CrashDumpManager to be initialized beforehand. | 380 // CrashDumpManager to be initialized beforehand. |
| 377 base::FilePath crash_dumps_dir; | 381 base::FilePath crash_dumps_dir; |
| 378 if (!chromecast::CrashHandler::GetCrashDumpLocation(&crash_dumps_dir)) { | 382 if (!chromecast::CrashHandler::GetCrashDumpLocation(&crash_dumps_dir)) { |
| 379 LOG(ERROR) << "Could not find crash dump location."; | 383 LOG(ERROR) << "Could not find crash dump location."; |
| 380 } | 384 } |
| 381 cast_browser_process_->SetCrashDumpManager( | 385 crash_dump_manager_ = base::MakeUnique<breakpad::CrashDumpManager>( |
| 382 base::WrapUnique(new breakpad::CrashDumpManager(crash_dumps_dir))); | 386 crash_dumps_dir, kAndroidMinidumpDescriptor); |
| 387 breakpad::CrashDumpObserver::GetInstance()->RegisterClient( |
| 388 crash_dump_manager_.get()); |
| 383 #else | 389 #else |
| 384 base::FilePath home_dir; | 390 base::FilePath home_dir; |
| 385 CHECK(PathService::Get(DIR_CAST_HOME, &home_dir)); | 391 CHECK(PathService::Get(DIR_CAST_HOME, &home_dir)); |
| 386 if (!base::CreateDirectory(home_dir)) | 392 if (!base::CreateDirectory(home_dir)) |
| 387 return 1; | 393 return 1; |
| 388 | 394 |
| 389 // Hook for internal code | 395 // Hook for internal code |
| 390 cast_browser_process_->browser_client()->PreCreateThreads(); | 396 cast_browser_process_->browser_client()->PreCreateThreads(); |
| 391 | 397 |
| 392 // Set GL strings so GPU config code can make correct feature blacklisting/ | 398 // Set GL strings so GPU config code can make correct feature blacklisting/ |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 | 534 |
| 529 void CastBrowserMainParts::PostDestroyThreads() { | 535 void CastBrowserMainParts::PostDestroyThreads() { |
| 530 #if !defined(OS_ANDROID) | 536 #if !defined(OS_ANDROID) |
| 531 media_resource_tracker_->FinalizeAndDestroy(); | 537 media_resource_tracker_->FinalizeAndDestroy(); |
| 532 media_resource_tracker_ = nullptr; | 538 media_resource_tracker_ = nullptr; |
| 533 #endif | 539 #endif |
| 534 } | 540 } |
| 535 | 541 |
| 536 } // namespace shell | 542 } // namespace shell |
| 537 } // namespace chromecast | 543 } // namespace chromecast |
| OLD | NEW |