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