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

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

Issue 2258493003: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 #if defined(OS_ANDROID) 346 #if defined(OS_ANDROID)
347 net::NetworkChangeNotifier::SetFactory( 347 net::NetworkChangeNotifier::SetFactory(
348 new net::NetworkChangeNotifierFactoryAndroid()); 348 new net::NetworkChangeNotifierFactoryAndroid());
349 #else 349 #else
350 net::NetworkChangeNotifier::SetFactory( 350 net::NetworkChangeNotifier::SetFactory(
351 new NetworkChangeNotifierFactoryCast()); 351 new NetworkChangeNotifierFactoryCast());
352 #endif // defined(OS_ANDROID) 352 #endif // defined(OS_ANDROID)
353 } 353 }
354 354
355 void CastBrowserMainParts::PostMainMessageLoopStart() { 355 void CastBrowserMainParts::PostMainMessageLoopStart() {
356 cast_browser_process_->SetMetricsHelper(base::WrapUnique( 356 cast_browser_process_->SetMetricsHelper(
357 new metrics::CastMetricsHelper(base::ThreadTaskRunnerHandle::Get()))); 357 base::MakeUnique<metrics::CastMetricsHelper>(
358 base::ThreadTaskRunnerHandle::Get()));
358 359
359 #if defined(OS_ANDROID) 360 #if defined(OS_ANDROID)
360 base::MessageLoopForUI::current()->Start(); 361 base::MessageLoopForUI::current()->Start();
361 #endif // defined(OS_ANDROID) 362 #endif // defined(OS_ANDROID)
362 } 363 }
363 364
364 void CastBrowserMainParts::ToolkitInitialized() { 365 void CastBrowserMainParts::ToolkitInitialized() {
365 #if defined(OS_LINUX) 366 #if defined(OS_LINUX)
366 // Without this call, the FontConfig library gets implicitly initialized 367 // Without this call, the FontConfig library gets implicitly initialized
367 // on the first call to FontConfig. Since it's not safe to initialize it 368 // on the first call to FontConfig. Since it's not safe to initialize it
(...skipping 12 matching lines...) Expand all
380 381
381 int CastBrowserMainParts::PreCreateThreads() { 382 int CastBrowserMainParts::PreCreateThreads() {
382 #if defined(OS_ANDROID) 383 #if defined(OS_ANDROID)
383 // GPU process is started immediately after threads are created, requiring 384 // GPU process is started immediately after threads are created, requiring
384 // CrashDumpManager to be initialized beforehand. 385 // CrashDumpManager to be initialized beforehand.
385 base::FilePath crash_dumps_dir; 386 base::FilePath crash_dumps_dir;
386 if (!chromecast::CrashHandler::GetCrashDumpLocation(&crash_dumps_dir)) { 387 if (!chromecast::CrashHandler::GetCrashDumpLocation(&crash_dumps_dir)) {
387 LOG(ERROR) << "Could not find crash dump location."; 388 LOG(ERROR) << "Could not find crash dump location.";
388 } 389 }
389 cast_browser_process_->SetCrashDumpManager( 390 cast_browser_process_->SetCrashDumpManager(
390 base::WrapUnique(new breakpad::CrashDumpManager(crash_dumps_dir))); 391 base::MakeUnique<breakpad::CrashDumpManager>(crash_dumps_dir));
391 #else 392 #else
392 base::FilePath home_dir; 393 base::FilePath home_dir;
393 CHECK(PathService::Get(DIR_CAST_HOME, &home_dir)); 394 CHECK(PathService::Get(DIR_CAST_HOME, &home_dir));
394 if (!base::CreateDirectory(home_dir)) 395 if (!base::CreateDirectory(home_dir))
395 return 1; 396 return 1;
396 397
397 // Hook for internal code 398 // Hook for internal code
398 cast_browser_process_->browser_client()->PreCreateThreads(); 399 cast_browser_process_->browser_client()->PreCreateThreads();
399 400
400 // Set GL strings so GPU config code can make correct feature blacklisting/ 401 // Set GL strings so GPU config code can make correct feature blacklisting/
(...skipping 28 matching lines...) Expand all
429 430
430 cast_browser_process_->SetConnectivityChecker(ConnectivityChecker::Create( 431 cast_browser_process_->SetConnectivityChecker(ConnectivityChecker::Create(
431 content::BrowserThread::GetTaskRunnerForThread( 432 content::BrowserThread::GetTaskRunnerForThread(
432 content::BrowserThread::IO))); 433 content::BrowserThread::IO)));
433 434
434 cast_browser_process_->SetNetLog(net_log_.get()); 435 cast_browser_process_->SetNetLog(net_log_.get());
435 436
436 url_request_context_factory_->InitializeOnUIThread(net_log_.get()); 437 url_request_context_factory_->InitializeOnUIThread(net_log_.get());
437 438
438 cast_browser_process_->SetBrowserContext( 439 cast_browser_process_->SetBrowserContext(
439 base::WrapUnique(new CastBrowserContext(url_request_context_factory_))); 440 base::MakeUnique<CastBrowserContext>(url_request_context_factory_));
440 cast_browser_process_->SetMetricsServiceClient( 441 cast_browser_process_->SetMetricsServiceClient(
441 metrics::CastMetricsServiceClient::Create( 442 metrics::CastMetricsServiceClient::Create(
442 content::BrowserThread::GetBlockingPool(), 443 content::BrowserThread::GetBlockingPool(),
443 cast_browser_process_->pref_service(), 444 cast_browser_process_->pref_service(),
444 content::BrowserContext::GetDefaultStoragePartition( 445 content::BrowserContext::GetDefaultStoragePartition(
445 cast_browser_process_->browser_context())-> 446 cast_browser_process_->browser_context())->
446 GetURLRequestContext())); 447 GetURLRequestContext()));
447 448
448 if (!PlatformClientAuth::Initialize()) 449 if (!PlatformClientAuth::Initialize())
449 LOG(ERROR) << "PlatformClientAuth::Initialize failed."; 450 LOG(ERROR) << "PlatformClientAuth::Initialize failed.";
450 451
451 cast_browser_process_->SetRemoteDebuggingServer(base::WrapUnique( 452 cast_browser_process_->SetRemoteDebuggingServer(
452 new RemoteDebuggingServer(cast_browser_process_->browser_client() 453 base::MakeUnique<RemoteDebuggingServer>(
453 ->EnableRemoteDebuggingImmediately()))); 454 cast_browser_process_->browser_client()
455 ->EnableRemoteDebuggingImmediately()));
454 456
455 #if defined(USE_AURA) && !BUILDFLAG(DISABLE_DISPLAY) 457 #if defined(USE_AURA) && !BUILDFLAG(DISABLE_DISPLAY)
456 // TODO(halliwell) move audio builds to use ozone_platform_cast, then can 458 // TODO(halliwell) move audio builds to use ozone_platform_cast, then can
457 // simplify this by removing DISABLE_DISPLAY condition. Should then also 459 // simplify this by removing DISABLE_DISPLAY condition. Should then also
458 // assert(ozone_platform_cast) in BUILD.gn where it depends on //ui/ozone. 460 // assert(ozone_platform_cast) in BUILD.gn where it depends on //ui/ozone.
459 gfx::Size display_size = 461 gfx::Size display_size =
460 display::Screen::GetScreen()->GetPrimaryDisplay().GetSizeInPixel(); 462 display::Screen::GetScreen()->GetPrimaryDisplay().GetSizeInPixel();
461 video_plane_controller_.reset(new media::VideoPlaneController( 463 video_plane_controller_.reset(new media::VideoPlaneController(
462 Size(display_size.width(), display_size.height()), GetMediaTaskRunner())); 464 Size(display_size.width(), display_size.height()), GetMediaTaskRunner()));
463 ui::OverlayManagerCast::SetOverlayCompositedCallback( 465 ui::OverlayManagerCast::SetOverlayCompositedCallback(
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 538
537 void CastBrowserMainParts::PostDestroyThreads() { 539 void CastBrowserMainParts::PostDestroyThreads() {
538 #if !defined(OS_ANDROID) 540 #if !defined(OS_ANDROID)
539 media_resource_tracker_->FinalizeAndDestroy(); 541 media_resource_tracker_->FinalizeAndDestroy();
540 media_resource_tracker_ = nullptr; 542 media_resource_tracker_ = nullptr;
541 #endif 543 #endif
542 } 544 }
543 545
544 } // namespace shell 546 } // namespace shell
545 } // namespace chromecast 547 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/base/device_capabilities_impl_unittest.cc ('k') | chromecast/browser/cast_content_browser_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698