| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/browser_main_loop.h" | 5 #include "content/browser/browser_main_loop.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/hi_res_timer_manager.h" | 10 #include "base/hi_res_timer_manager.h" |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 #endif | 289 #endif |
| 290 | 290 |
| 291 if (parsed_command_line_.HasSwitch(switches::kEnableSSLCachedInfo)) | 291 if (parsed_command_line_.HasSwitch(switches::kEnableSSLCachedInfo)) |
| 292 net::SSLConfigService::EnableCachedInfo(); | 292 net::SSLConfigService::EnableCachedInfo(); |
| 293 | 293 |
| 294 // TODO(abarth): Should this move to InitializeNetworkOptions? This doesn't | 294 // TODO(abarth): Should this move to InitializeNetworkOptions? This doesn't |
| 295 // seem dependent on SSL initialization(). | 295 // seem dependent on SSL initialization(). |
| 296 if (parsed_command_line_.HasSwitch(switches::kEnableTcpFastOpen)) | 296 if (parsed_command_line_.HasSwitch(switches::kEnableTcpFastOpen)) |
| 297 net::set_tcp_fastopen_enabled(true); | 297 net::set_tcp_fastopen_enabled(true); |
| 298 | 298 |
| 299 #if !defined(OS_IOS) |
| 299 if (parsed_command_line_.HasSwitch(switches::kRendererProcessLimit)) { | 300 if (parsed_command_line_.HasSwitch(switches::kRendererProcessLimit)) { |
| 300 std::string limit_string = parsed_command_line_.GetSwitchValueASCII( | 301 std::string limit_string = parsed_command_line_.GetSwitchValueASCII( |
| 301 switches::kRendererProcessLimit); | 302 switches::kRendererProcessLimit); |
| 302 size_t process_limit; | 303 size_t process_limit; |
| 303 if (base::StringToSizeT(limit_string, &process_limit)) { | 304 if (base::StringToSizeT(limit_string, &process_limit)) { |
| 304 content::RenderProcessHost::SetMaxRendererProcessCount(process_limit); | 305 content::RenderProcessHost::SetMaxRendererProcessCount(process_limit); |
| 305 } | 306 } |
| 306 } | 307 } |
| 308 #endif // !defined(OS_IOS) |
| 307 | 309 |
| 308 if (parts_.get()) | 310 if (parts_.get()) |
| 309 parts_->PostEarlyInitialization(); | 311 parts_->PostEarlyInitialization(); |
| 310 } | 312 } |
| 311 | 313 |
| 312 void BrowserMainLoop::MainMessageLoopStart() { | 314 void BrowserMainLoop::MainMessageLoopStart() { |
| 313 if (parts_.get()) | 315 if (parts_.get()) |
| 314 parts_->PreMainMessageLoopStart(); | 316 parts_->PreMainMessageLoopStart(); |
| 315 | 317 |
| 316 #if defined(OS_WIN) | 318 #if defined(OS_WIN) |
| 317 // If we're running tests (ui_task is non-null), then the ResourceBundle | 319 // If we're running tests (ui_task is non-null), then the ResourceBundle |
| 318 // has already been initialized. | 320 // has already been initialized. |
| 319 if (!parameters_.ui_task) { | 321 if (!parameters_.ui_task) { |
| 320 // Override the configured locale with the user's preferred UI language. | 322 // Override the configured locale with the user's preferred UI language. |
| 321 l10n_util::OverrideLocaleWithUILanguageList(); | 323 l10n_util::OverrideLocaleWithUILanguageList(); |
| 322 } | 324 } |
| 323 #endif | 325 #endif |
| 324 | 326 |
| 325 // Create a MessageLoop if one does not already exist for the current thread. | 327 // Create a MessageLoop if one does not already exist for the current thread. |
| 326 if (!MessageLoop::current()) | 328 if (!MessageLoop::current()) |
| 327 main_message_loop_.reset(new MessageLoop(MessageLoop::TYPE_UI)); | 329 main_message_loop_.reset(new MessageLoop(MessageLoop::TYPE_UI)); |
| 328 | 330 |
| 329 InitializeMainThread(); | 331 InitializeMainThread(); |
| 330 | 332 |
| 333 system_monitor_.reset(new base::SystemMonitor); |
| 334 hi_res_timer_manager_.reset(new HighResolutionTimerManager); |
| 335 network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); |
| 336 audio_manager_.reset(media::AudioManager::Create()); |
| 337 |
| 338 #if !defined(OS_IOS) |
| 331 // Start tracing to a file if needed. | 339 // Start tracing to a file if needed. |
| 332 if (base::debug::TraceLog::GetInstance()->IsEnabled()) { | 340 if (base::debug::TraceLog::GetInstance()->IsEnabled()) { |
| 333 TraceControllerImpl::GetInstance()->InitStartupTracing( | 341 TraceControllerImpl::GetInstance()->InitStartupTracing( |
| 334 parsed_command_line_); | 342 parsed_command_line_); |
| 335 } | 343 } |
| 336 | 344 |
| 337 system_monitor_.reset(new base::SystemMonitor); | |
| 338 hi_res_timer_manager_.reset(new HighResolutionTimerManager); | |
| 339 network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); | |
| 340 audio_manager_.reset(media::AudioManager::Create()); | |
| 341 online_state_observer_.reset(new BrowserOnlineStateObserver); | 345 online_state_observer_.reset(new BrowserOnlineStateObserver); |
| 342 scoped_refptr<media_stream::AudioInputDeviceManager> | 346 scoped_refptr<media_stream::AudioInputDeviceManager> |
| 343 audio_input_device_manager( | 347 audio_input_device_manager( |
| 344 new media_stream::AudioInputDeviceManager(audio_manager_.get())); | 348 new media_stream::AudioInputDeviceManager(audio_manager_.get())); |
| 345 scoped_refptr<media_stream::VideoCaptureManager> video_capture_manager( | 349 scoped_refptr<media_stream::VideoCaptureManager> video_capture_manager( |
| 346 new media_stream::VideoCaptureManager()); | 350 new media_stream::VideoCaptureManager()); |
| 347 media_stream_manager_.reset(new media_stream::MediaStreamManager( | 351 media_stream_manager_.reset(new media_stream::MediaStreamManager( |
| 348 audio_input_device_manager, video_capture_manager)); | 352 audio_input_device_manager, video_capture_manager)); |
| 349 | 353 |
| 350 #if defined(OS_WIN) | |
| 351 system_message_window_.reset(new SystemMessageWindowWin); | |
| 352 #endif | |
| 353 | |
| 354 // Prior to any processing happening on the io thread, we create the | 354 // Prior to any processing happening on the io thread, we create the |
| 355 // plugin service as it is predominantly used from the io thread, | 355 // plugin service as it is predominantly used from the io thread, |
| 356 // but must be created on the main thread. The service ctor is | 356 // but must be created on the main thread. The service ctor is |
| 357 // inexpensive and does not invoke the io_thread() accessor. | 357 // inexpensive and does not invoke the io_thread() accessor. |
| 358 PluginService::GetInstance()->Init(); | 358 PluginService::GetInstance()->Init(); |
| 359 #endif // !defined(OS_IOS) |
| 360 |
| 361 #if defined(OS_WIN) |
| 362 system_message_window_.reset(new SystemMessageWindowWin); |
| 363 #endif |
| 359 | 364 |
| 360 if (parts_.get()) | 365 if (parts_.get()) |
| 361 parts_->PostMainMessageLoopStart(); | 366 parts_->PostMainMessageLoopStart(); |
| 362 } | 367 } |
| 363 | 368 |
| 364 void BrowserMainLoop::CreateThreads() { | 369 void BrowserMainLoop::CreateThreads() { |
| 365 if (parts_.get()) | 370 if (parts_.get()) |
| 366 result_code_ = parts_->PreCreateThreads(); | 371 result_code_ = parts_->PreCreateThreads(); |
| 367 | 372 |
| 368 if (result_code_ > 0) | 373 if (result_code_ > 0) |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 case BrowserThread::UI: | 426 case BrowserThread::UI: |
| 422 case BrowserThread::ID_COUNT: | 427 case BrowserThread::ID_COUNT: |
| 423 default: | 428 default: |
| 424 NOTREACHED(); | 429 NOTREACHED(); |
| 425 break; | 430 break; |
| 426 } | 431 } |
| 427 | 432 |
| 428 BrowserThread::ID id = static_cast<BrowserThread::ID>(thread_id); | 433 BrowserThread::ID id = static_cast<BrowserThread::ID>(thread_id); |
| 429 | 434 |
| 430 if (thread_id == BrowserThread::WEBKIT_DEPRECATED) { | 435 if (thread_id == BrowserThread::WEBKIT_DEPRECATED) { |
| 436 #if !defined(OS_IOS) |
| 431 webkit_thread_.reset(new WebKitThread); | 437 webkit_thread_.reset(new WebKitThread); |
| 432 webkit_thread_->Initialize(); | 438 webkit_thread_->Initialize(); |
| 439 #endif |
| 433 } else if (thread_to_start) { | 440 } else if (thread_to_start) { |
| 434 (*thread_to_start).reset(new BrowserProcessSubThread(id)); | 441 (*thread_to_start).reset(new BrowserProcessSubThread(id)); |
| 435 (*thread_to_start)->StartWithOptions(*options); | 442 (*thread_to_start)->StartWithOptions(*options); |
| 436 } else { | 443 } else { |
| 437 NOTREACHED(); | 444 NOTREACHED(); |
| 438 } | 445 } |
| 439 } | 446 } |
| 440 | 447 |
| 441 BrowserThreadsStarted(); | 448 BrowserThreadsStarted(); |
| 442 | 449 |
| 443 if (parts_.get()) | 450 if (parts_.get()) |
| 444 parts_->PreMainMessageLoopRun(); | 451 parts_->PreMainMessageLoopRun(); |
| 445 | 452 |
| 453 #if !defined(OS_IOS) |
| 446 // When running the GPU thread in-process, avoid optimistically starting it | 454 // When running the GPU thread in-process, avoid optimistically starting it |
| 447 // since creating the GPU thread races against creation of the one-and-only | 455 // since creating the GPU thread races against creation of the one-and-only |
| 448 // ChildProcess instance which is created by the renderer thread. | 456 // ChildProcess instance which is created by the renderer thread. |
| 449 GpuDataManager* gpu_data_manager = content::GpuDataManager::GetInstance(); | 457 GpuDataManager* gpu_data_manager = content::GpuDataManager::GetInstance(); |
| 450 if (gpu_data_manager->GpuAccessAllowed() && | 458 if (gpu_data_manager->GpuAccessAllowed() && |
| 451 !parsed_command_line_.HasSwitch(switches::kDisableGpuProcessPrelaunch) && | 459 !parsed_command_line_.HasSwitch(switches::kDisableGpuProcessPrelaunch) && |
| 452 !parsed_command_line_.HasSwitch(switches::kSingleProcess) && | 460 !parsed_command_line_.HasSwitch(switches::kSingleProcess) && |
| 453 !parsed_command_line_.HasSwitch(switches::kInProcessGPU)) { | 461 !parsed_command_line_.HasSwitch(switches::kInProcessGPU)) { |
| 454 TRACE_EVENT_INSTANT0("gpu", "Post task to launch GPU process"); | 462 TRACE_EVENT_INSTANT0("gpu", "Post task to launch GPU process"); |
| 455 BrowserThread::PostTask( | 463 BrowserThread::PostTask( |
| 456 BrowserThread::IO, FROM_HERE, base::Bind( | 464 BrowserThread::IO, FROM_HERE, base::Bind( |
| 457 base::IgnoreResult(&GpuProcessHost::Get), | 465 base::IgnoreResult(&GpuProcessHost::Get), |
| 458 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, | 466 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, |
| 459 content::CAUSE_FOR_GPU_LAUNCH_BROWSER_STARTUP)); | 467 content::CAUSE_FOR_GPU_LAUNCH_BROWSER_STARTUP)); |
| 460 } | 468 } |
| 469 #endif // !defined(OS_IOS) |
| 461 | 470 |
| 462 // If the UI thread blocks, the whole UI is unresponsive. | 471 // If the UI thread blocks, the whole UI is unresponsive. |
| 463 // Do not allow disk IO from the UI thread. | 472 // Do not allow disk IO from the UI thread. |
| 464 base::ThreadRestrictions::SetIOAllowed(false); | 473 base::ThreadRestrictions::SetIOAllowed(false); |
| 465 base::ThreadRestrictions::DisallowWaiting(); | 474 base::ThreadRestrictions::DisallowWaiting(); |
| 466 } | 475 } |
| 467 | 476 |
| 468 void BrowserMainLoop::RunMainMessageLoopParts() { | 477 void BrowserMainLoop::RunMainMessageLoopParts() { |
| 469 TRACE_EVENT_BEGIN_ETW("BrowserMain:MESSAGE_LOOP", 0, ""); | 478 TRACE_EVENT_BEGIN_ETW("BrowserMain:MESSAGE_LOOP", 0, ""); |
| 470 | 479 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 483 // need to be able to perform IO. | 492 // need to be able to perform IO. |
| 484 base::ThreadRestrictions::SetIOAllowed(true); | 493 base::ThreadRestrictions::SetIOAllowed(true); |
| 485 BrowserThread::PostTask( | 494 BrowserThread::PostTask( |
| 486 BrowserThread::IO, FROM_HERE, | 495 BrowserThread::IO, FROM_HERE, |
| 487 base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed), | 496 base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed), |
| 488 true)); | 497 true)); |
| 489 | 498 |
| 490 if (parts_.get()) | 499 if (parts_.get()) |
| 491 parts_->PostMainMessageLoopRun(); | 500 parts_->PostMainMessageLoopRun(); |
| 492 | 501 |
| 502 #if !defined(OS_IOS) |
| 493 // Destroying the GpuProcessHostUIShims on the UI thread posts a task to | 503 // Destroying the GpuProcessHostUIShims on the UI thread posts a task to |
| 494 // delete related objects on the GPU thread. This must be done before | 504 // delete related objects on the GPU thread. This must be done before |
| 495 // stopping the GPU thread. The GPU thread will close IPC channels to renderer | 505 // stopping the GPU thread. The GPU thread will close IPC channels to renderer |
| 496 // processes so this has to happen before stopping the IO thread. | 506 // processes so this has to happen before stopping the IO thread. |
| 497 GpuProcessHostUIShim::DestroyAll(); | 507 GpuProcessHostUIShim::DestroyAll(); |
| 498 | 508 |
| 499 // Cancel pending requests and prevent new requests. | 509 // Cancel pending requests and prevent new requests. |
| 500 if (resource_dispatcher_host_.get()) | 510 if (resource_dispatcher_host_.get()) |
| 501 resource_dispatcher_host_.get()->Shutdown(); | 511 resource_dispatcher_host_.get()->Shutdown(); |
| 502 | 512 |
| 503 #if defined(USE_AURA) | 513 #if defined(USE_AURA) |
| 504 ImageTransportFactory::Terminate(); | 514 ImageTransportFactory::Terminate(); |
| 505 #endif | 515 #endif |
| 506 BrowserGpuChannelHostFactory::Terminate(); | 516 BrowserGpuChannelHostFactory::Terminate(); |
| 507 | 517 |
| 508 GamepadService::GetInstance()->Terminate(); | 518 GamepadService::GetInstance()->Terminate(); |
| 509 | 519 |
| 510 // The device monitors are using |system_monitor_| as dependency, so delete | 520 // The device monitors are using |system_monitor_| as dependency, so delete |
| 511 // them before |system_monitor_| goes away. | 521 // them before |system_monitor_| goes away. |
| 512 // On Mac and windows, the monitor needs to be destroyed on the same thread | 522 // On Mac and windows, the monitor needs to be destroyed on the same thread |
| 513 // as they were created. On Linux, the monitor will be deleted when IO thread | 523 // as they were created. On Linux, the monitor will be deleted when IO thread |
| 514 // goes away. | 524 // goes away. |
| 515 #if defined(OS_WIN) | 525 #if defined(OS_WIN) |
| 516 system_message_window_.reset(); | 526 system_message_window_.reset(); |
| 517 #elif defined(OS_MACOSX) | 527 #elif defined(OS_MACOSX) |
| 518 device_monitor_mac_.reset(); | 528 device_monitor_mac_.reset(); |
| 519 #endif | 529 #endif |
| 530 #endif // !defined(OS_IOS) |
| 520 | 531 |
| 521 // Must be size_t so we can subtract from it. | 532 // Must be size_t so we can subtract from it. |
| 522 for (size_t thread_id = BrowserThread::ID_COUNT - 1; | 533 for (size_t thread_id = BrowserThread::ID_COUNT - 1; |
| 523 thread_id >= (BrowserThread::UI + 1); | 534 thread_id >= (BrowserThread::UI + 1); |
| 524 --thread_id) { | 535 --thread_id) { |
| 525 // Find the thread object we want to stop. Looping over all valid | 536 // Find the thread object we want to stop. Looping over all valid |
| 526 // BrowserThread IDs and DCHECKing on a missing case in the switch | 537 // BrowserThread IDs and DCHECKing on a missing case in the switch |
| 527 // statement helps avoid a mismatch between this code and the | 538 // statement helps avoid a mismatch between this code and the |
| 528 // BrowserThread::ID enumeration. | 539 // BrowserThread::ID enumeration. |
| 529 // | 540 // |
| (...skipping 27 matching lines...) Expand all Loading... |
| 557 // Need to destroy ResourceDispatcherHost before PluginService | 568 // Need to destroy ResourceDispatcherHost before PluginService |
| 558 // and since it caches a pointer to it. | 569 // and since it caches a pointer to it. |
| 559 resource_dispatcher_host_.reset(); | 570 resource_dispatcher_host_.reset(); |
| 560 break; | 571 break; |
| 561 case BrowserThread::FILE_USER_BLOCKING: | 572 case BrowserThread::FILE_USER_BLOCKING: |
| 562 thread_to_stop = &file_user_blocking_thread_; | 573 thread_to_stop = &file_user_blocking_thread_; |
| 563 break; | 574 break; |
| 564 case BrowserThread::FILE: | 575 case BrowserThread::FILE: |
| 565 thread_to_stop = &file_thread_; | 576 thread_to_stop = &file_thread_; |
| 566 | 577 |
| 578 #if !defined(OS_IOS) |
| 567 // Clean up state that lives on or uses the file_thread_ before | 579 // Clean up state that lives on or uses the file_thread_ before |
| 568 // it goes away. | 580 // it goes away. |
| 569 if (resource_dispatcher_host_.get()) { | 581 if (resource_dispatcher_host_.get()) { |
| 570 resource_dispatcher_host_.get()->download_file_manager()->Shutdown(); | 582 resource_dispatcher_host_.get()->download_file_manager()->Shutdown(); |
| 571 resource_dispatcher_host_.get()->save_file_manager()->Shutdown(); | 583 resource_dispatcher_host_.get()->save_file_manager()->Shutdown(); |
| 572 } | 584 } |
| 585 #endif // !defined(OS_IOS) |
| 573 break; | 586 break; |
| 574 case BrowserThread::PROCESS_LAUNCHER: | 587 case BrowserThread::PROCESS_LAUNCHER: |
| 575 thread_to_stop = &process_launcher_thread_; | 588 thread_to_stop = &process_launcher_thread_; |
| 576 break; | 589 break; |
| 577 case BrowserThread::CACHE: | 590 case BrowserThread::CACHE: |
| 578 thread_to_stop = &cache_thread_; | 591 thread_to_stop = &cache_thread_; |
| 579 break; | 592 break; |
| 580 case BrowserThread::IO: | 593 case BrowserThread::IO: |
| 581 thread_to_stop = &io_thread_; | 594 thread_to_stop = &io_thread_; |
| 582 break; | 595 break; |
| 583 case BrowserThread::UI: | 596 case BrowserThread::UI: |
| 584 case BrowserThread::ID_COUNT: | 597 case BrowserThread::ID_COUNT: |
| 585 default: | 598 default: |
| 586 NOTREACHED(); | 599 NOTREACHED(); |
| 587 break; | 600 break; |
| 588 } | 601 } |
| 589 | 602 |
| 590 BrowserThread::ID id = static_cast<BrowserThread::ID>(thread_id); | 603 BrowserThread::ID id = static_cast<BrowserThread::ID>(thread_id); |
| 591 | 604 |
| 592 if (id == BrowserThread::WEBKIT_DEPRECATED) { | 605 if (id == BrowserThread::WEBKIT_DEPRECATED) { |
| 606 #if !defined(OS_IOS) |
| 593 webkit_thread_.reset(); | 607 webkit_thread_.reset(); |
| 608 #endif |
| 594 } else if (thread_to_stop) { | 609 } else if (thread_to_stop) { |
| 595 thread_to_stop->reset(); | 610 thread_to_stop->reset(); |
| 596 } else { | 611 } else { |
| 597 NOTREACHED(); | 612 NOTREACHED(); |
| 598 } | 613 } |
| 599 } | 614 } |
| 600 | 615 |
| 601 // Close the blocking I/O pool after the other threads. Other threads such | 616 // Close the blocking I/O pool after the other threads. Other threads such |
| 602 // as the I/O thread may need to schedule work like closing files or flushing | 617 // as the I/O thread may need to schedule work like closing files or flushing |
| 603 // data during shutdown, so the blocking pool needs to be available. There | 618 // data during shutdown, so the blocking pool needs to be available. There |
| (...skipping 12 matching lines...) Expand all Loading... |
| 616 if (main_message_loop_.get()) | 631 if (main_message_loop_.get()) |
| 617 main_message_loop_->set_thread_name(kThreadName); | 632 main_message_loop_->set_thread_name(kThreadName); |
| 618 | 633 |
| 619 // Register the main thread by instantiating it, but don't call any methods. | 634 // Register the main thread by instantiating it, but don't call any methods. |
| 620 main_thread_.reset(new BrowserThreadImpl(BrowserThread::UI, | 635 main_thread_.reset(new BrowserThreadImpl(BrowserThread::UI, |
| 621 MessageLoop::current())); | 636 MessageLoop::current())); |
| 622 } | 637 } |
| 623 | 638 |
| 624 | 639 |
| 625 void BrowserMainLoop::BrowserThreadsStarted() { | 640 void BrowserMainLoop::BrowserThreadsStarted() { |
| 641 #if !defined(OS_IOS) |
| 626 HistogramSynchronizer::GetInstance(); | 642 HistogramSynchronizer::GetInstance(); |
| 627 | 643 |
| 628 content::BrowserGpuChannelHostFactory::Initialize(); | 644 content::BrowserGpuChannelHostFactory::Initialize(); |
| 629 #if defined(USE_AURA) | 645 #if defined(USE_AURA) |
| 630 ImageTransportFactory::Initialize(); | 646 ImageTransportFactory::Initialize(); |
| 631 #endif | 647 #endif |
| 632 | 648 |
| 633 #if defined(OS_LINUX) | 649 #if defined(OS_LINUX) |
| 634 device_monitor_linux_.reset(new DeviceMonitorLinux()); | 650 device_monitor_linux_.reset(new DeviceMonitorLinux()); |
| 635 #elif defined(OS_MACOSX) | 651 #elif defined(OS_MACOSX) |
| 636 device_monitor_mac_.reset(new DeviceMonitorMac()); | 652 device_monitor_mac_.reset(new DeviceMonitorMac()); |
| 637 #endif | 653 #endif |
| 638 | 654 |
| 639 // RDH needs the IO thread to be created. | 655 // RDH needs the IO thread to be created. |
| 640 resource_dispatcher_host_.reset(new ResourceDispatcherHostImpl()); | 656 resource_dispatcher_host_.reset(new ResourceDispatcherHostImpl()); |
| 641 | 657 |
| 658 // Start the GpuDataManager before we set up the MessageLoops because |
| 659 // otherwise we'll trigger the assertion about doing IO on the UI thread. |
| 660 content::GpuDataManager::GetInstance(); |
| 661 #endif // !OS_IOS |
| 662 |
| 642 #if defined(ENABLE_INPUT_SPEECH) | 663 #if defined(ENABLE_INPUT_SPEECH) |
| 643 speech_recognition_manager_.reset(new speech::SpeechRecognitionManagerImpl()); | 664 speech_recognition_manager_.reset(new speech::SpeechRecognitionManagerImpl()); |
| 644 #endif | 665 #endif |
| 645 | |
| 646 // Start the GpuDataManager before we set up the MessageLoops because | |
| 647 // otherwise we'll trigger the assertion about doing IO on the UI thread. | |
| 648 content::GpuDataManager::GetInstance(); | |
| 649 } | 666 } |
| 650 | 667 |
| 651 void BrowserMainLoop::InitializeToolkit() { | 668 void BrowserMainLoop::InitializeToolkit() { |
| 652 // TODO(evan): this function is rather subtle, due to the variety | 669 // TODO(evan): this function is rather subtle, due to the variety |
| 653 // of intersecting ifdefs we have. To keep it easy to follow, there | 670 // of intersecting ifdefs we have. To keep it easy to follow, there |
| 654 // are no #else branches on any #ifs. | 671 // are no #else branches on any #ifs. |
| 655 // TODO(stevenjb): Move platform specific code into platform specific Parts | 672 // TODO(stevenjb): Move platform specific code into platform specific Parts |
| 656 // (Need to add InitializeToolkit stage to BrowserParts). | 673 // (Need to add InitializeToolkit stage to BrowserParts). |
| 657 #if defined(OS_LINUX) || defined(OS_OPENBSD) | 674 #if defined(OS_LINUX) || defined(OS_OPENBSD) |
| 658 // Glib type system initialization. Needed at least for gconf, | 675 // Glib type system initialization. Needed at least for gconf, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); | 713 DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); |
| 697 if (parameters_.ui_task) | 714 if (parameters_.ui_task) |
| 698 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); | 715 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); |
| 699 | 716 |
| 700 base::RunLoop run_loop; | 717 base::RunLoop run_loop; |
| 701 run_loop.Run(); | 718 run_loop.Run(); |
| 702 #endif | 719 #endif |
| 703 } | 720 } |
| 704 | 721 |
| 705 } // namespace content | 722 } // namespace content |
| OLD | NEW |