Chromium Code Reviews| 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/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 951 LOG(FATAL) << "GLSurface::InitializeOneOff failed"; | 951 LOG(FATAL) << "GLSurface::InitializeOneOff failed"; |
| 952 #endif | 952 #endif |
| 953 | 953 |
| 954 // Initialize the GpuDataManager before we set up the MessageLoops because | 954 // Initialize the GpuDataManager before we set up the MessageLoops because |
| 955 // otherwise we'll trigger the assertion about doing IO on the UI thread. | 955 // otherwise we'll trigger the assertion about doing IO on the UI thread. |
| 956 GpuDataManagerImpl::GetInstance()->Initialize(); | 956 GpuDataManagerImpl::GetInstance()->Initialize(); |
| 957 | 957 |
| 958 bool always_uses_gpu = IsForceCompositingModeEnabled(); | 958 bool always_uses_gpu = IsForceCompositingModeEnabled(); |
| 959 bool established_gpu_channel = false; | 959 bool established_gpu_channel = false; |
| 960 #if defined(USE_AURA) || defined(OS_ANDROID) | 960 #if defined(USE_AURA) || defined(OS_ANDROID) |
| 961 established_gpu_channel = | 961 established_gpu_channel = |
|
no sievers
2014/03/29 20:50:19
Should be initialized to |true| I think.
danakj
2014/03/31 14:40:43
Oh, yah, thanks.
| |
| 962 !parsed_command_line_.HasSwitch(switches::kDisableGpuProcessPrelaunch) || | |
| 963 parsed_command_line_.HasSwitch(switches::kSingleProcess) || | 962 parsed_command_line_.HasSwitch(switches::kSingleProcess) || |
| 964 parsed_command_line_.HasSwitch(switches::kInProcessGPU); | 963 parsed_command_line_.HasSwitch(switches::kInProcessGPU); |
| 965 #if defined(USE_AURA) | 964 #if defined(USE_AURA) |
| 966 if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor()) { | 965 if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor()) { |
| 967 established_gpu_channel = always_uses_gpu = false; | 966 established_gpu_channel = always_uses_gpu = false; |
| 968 } | 967 } |
| 969 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); | 968 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); |
| 970 ImageTransportFactory::Initialize(); | 969 ImageTransportFactory::Initialize(); |
| 971 #elif defined(OS_ANDROID) | 970 #elif defined(OS_ANDROID) |
| 972 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); | 971 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1025 allowed_clipboard_threads.push_back(io_thread_->thread_id()); | 1024 allowed_clipboard_threads.push_back(io_thread_->thread_id()); |
| 1026 #endif | 1025 #endif |
| 1027 ui::Clipboard::SetAllowedThreads(allowed_clipboard_threads); | 1026 ui::Clipboard::SetAllowedThreads(allowed_clipboard_threads); |
| 1028 | 1027 |
| 1029 // When running the GPU thread in-process, avoid optimistically starting it | 1028 // When running the GPU thread in-process, avoid optimistically starting it |
| 1030 // since creating the GPU thread races against creation of the one-and-only | 1029 // since creating the GPU thread races against creation of the one-and-only |
| 1031 // ChildProcess instance which is created by the renderer thread. | 1030 // ChildProcess instance which is created by the renderer thread. |
| 1032 if (GpuDataManagerImpl::GetInstance()->GpuAccessAllowed(NULL) && | 1031 if (GpuDataManagerImpl::GetInstance()->GpuAccessAllowed(NULL) && |
| 1033 !established_gpu_channel && | 1032 !established_gpu_channel && |
| 1034 always_uses_gpu && | 1033 always_uses_gpu && |
| 1035 !parsed_command_line_.HasSwitch(switches::kDisableGpuProcessPrelaunch) && | |
| 1036 !parsed_command_line_.HasSwitch(switches::kSingleProcess) && | 1034 !parsed_command_line_.HasSwitch(switches::kSingleProcess) && |
| 1037 !parsed_command_line_.HasSwitch(switches::kInProcessGPU)) { | 1035 !parsed_command_line_.HasSwitch(switches::kInProcessGPU)) { |
| 1038 TRACE_EVENT_INSTANT0("gpu", "Post task to launch GPU process", | 1036 TRACE_EVENT_INSTANT0("gpu", "Post task to launch GPU process", |
| 1039 TRACE_EVENT_SCOPE_THREAD); | 1037 TRACE_EVENT_SCOPE_THREAD); |
| 1040 BrowserThread::PostTask( | 1038 BrowserThread::PostTask( |
| 1041 BrowserThread::IO, FROM_HERE, base::Bind( | 1039 BrowserThread::IO, FROM_HERE, base::Bind( |
| 1042 base::IgnoreResult(&GpuProcessHost::Get), | 1040 base::IgnoreResult(&GpuProcessHost::Get), |
| 1043 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, | 1041 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, |
| 1044 CAUSE_FOR_GPU_LAUNCH_BROWSER_STARTUP)); | 1042 CAUSE_FOR_GPU_LAUNCH_BROWSER_STARTUP)); |
| 1045 } | 1043 } |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1127 base::TimeDelta::FromSeconds(delay_secs)); | 1125 base::TimeDelta::FromSeconds(delay_secs)); |
| 1128 } | 1126 } |
| 1129 | 1127 |
| 1130 void BrowserMainLoop::EndStartupTracing(const base::FilePath& trace_file) { | 1128 void BrowserMainLoop::EndStartupTracing(const base::FilePath& trace_file) { |
| 1131 is_tracing_startup_ = false; | 1129 is_tracing_startup_ = false; |
| 1132 TracingController::GetInstance()->DisableRecording( | 1130 TracingController::GetInstance()->DisableRecording( |
| 1133 trace_file, TracingController::TracingFileResultCallback()); | 1131 trace_file, TracingController::TracingFileResultCallback()); |
| 1134 } | 1132 } |
| 1135 | 1133 |
| 1136 } // namespace content | 1134 } // namespace content |
| OLD | NEW |