| 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/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 // Prior to any processing happening on the io thread, we create the | 607 // Prior to any processing happening on the io thread, we create the |
| 608 // plugin service as it is predominantly used from the io thread, | 608 // plugin service as it is predominantly used from the io thread, |
| 609 // but must be created on the main thread. The service ctor is | 609 // but must be created on the main thread. The service ctor is |
| 610 // inexpensive and does not invoke the io_thread() accessor. | 610 // inexpensive and does not invoke the io_thread() accessor. |
| 611 { | 611 { |
| 612 TRACE_EVENT0("startup", "BrowserMainLoop::CreateThreads:PluginService"); | 612 TRACE_EVENT0("startup", "BrowserMainLoop::CreateThreads:PluginService"); |
| 613 PluginService::GetInstance()->Init(); | 613 PluginService::GetInstance()->Init(); |
| 614 } | 614 } |
| 615 #endif | 615 #endif |
| 616 | 616 |
| 617 #if !defined(OS_IOS) && (!defined(GOOGLE_CHROME_BUILD) || defined(OS_ANDROID)) | |
| 618 // Single-process is an unsupported and not fully tested mode, so | |
| 619 // don't enable it for official Chrome builds (except on Android). | |
| 620 if (parsed_command_line_.HasSwitch(switches::kSingleProcess)) | |
| 621 RenderProcessHost::SetRunRendererInProcess(true); | |
| 622 #endif | |
| 623 | |
| 624 // Need to initialize in-process GpuDataManager before creating threads. | 617 // Need to initialize in-process GpuDataManager before creating threads. |
| 625 // It's unsafe to append the gpu command line switches to the global | 618 // It's unsafe to append the gpu command line switches to the global |
| 626 // CommandLine::ForCurrentProcess object after threads are created. | 619 // CommandLine::ForCurrentProcess object after threads are created. |
| 627 if (UsingInProcessGpu()) { | 620 if (UsingInProcessGpu()) { |
| 628 bool initialize_gpu_data_manager = true; | 621 bool initialize_gpu_data_manager = true; |
| 629 #if defined(OS_ANDROID) | 622 #if defined(OS_ANDROID) |
| 630 if (!gfx::GLSurface::InitializeOneOff()) { | 623 if (!gfx::GLSurface::InitializeOneOff()) { |
| 631 // Single-process Android WebView supports no gpu. | 624 // Single-process Android WebView supports no gpu. |
| 632 LOG(ERROR) << "GLSurface::InitializeOneOff failed"; | 625 LOG(ERROR) << "GLSurface::InitializeOneOff failed"; |
| 633 initialize_gpu_data_manager = false; | 626 initialize_gpu_data_manager = false; |
| 634 } | 627 } |
| 635 #endif | 628 #endif |
| 636 | 629 |
| 637 // Initialize the GpuDataManager before we set up the MessageLoops because | 630 // Initialize the GpuDataManager before we set up the MessageLoops because |
| 638 // otherwise we'll trigger the assertion about doing IO on the UI thread. | 631 // otherwise we'll trigger the assertion about doing IO on the UI thread. |
| 639 if (initialize_gpu_data_manager) | 632 if (initialize_gpu_data_manager) |
| 640 GpuDataManagerImpl::GetInstance()->Initialize(); | 633 GpuDataManagerImpl::GetInstance()->Initialize(); |
| 641 } | 634 } |
| 642 | 635 |
| 636 #if !defined(OS_IOS) && (!defined(GOOGLE_CHROME_BUILD) || defined(OS_ANDROID)) |
| 637 // Single-process is an unsupported and not fully tested mode, so |
| 638 // don't enable it for official Chrome builds (except on Android). |
| 639 if (parsed_command_line_.HasSwitch(switches::kSingleProcess)) |
| 640 RenderProcessHost::SetRunRendererInProcess(true); |
| 641 #endif |
| 642 |
| 643 return result_code_; | 643 return result_code_; |
| 644 } | 644 } |
| 645 | 645 |
| 646 void BrowserMainLoop::CreateStartupTasks() { | 646 void BrowserMainLoop::CreateStartupTasks() { |
| 647 TRACE_EVENT0("startup", "BrowserMainLoop::CreateStartupTasks"); | 647 TRACE_EVENT0("startup", "BrowserMainLoop::CreateStartupTasks"); |
| 648 | 648 |
| 649 // First time through, we really want to create all the tasks | 649 // First time through, we really want to create all the tasks |
| 650 if (!startup_task_runner_.get()) { | 650 if (!startup_task_runner_.get()) { |
| 651 #if defined(OS_ANDROID) | 651 #if defined(OS_ANDROID) |
| 652 startup_task_runner_ = make_scoped_ptr(new StartupTaskRunner( | 652 startup_task_runner_ = make_scoped_ptr(new StartupTaskRunner( |
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1274 | 1274 |
| 1275 void BrowserMainLoop::EndStartupTracing() { | 1275 void BrowserMainLoop::EndStartupTracing() { |
| 1276 is_tracing_startup_ = false; | 1276 is_tracing_startup_ = false; |
| 1277 TracingController::GetInstance()->DisableRecording( | 1277 TracingController::GetInstance()->DisableRecording( |
| 1278 TracingController::CreateFileSink( | 1278 TracingController::CreateFileSink( |
| 1279 startup_trace_file_, | 1279 startup_trace_file_, |
| 1280 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); | 1280 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); |
| 1281 } | 1281 } |
| 1282 | 1282 |
| 1283 } // namespace content | 1283 } // namespace content |
| OLD | NEW |