Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Side by Side Diff: content/browser/compositor/gpu_process_transport_factory.cc

Issue 1991953002: Implement a runtime headless mode for Linux (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/browser_main_loop.cc ('k') | content/browser/gpu/gpu_process_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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"
58 59
59 #if defined(USE_AURA) 60 #if defined(USE_AURA)
60 #include "content/browser/compositor/mus_browser_compositor_output_surface.h" 61 #include "content/browser/compositor/mus_browser_compositor_output_surface.h"
61 #include "content/public/common/service_manager_connection.h" 62 #include "content/public/common/service_manager_connection.h"
62 #include "ui/aura/window_tree_host.h" 63 #include "ui/aura/window_tree_host.h"
63 #endif 64 #endif
64 65
65 #if defined(OS_WIN) 66 #if defined(OS_WIN)
66 #include "content/browser/compositor/software_output_device_win.h" 67 #include "content/browser/compositor/software_output_device_win.h"
67 #include "ui/gfx/win/rendering_window_manager.h" 68 #include "ui/gfx/win/rendering_window_manager.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 190
190 // Make sure the lost context callback doesn't try to run during destruction. 191 // Make sure the lost context callback doesn't try to run during destruction.
191 callback_factory_.InvalidateWeakPtrs(); 192 callback_factory_.InvalidateWeakPtrs();
192 193
193 task_graph_runner_->Shutdown(); 194 task_graph_runner_->Shutdown();
194 } 195 }
195 196
196 std::unique_ptr<cc::SoftwareOutputDevice> 197 std::unique_ptr<cc::SoftwareOutputDevice>
197 GpuProcessTransportFactory::CreateSoftwareOutputDevice( 198 GpuProcessTransportFactory::CreateSoftwareOutputDevice(
198 ui::Compositor* compositor) { 199 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
199 #if defined(USE_AURA) 204 #if defined(USE_AURA)
200 if (service_manager::ServiceManagerIsRemote()) { 205 if (service_manager::ServiceManagerIsRemote()) {
201 NOTREACHED(); 206 NOTREACHED();
202 return nullptr; 207 return nullptr;
203 } 208 }
204 #endif 209 #endif
205 210
206 #if defined(OS_WIN) 211 #if defined(OS_WIN)
207 return std::unique_ptr<cc::SoftwareOutputDevice>( 212 return std::unique_ptr<cc::SoftwareOutputDevice>(
208 new SoftwareOutputDeviceWin(software_backing_.get(), compositor)); 213 new SoftwareOutputDeviceWin(software_backing_.get(), compositor));
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 } 258 }
254 #elif defined(OS_ANDROID) 259 #elif defined(OS_ANDROID)
255 validator.reset( 260 validator.reset(
256 new display_compositor::CompositorOverlayCandidateValidatorAndroid()); 261 new display_compositor::CompositorOverlayCandidateValidatorAndroid());
257 #endif 262 #endif
258 263
259 return validator; 264 return validator;
260 } 265 }
261 266
262 static bool ShouldCreateGpuCompositorFrameSink(ui::Compositor* compositor) { 267 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
263 #if defined(OS_CHROMEOS) 272 #if defined(OS_CHROMEOS)
264 // Software fallback does not happen on Chrome OS. 273 // Software fallback does not happen on Chrome OS.
265 return true; 274 return true;
266 #endif 275 #endif
267 if (IsUsingMus()) 276 if (IsUsingMus())
268 return true; 277 return true;
269 278
270 #if defined(OS_WIN) 279 #if defined(OS_WIN)
271 if (::GetProp(compositor->widget(), kForceSoftwareCompositor) && 280 if (::GetProp(compositor->widget(), kForceSoftwareCompositor) &&
272 ::RemoveProp(compositor->widget(), kForceSoftwareCompositor)) 281 ::RemoveProp(compositor->widget(), kForceSoftwareCompositor))
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 shared_vulkan_context_provider_ = 889 shared_vulkan_context_provider_ =
881 cc::VulkanInProcessContextProvider::Create(); 890 cc::VulkanInProcessContextProvider::Create();
882 } 891 }
883 892
884 shared_vulkan_context_provider_initialized_ = true; 893 shared_vulkan_context_provider_initialized_ = true;
885 } 894 }
886 return shared_vulkan_context_provider_; 895 return shared_vulkan_context_provider_;
887 } 896 }
888 897
889 } // namespace content 898 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_main_loop.cc ('k') | content/browser/gpu/gpu_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698