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 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 | 581 |
582 | 582 |
583 void BrowserMainLoop::BrowserThreadsStarted() { | 583 void BrowserMainLoop::BrowserThreadsStarted() { |
584 // RDH needs the IO thread to be created. | 584 // RDH needs the IO thread to be created. |
585 resource_dispatcher_host_.reset(new ResourceDispatcherHostImpl()); | 585 resource_dispatcher_host_.reset(new ResourceDispatcherHostImpl()); |
586 | 586 |
587 #if defined(ENABLE_INPUT_SPEECH) | 587 #if defined(ENABLE_INPUT_SPEECH) |
588 speech_recognition_manager_.reset(new speech::SpeechRecognitionManagerImpl()); | 588 speech_recognition_manager_.reset(new speech::SpeechRecognitionManagerImpl()); |
589 #endif | 589 #endif |
590 | 590 |
591 // When running the GPU thread in-process, avoid optimistically starting it | |
592 // since creating the GPU thread races against creation of the one-and-only | |
593 // ChildProcess instance which is created by the renderer thread. | |
594 if (!parsed_command_line_.HasSwitch(switches::kDisableGpuProcessPrelaunch) && | |
595 !parsed_command_line_.HasSwitch(switches::kSingleProcess) && | |
596 !parsed_command_line_.HasSwitch(switches::kInProcessGPU)) { | |
597 TRACE_EVENT_INSTANT0("gpu", "Post task to launch GPU process"); | |
598 BrowserThread::PostTask( | |
599 BrowserThread::IO, FROM_HERE, base::Bind( | |
600 base::IgnoreResult(&GpuProcessHost::Get), | |
601 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, | |
602 content::CAUSE_FOR_GPU_LAUNCH_BROWSER_STARTUP)); | |
603 } | |
604 | |
605 // Start the GpuDataManager before we set up the MessageLoops because | 591 // Start the GpuDataManager before we set up the MessageLoops because |
606 // otherwise we'll trigger the assertion about doing IO on the UI thread. | 592 // otherwise we'll trigger the assertion about doing IO on the UI thread. |
607 content::GpuDataManager::GetInstance(); | 593 content::GpuDataManager::GetInstance(); |
608 } | 594 } |
609 | 595 |
610 void BrowserMainLoop::InitializeToolkit() { | 596 void BrowserMainLoop::InitializeToolkit() { |
611 // TODO(evan): this function is rather subtle, due to the variety | 597 // TODO(evan): this function is rather subtle, due to the variety |
612 // of intersecting ifdefs we have. To keep it easy to follow, there | 598 // of intersecting ifdefs we have. To keep it easy to follow, there |
613 // are no #else branches on any #ifs. | 599 // are no #else branches on any #ifs. |
614 // TODO(stevenjb): Move platform specific code into platform specific Parts | 600 // TODO(stevenjb): Move platform specific code into platform specific Parts |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 MessageLoopForUI::current()->Run(); | 641 MessageLoopForUI::current()->Run(); |
656 #elif defined(OS_ANDROID) | 642 #elif defined(OS_ANDROID) |
657 // Android's main message loop is the Java message loop. | 643 // Android's main message loop is the Java message loop. |
658 NOTREACHED(); | 644 NOTREACHED(); |
659 #else | 645 #else |
660 MessageLoopForUI::current()->RunWithDispatcher(NULL); | 646 MessageLoopForUI::current()->RunWithDispatcher(NULL); |
661 #endif | 647 #endif |
662 } | 648 } |
663 | 649 |
664 } // namespace content | 650 } // namespace content |
OLD | NEW |