| 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 defined(MOJO_RUNNER_CLIENT) |
| 153 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 154 "mojo-platform-channel-handle")) { |
| 155 return scoped_ptr<cc::SoftwareOutputDevice>( |
| 156 new SoftwareOutputDeviceMus(compositor)); |
| 157 } |
| 158 #endif |
| 159 |
| 151 #if defined(OS_WIN) | 160 #if defined(OS_WIN) |
| 152 return scoped_ptr<cc::SoftwareOutputDevice>( | 161 return scoped_ptr<cc::SoftwareOutputDevice>( |
| 153 new SoftwareOutputDeviceWin(software_backing_.get(), compositor)); | 162 new SoftwareOutputDeviceWin(software_backing_.get(), compositor)); |
| 154 #elif defined(USE_OZONE) | 163 #elif defined(USE_OZONE) |
| 155 return scoped_ptr<cc::SoftwareOutputDevice>(new SoftwareOutputDeviceOzone( | 164 return scoped_ptr<cc::SoftwareOutputDevice>(new SoftwareOutputDeviceOzone( |
| 156 compositor)); | 165 compositor)); |
| 157 #elif defined(USE_X11) | 166 #elif defined(USE_X11) |
| 158 return scoped_ptr<cc::SoftwareOutputDevice>(new SoftwareOutputDeviceX11( | 167 return scoped_ptr<cc::SoftwareOutputDevice>(new SoftwareOutputDeviceX11( |
| 159 compositor)); | 168 compositor)); |
| 160 #elif defined(OS_MACOSX) | 169 #elif defined(OS_MACOSX) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 185 // Overlays are only supported through the remote layer API. | 194 // Overlays are only supported through the remote layer API. |
| 186 if (ui::RemoteLayerAPISupported()) { | 195 if (ui::RemoteLayerAPISupported()) { |
| 187 return make_scoped_ptr( | 196 return make_scoped_ptr( |
| 188 new BrowserCompositorOverlayCandidateValidatorMac(widget)); | 197 new BrowserCompositorOverlayCandidateValidatorMac(widget)); |
| 189 } | 198 } |
| 190 #endif | 199 #endif |
| 191 return scoped_ptr<BrowserCompositorOverlayCandidateValidator>(); | 200 return scoped_ptr<BrowserCompositorOverlayCandidateValidator>(); |
| 192 } | 201 } |
| 193 | 202 |
| 194 static bool ShouldCreateGpuOutputSurface(ui::Compositor* compositor) { | 203 static bool ShouldCreateGpuOutputSurface(ui::Compositor* compositor) { |
| 204 #if defined(MOJO_RUNNER_CLIENT) |
| 205 // Chrome running as a mojo app currently can only use software compositing. |
| 206 // TODO(rjkroege): http://crbug.com/548451 |
| 207 // TODO(rjkroege): Make IsRunningInMojoRunner callable from content. |
| 208 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 209 "mojo-platform-channel-handle")) { |
| 210 return false; |
| 211 } |
| 212 #endif |
| 213 |
| 195 #if defined(OS_CHROMEOS) | 214 #if defined(OS_CHROMEOS) |
| 196 // Software fallback does not happen on Chrome OS. | 215 // Software fallback does not happen on Chrome OS. |
| 197 return true; | 216 return true; |
| 198 #endif | 217 #endif |
| 199 | 218 |
| 200 #if defined(OS_WIN) | 219 #if defined(OS_WIN) |
| 201 if (::GetProp(compositor->widget(), kForceSoftwareCompositor) && | 220 if (::GetProp(compositor->widget(), kForceSoftwareCompositor) && |
| 202 ::RemoveProp(compositor->widget(), kForceSoftwareCompositor)) | 221 ::RemoveProp(compositor->widget(), kForceSoftwareCompositor)) |
| 203 return false; | 222 return false; |
| 204 #endif | 223 #endif |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, | 671 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, |
| 653 observer_list_, | 672 observer_list_, |
| 654 OnLostResources()); | 673 OnLostResources()); |
| 655 | 674 |
| 656 // Kill things that use the shared context before killing the shared context. | 675 // Kill things that use the shared context before killing the shared context. |
| 657 lost_gl_helper.reset(); | 676 lost_gl_helper.reset(); |
| 658 lost_shared_main_thread_contexts = NULL; | 677 lost_shared_main_thread_contexts = NULL; |
| 659 } | 678 } |
| 660 | 679 |
| 661 } // namespace content | 680 } // namespace content |
| OLD | NEW |