OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/compositor/gpu_process_transport_factory.h" | 5 #include "content/browser/compositor/gpu_process_transport_factory.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 #include "gpu/command_buffer/common/mailbox.h" | 48 #include "gpu/command_buffer/common/mailbox.h" |
49 #include "gpu/ipc/client/gpu_channel_host.h" | 49 #include "gpu/ipc/client/gpu_channel_host.h" |
50 #include "services/service_manager/runner/common/client_util.h" | 50 #include "services/service_manager/runner/common/client_util.h" |
51 #include "third_party/khronos/GLES2/gl2.h" | 51 #include "third_party/khronos/GLES2/gl2.h" |
52 #include "ui/compositor/compositor.h" | 52 #include "ui/compositor/compositor.h" |
53 #include "ui/compositor/compositor_constants.h" | 53 #include "ui/compositor/compositor_constants.h" |
54 #include "ui/compositor/compositor_switches.h" | 54 #include "ui/compositor/compositor_switches.h" |
55 #include "ui/compositor/layer.h" | 55 #include "ui/compositor/layer.h" |
56 #include "ui/display/types/display_snapshot.h" | 56 #include "ui/display/types/display_snapshot.h" |
57 #include "ui/gfx/geometry/size.h" | 57 #include "ui/gfx/geometry/size.h" |
58 #include "ui/gfx/switches.h" | |
59 | 58 |
60 #if defined(USE_AURA) | 59 #if defined(USE_AURA) |
61 #include "content/browser/compositor/mus_browser_compositor_output_surface.h" | 60 #include "content/browser/compositor/mus_browser_compositor_output_surface.h" |
62 #include "content/public/common/service_manager_connection.h" | 61 #include "content/public/common/service_manager_connection.h" |
63 #include "ui/aura/window_tree_host.h" | 62 #include "ui/aura/window_tree_host.h" |
64 #endif | 63 #endif |
65 | 64 |
66 #if defined(OS_WIN) | 65 #if defined(OS_WIN) |
67 #include "content/browser/compositor/software_output_device_win.h" | 66 #include "content/browser/compositor/software_output_device_win.h" |
68 #include "ui/gfx/win/rendering_window_manager.h" | 67 #include "ui/gfx/win/rendering_window_manager.h" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 189 |
191 // Make sure the lost context callback doesn't try to run during destruction. | 190 // Make sure the lost context callback doesn't try to run during destruction. |
192 callback_factory_.InvalidateWeakPtrs(); | 191 callback_factory_.InvalidateWeakPtrs(); |
193 | 192 |
194 task_graph_runner_->Shutdown(); | 193 task_graph_runner_->Shutdown(); |
195 } | 194 } |
196 | 195 |
197 std::unique_ptr<cc::SoftwareOutputDevice> | 196 std::unique_ptr<cc::SoftwareOutputDevice> |
198 GpuProcessTransportFactory::CreateSoftwareOutputDevice( | 197 GpuProcessTransportFactory::CreateSoftwareOutputDevice( |
199 ui::Compositor* compositor) { | 198 ui::Compositor* compositor) { |
200 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | |
201 if (command_line->HasSwitch(switches::kHeadless)) | |
202 return base::WrapUnique(new cc::SoftwareOutputDevice); | |
203 | |
204 #if defined(USE_AURA) | 199 #if defined(USE_AURA) |
205 if (service_manager::ServiceManagerIsRemote()) { | 200 if (service_manager::ServiceManagerIsRemote()) { |
206 NOTREACHED(); | 201 NOTREACHED(); |
207 return nullptr; | 202 return nullptr; |
208 } | 203 } |
209 #endif | 204 #endif |
210 | 205 |
211 #if defined(OS_WIN) | 206 #if defined(OS_WIN) |
212 return std::unique_ptr<cc::SoftwareOutputDevice>( | 207 return std::unique_ptr<cc::SoftwareOutputDevice>( |
213 new SoftwareOutputDeviceWin(software_backing_.get(), compositor)); | 208 new SoftwareOutputDeviceWin(software_backing_.get(), compositor)); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 } | 253 } |
259 #elif defined(OS_ANDROID) | 254 #elif defined(OS_ANDROID) |
260 validator.reset( | 255 validator.reset( |
261 new display_compositor::CompositorOverlayCandidateValidatorAndroid()); | 256 new display_compositor::CompositorOverlayCandidateValidatorAndroid()); |
262 #endif | 257 #endif |
263 | 258 |
264 return validator; | 259 return validator; |
265 } | 260 } |
266 | 261 |
267 static bool ShouldCreateGpuCompositorFrameSink(ui::Compositor* compositor) { | 262 static bool ShouldCreateGpuCompositorFrameSink(ui::Compositor* compositor) { |
268 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | |
269 if (command_line->HasSwitch(switches::kHeadless)) | |
270 return false; | |
271 | |
272 #if defined(OS_CHROMEOS) | 263 #if defined(OS_CHROMEOS) |
273 // Software fallback does not happen on Chrome OS. | 264 // Software fallback does not happen on Chrome OS. |
274 return true; | 265 return true; |
275 #endif | 266 #endif |
276 if (IsUsingMus()) | 267 if (IsUsingMus()) |
277 return true; | 268 return true; |
278 | 269 |
279 #if defined(OS_WIN) | 270 #if defined(OS_WIN) |
280 if (::GetProp(compositor->widget(), kForceSoftwareCompositor) && | 271 if (::GetProp(compositor->widget(), kForceSoftwareCompositor) && |
281 ::RemoveProp(compositor->widget(), kForceSoftwareCompositor)) | 272 ::RemoveProp(compositor->widget(), kForceSoftwareCompositor)) |
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 shared_vulkan_context_provider_ = | 880 shared_vulkan_context_provider_ = |
890 cc::VulkanInProcessContextProvider::Create(); | 881 cc::VulkanInProcessContextProvider::Create(); |
891 } | 882 } |
892 | 883 |
893 shared_vulkan_context_provider_initialized_ = true; | 884 shared_vulkan_context_provider_initialized_ = true; |
894 } | 885 } |
895 return shared_vulkan_context_provider_; | 886 return shared_vulkan_context_provider_; |
896 } | 887 } |
897 | 888 |
898 } // namespace content | 889 } // namespace content |
OLD | NEW |