Chromium Code Reviews| Index: content/browser/browser_main_loop.cc |
| diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc |
| index faed5fc5c27350c10c45ba7767c8ff593cf45967..9eb84237dfe4163290a219db23048deeb70a1d4e 100644 |
| --- a/content/browser/browser_main_loop.cc |
| +++ b/content/browser/browser_main_loop.cc |
| @@ -296,6 +296,7 @@ void BrowserMainLoop::EarlyInitialization() { |
| if (parsed_command_line_.HasSwitch(switches::kEnableTcpFastOpen)) |
| net::set_tcp_fastopen_enabled(true); |
| +#if !defined(OS_IOS) |
| if (parsed_command_line_.HasSwitch(switches::kRendererProcessLimit)) { |
| std::string limit_string = parsed_command_line_.GetSwitchValueASCII( |
| switches::kRendererProcessLimit); |
| @@ -304,6 +305,7 @@ void BrowserMainLoop::EarlyInitialization() { |
| content::RenderProcessHost::SetMaxRendererProcessCount(process_limit); |
| } |
| } |
| +#endif // !defined(OS_IOS) |
| if (parts_.get()) |
| parts_->PostEarlyInitialization(); |
| @@ -328,16 +330,19 @@ void BrowserMainLoop::MainMessageLoopStart() { |
| InitializeMainThread(); |
| +#if !defined(OS_IOS) |
| // Start tracing to a file if needed. |
| if (base::debug::TraceLog::GetInstance()->IsEnabled()) { |
| TraceControllerImpl::GetInstance()->InitStartupTracing( |
| parsed_command_line_); |
| } |
| +#endif // !defined(OS_IOS) |
| system_monitor_.reset(new base::SystemMonitor); |
|
jam
2012/09/05 15:49:05
nit: move this code up so that the two ifdefs can
leng
2012/09/06 08:40:02
Done.
|
| hi_res_timer_manager_.reset(new HighResolutionTimerManager); |
| network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); |
| audio_manager_.reset(media::AudioManager::Create()); |
| +#if !defined(OS_IOS) |
| online_state_observer_.reset(new BrowserOnlineStateObserver); |
| scoped_refptr<media_stream::AudioInputDeviceManager> |
| audio_input_device_manager( |
| @@ -347,15 +352,16 @@ void BrowserMainLoop::MainMessageLoopStart() { |
| media_stream_manager_.reset(new media_stream::MediaStreamManager( |
| audio_input_device_manager, video_capture_manager)); |
| -#if defined(OS_WIN) |
| - system_message_window_.reset(new SystemMessageWindowWin); |
| -#endif |
| - |
| // Prior to any processing happening on the io thread, we create the |
| // plugin service as it is predominantly used from the io thread, |
| // but must be created on the main thread. The service ctor is |
| // inexpensive and does not invoke the io_thread() accessor. |
| PluginService::GetInstance()->Init(); |
| +#endif // !defined(OS_IOS) |
| + |
| +#if defined(OS_WIN) |
| + system_message_window_.reset(new SystemMessageWindowWin); |
| +#endif |
| if (parts_.get()) |
| parts_->PostMainMessageLoopStart(); |
| @@ -428,8 +434,10 @@ void BrowserMainLoop::CreateThreads() { |
| BrowserThread::ID id = static_cast<BrowserThread::ID>(thread_id); |
| if (thread_id == BrowserThread::WEBKIT_DEPRECATED) { |
| +#if !defined(OS_IOS) |
| webkit_thread_.reset(new WebKitThread); |
| webkit_thread_->Initialize(); |
| +#endif |
| } else if (thread_to_start) { |
| (*thread_to_start).reset(new BrowserProcessSubThread(id)); |
| (*thread_to_start)->StartWithOptions(*options); |
| @@ -443,6 +451,7 @@ void BrowserMainLoop::CreateThreads() { |
| if (parts_.get()) |
| parts_->PreMainMessageLoopRun(); |
| +#if !defined(OS_IOS) |
| // When running the GPU thread in-process, avoid optimistically starting it |
| // since creating the GPU thread races against creation of the one-and-only |
| // ChildProcess instance which is created by the renderer thread. |
| @@ -458,6 +467,7 @@ void BrowserMainLoop::CreateThreads() { |
| GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, |
| content::CAUSE_FOR_GPU_LAUNCH_BROWSER_STARTUP)); |
| } |
| +#endif // !defined(OS_IOS) |
| // If the UI thread blocks, the whole UI is unresponsive. |
| // Do not allow disk IO from the UI thread. |
| @@ -490,6 +500,7 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() { |
| if (parts_.get()) |
| parts_->PostMainMessageLoopRun(); |
| +#if !defined(OS_IOS) |
| // Destroying the GpuProcessHostUIShims on the UI thread posts a task to |
| // delete related objects on the GPU thread. This must be done before |
| // stopping the GPU thread. The GPU thread will close IPC channels to renderer |
| @@ -517,6 +528,7 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() { |
| #elif defined(OS_MACOSX) |
| device_monitor_mac_.reset(); |
| #endif |
| +#endif // !defined(OS_IOS) |
| // Must be size_t so we can subtract from it. |
| for (size_t thread_id = BrowserThread::ID_COUNT - 1; |
| @@ -564,12 +576,14 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() { |
| case BrowserThread::FILE: |
| thread_to_stop = &file_thread_; |
| +#if !defined(OS_IOS) |
| // Clean up state that lives on or uses the file_thread_ before |
| // it goes away. |
| if (resource_dispatcher_host_.get()) { |
| resource_dispatcher_host_.get()->download_file_manager()->Shutdown(); |
| resource_dispatcher_host_.get()->save_file_manager()->Shutdown(); |
| } |
| +#endif // !defined(OS_IOS) |
| break; |
| case BrowserThread::PROCESS_LAUNCHER: |
| thread_to_stop = &process_launcher_thread_; |
| @@ -590,7 +604,9 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() { |
| BrowserThread::ID id = static_cast<BrowserThread::ID>(thread_id); |
| if (id == BrowserThread::WEBKIT_DEPRECATED) { |
| +#if !defined(OS_IOS) |
| webkit_thread_.reset(); |
| +#endif |
| } else if (thread_to_stop) { |
| thread_to_stop->reset(); |
| } else { |
| @@ -623,6 +639,7 @@ void BrowserMainLoop::InitializeMainThread() { |
| void BrowserMainLoop::BrowserThreadsStarted() { |
| +#if !defined(OS_IOS) |
| HistogramSynchronizer::GetInstance(); |
| content::BrowserGpuChannelHostFactory::Initialize(); |
| @@ -639,13 +656,14 @@ void BrowserMainLoop::BrowserThreadsStarted() { |
| // RDH needs the IO thread to be created. |
| resource_dispatcher_host_.reset(new ResourceDispatcherHostImpl()); |
| -#if defined(ENABLE_INPUT_SPEECH) |
| - speech_recognition_manager_.reset(new speech::SpeechRecognitionManagerImpl()); |
| -#endif |
| - |
| // Start the GpuDataManager before we set up the MessageLoops because |
| // otherwise we'll trigger the assertion about doing IO on the UI thread. |
| content::GpuDataManager::GetInstance(); |
| +#endif // !OS_IOS |
| + |
| +#if defined(ENABLE_INPUT_SPEECH) |
| + speech_recognition_manager_.reset(new speech::SpeechRecognitionManagerImpl()); |
| +#endif |
| } |
| void BrowserMainLoop::InitializeToolkit() { |