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 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 10 matching lines...) Expand all Loading... | |
21 #include "cc/surfaces/onscreen_display_client.h" | 21 #include "cc/surfaces/onscreen_display_client.h" |
22 #include "cc/surfaces/surface_display_output_surface.h" | 22 #include "cc/surfaces/surface_display_output_surface.h" |
23 #include "cc/surfaces/surface_manager.h" | 23 #include "cc/surfaces/surface_manager.h" |
24 #include "content/browser/compositor/browser_compositor_output_surface.h" | 24 #include "content/browser/compositor/browser_compositor_output_surface.h" |
25 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida tor.h" | 25 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida tor.h" |
26 #include "content/browser/compositor/gpu_browser_compositor_output_surface.h" | 26 #include "content/browser/compositor/gpu_browser_compositor_output_surface.h" |
27 #include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_s urface.h" | 27 #include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_s urface.h" |
28 #include "content/browser/compositor/offscreen_browser_compositor_output_surface .h" | 28 #include "content/browser/compositor/offscreen_browser_compositor_output_surface .h" |
29 #include "content/browser/compositor/reflector_impl.h" | 29 #include "content/browser/compositor/reflector_impl.h" |
30 #include "content/browser/compositor/software_browser_compositor_output_surface. h" | 30 #include "content/browser/compositor/software_browser_compositor_output_surface. h" |
31 #include "content/browser/compositor/software_output_device_mus.h" | |
31 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 32 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
32 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" | 33 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" |
33 #include "content/browser/gpu/compositor_util.h" | 34 #include "content/browser/gpu/compositor_util.h" |
34 #include "content/browser/gpu/gpu_data_manager_impl.h" | 35 #include "content/browser/gpu/gpu_data_manager_impl.h" |
35 #include "content/browser/gpu/gpu_surface_tracker.h" | 36 #include "content/browser/gpu/gpu_surface_tracker.h" |
36 #include "content/browser/renderer_host/render_widget_host_impl.h" | 37 #include "content/browser/renderer_host/render_widget_host_impl.h" |
37 #include "content/common/gpu/client/context_provider_command_buffer.h" | 38 #include "content/common/gpu/client/context_provider_command_buffer.h" |
38 #include "content/common/gpu/client/gl_helper.h" | 39 #include "content/common/gpu/client/gl_helper.h" |
39 #include "content/common/gpu/client/gpu_channel_host.h" | 40 #include "content/common/gpu/client/gpu_channel_host.h" |
40 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 41 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE; | 142 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE; |
142 scoped_refptr<GpuChannelHost> gpu_channel_host( | 143 scoped_refptr<GpuChannelHost> gpu_channel_host( |
143 BrowserGpuChannelHostFactory::instance()->EstablishGpuChannelSync(cause)); | 144 BrowserGpuChannelHostFactory::instance()->EstablishGpuChannelSync(cause)); |
144 return CreateContextCommon(gpu_channel_host, 0); | 145 return CreateContextCommon(gpu_channel_host, 0); |
145 #endif // OS_ANDROID | 146 #endif // OS_ANDROID |
146 } | 147 } |
147 | 148 |
148 scoped_ptr<cc::SoftwareOutputDevice> | 149 scoped_ptr<cc::SoftwareOutputDevice> |
149 GpuProcessTransportFactory::CreateSoftwareOutputDevice( | 150 GpuProcessTransportFactory::CreateSoftwareOutputDevice( |
150 ui::Compositor* compositor) { | 151 ui::Compositor* compositor) { |
152 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | |
153 "mojo-platform-channel-handle")) { | |
Fady Samuel
2015/11/13 02:18:02
nit: constant? Maybe in content_switches.h
rjkroege
2015/11/13 03:10:43
It doesn't belong there. It requires refactoring m
Ben Goodger (Google)
2015/11/13 03:29:35
I'm going to do this tonight/tomorrow. I'll stuff
| |
154 return scoped_ptr<cc::SoftwareOutputDevice>( | |
155 new SoftwareOutputDeviceMus(compositor)); | |
156 } | |
157 | |
151 #if defined(OS_WIN) | 158 #if defined(OS_WIN) |
152 return scoped_ptr<cc::SoftwareOutputDevice>( | 159 return scoped_ptr<cc::SoftwareOutputDevice>( |
153 new SoftwareOutputDeviceWin(software_backing_.get(), compositor)); | 160 new SoftwareOutputDeviceWin(software_backing_.get(), compositor)); |
154 #elif defined(USE_OZONE) | 161 #elif defined(USE_OZONE) |
155 return scoped_ptr<cc::SoftwareOutputDevice>(new SoftwareOutputDeviceOzone( | 162 return scoped_ptr<cc::SoftwareOutputDevice>(new SoftwareOutputDeviceOzone( |
156 compositor)); | 163 compositor)); |
157 #elif defined(USE_X11) | 164 #elif defined(USE_X11) |
158 return scoped_ptr<cc::SoftwareOutputDevice>(new SoftwareOutputDeviceX11( | 165 return scoped_ptr<cc::SoftwareOutputDevice>(new SoftwareOutputDeviceX11( |
159 compositor)); | 166 compositor)); |
160 #elif defined(OS_MACOSX) | 167 #elif defined(OS_MACOSX) |
(...skipping 24 matching lines...) Expand all Loading... | |
185 // Overlays are only supported through the remote layer API. | 192 // Overlays are only supported through the remote layer API. |
186 if (ui::RemoteLayerAPISupported()) { | 193 if (ui::RemoteLayerAPISupported()) { |
187 return make_scoped_ptr( | 194 return make_scoped_ptr( |
188 new BrowserCompositorOverlayCandidateValidatorMac(widget)); | 195 new BrowserCompositorOverlayCandidateValidatorMac(widget)); |
189 } | 196 } |
190 #endif | 197 #endif |
191 return scoped_ptr<BrowserCompositorOverlayCandidateValidator>(); | 198 return scoped_ptr<BrowserCompositorOverlayCandidateValidator>(); |
192 } | 199 } |
193 | 200 |
194 static bool ShouldCreateGpuOutputSurface(ui::Compositor* compositor) { | 201 static bool ShouldCreateGpuOutputSurface(ui::Compositor* compositor) { |
202 // Chrome running as a mojo app currently can only use software compositing. | |
203 // TODO(rjkroege): http://crbug.com/548451 | |
204 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | |
205 "mojo-platform-channel-handle")) { | |
206 return false; | |
207 } | |
208 | |
195 #if defined(OS_CHROMEOS) | 209 #if defined(OS_CHROMEOS) |
196 // Software fallback does not happen on Chrome OS. | 210 // Software fallback does not happen on Chrome OS. |
197 return true; | 211 return true; |
198 #endif | 212 #endif |
199 | 213 |
200 #if defined(OS_WIN) | 214 #if defined(OS_WIN) |
201 if (::GetProp(compositor->widget(), kForceSoftwareCompositor) && | 215 if (::GetProp(compositor->widget(), kForceSoftwareCompositor) && |
202 ::RemoveProp(compositor->widget(), kForceSoftwareCompositor)) | 216 ::RemoveProp(compositor->widget(), kForceSoftwareCompositor)) |
203 return false; | 217 return false; |
204 #endif | 218 #endif |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
652 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, | 666 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, |
653 observer_list_, | 667 observer_list_, |
654 OnLostResources()); | 668 OnLostResources()); |
655 | 669 |
656 // Kill things that use the shared context before killing the shared context. | 670 // Kill things that use the shared context before killing the shared context. |
657 lost_gl_helper.reset(); | 671 lost_gl_helper.reset(); |
658 lost_shared_main_thread_contexts = NULL; | 672 lost_shared_main_thread_contexts = NULL; |
659 } | 673 } |
660 | 674 |
661 } // namespace content | 675 } // namespace content |
OLD | NEW |