| 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 24 matching lines...) Expand all Loading... |
| 35 #include "content/browser/compositor/software_output_device_mus.h" | 35 #include "content/browser/compositor/software_output_device_mus.h" |
| 36 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 36 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
| 37 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" | 37 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" |
| 38 #include "content/browser/gpu/compositor_util.h" | 38 #include "content/browser/gpu/compositor_util.h" |
| 39 #include "content/browser/gpu/gpu_data_manager_impl.h" | 39 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| 40 #include "content/browser/gpu/gpu_surface_tracker.h" | 40 #include "content/browser/gpu/gpu_surface_tracker.h" |
| 41 #include "content/browser/renderer_host/render_widget_host_impl.h" | 41 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 42 #include "content/common/gpu/client/context_provider_command_buffer.h" | 42 #include "content/common/gpu/client/context_provider_command_buffer.h" |
| 43 #include "content/common/gpu/client/gpu_channel_host.h" | 43 #include "content/common/gpu/client/gpu_channel_host.h" |
| 44 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 44 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
| 45 #include "content/common/gpu/gpu_process_launch_causes.h" | |
| 46 #include "content/common/host_shared_bitmap_manager.h" | 45 #include "content/common/host_shared_bitmap_manager.h" |
| 47 #include "content/public/common/content_switches.h" | 46 #include "content/public/common/content_switches.h" |
| 48 #include "gpu/GLES2/gl2extchromium.h" | 47 #include "gpu/GLES2/gl2extchromium.h" |
| 49 #include "gpu/command_buffer/client/gles2_interface.h" | 48 #include "gpu/command_buffer/client/gles2_interface.h" |
| 50 #include "gpu/command_buffer/common/mailbox.h" | 49 #include "gpu/command_buffer/common/mailbox.h" |
| 50 #include "gpu/ipc/common/gpu_process_launch_causes.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/gfx/geometry/size.h" | 56 #include "ui/gfx/geometry/size.h" |
| 57 | 57 |
| 58 #if defined(MOJO_RUNNER_CLIENT) | 58 #if defined(MOJO_RUNNER_CLIENT) |
| 59 #include "content/common/mojo/mojo_shell_connection_impl.h" | 59 #include "content/common/mojo/mojo_shell_connection_impl.h" |
| 60 #endif | 60 #endif |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 DCHECK(per_compositor_data_.empty()); | 114 DCHECK(per_compositor_data_.empty()); |
| 115 | 115 |
| 116 // Make sure the lost context callback doesn't try to run during destruction. | 116 // Make sure the lost context callback doesn't try to run during destruction. |
| 117 callback_factory_.InvalidateWeakPtrs(); | 117 callback_factory_.InvalidateWeakPtrs(); |
| 118 | 118 |
| 119 task_graph_runner_->Shutdown(); | 119 task_graph_runner_->Shutdown(); |
| 120 } | 120 } |
| 121 | 121 |
| 122 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> | 122 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> |
| 123 GpuProcessTransportFactory::CreateOffscreenCommandBufferContext() { | 123 GpuProcessTransportFactory::CreateOffscreenCommandBufferContext() { |
| 124 CauseForGpuLaunch cause = | 124 gpu::CauseForGpuLaunch cause = gpu:: |
| 125 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE; | 125 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE; |
| 126 scoped_refptr<GpuChannelHost> gpu_channel_host( | 126 scoped_refptr<GpuChannelHost> gpu_channel_host( |
| 127 BrowserGpuChannelHostFactory::instance()->EstablishGpuChannelSync(cause)); | 127 BrowserGpuChannelHostFactory::instance()->EstablishGpuChannelSync(cause)); |
| 128 return CreateContextCommon(gpu_channel_host, gpu::kNullSurfaceHandle); | 128 return CreateContextCommon(gpu_channel_host, gpu::kNullSurfaceHandle); |
| 129 } | 129 } |
| 130 | 130 |
| 131 scoped_ptr<cc::SoftwareOutputDevice> | 131 scoped_ptr<cc::SoftwareOutputDevice> |
| 132 GpuProcessTransportFactory::CreateSoftwareOutputDevice( | 132 GpuProcessTransportFactory::CreateSoftwareOutputDevice( |
| 133 ui::Compositor* compositor) { | 133 ui::Compositor* compositor) { |
| 134 #if defined(MOJO_RUNNER_CLIENT) | 134 #if defined(MOJO_RUNNER_CLIENT) |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 } | 219 } |
| 220 | 220 |
| 221 #if defined(OS_WIN) | 221 #if defined(OS_WIN) |
| 222 gfx::RenderingWindowManager::GetInstance()->UnregisterParent( | 222 gfx::RenderingWindowManager::GetInstance()->UnregisterParent( |
| 223 compositor->widget()); | 223 compositor->widget()); |
| 224 #endif | 224 #endif |
| 225 | 225 |
| 226 bool create_gpu_output_surface = | 226 bool create_gpu_output_surface = |
| 227 ShouldCreateGpuOutputSurface(compositor.get()); | 227 ShouldCreateGpuOutputSurface(compositor.get()); |
| 228 if (create_gpu_output_surface) { | 228 if (create_gpu_output_surface) { |
| 229 CauseForGpuLaunch cause = | 229 gpu::CauseForGpuLaunch cause = gpu:: |
| 230 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE; | 230 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE; |
| 231 BrowserGpuChannelHostFactory::instance()->EstablishGpuChannel( | 231 BrowserGpuChannelHostFactory::instance()->EstablishGpuChannel( |
| 232 cause, base::Bind(&GpuProcessTransportFactory::EstablishedGpuChannel, | 232 cause, base::Bind(&GpuProcessTransportFactory::EstablishedGpuChannel, |
| 233 callback_factory_.GetWeakPtr(), compositor, | 233 callback_factory_.GetWeakPtr(), compositor, |
| 234 create_gpu_output_surface, 0)); | 234 create_gpu_output_surface, 0)); |
| 235 } else { | 235 } else { |
| 236 EstablishedGpuChannel(compositor, create_gpu_output_surface, 0); | 236 EstablishedGpuChannel(compositor, create_gpu_output_surface, 0); |
| 237 } | 237 } |
| 238 } | 238 } |
| 239 | 239 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 } | 306 } |
| 307 | 307 |
| 308 bool created_gpu_browser_compositor = | 308 bool created_gpu_browser_compositor = |
| 309 !!context_provider && !!shared_worker_context_provider_; | 309 !!context_provider && !!shared_worker_context_provider_; |
| 310 | 310 |
| 311 UMA_HISTOGRAM_BOOLEAN("Aura.CreatedGpuBrowserCompositor", | 311 UMA_HISTOGRAM_BOOLEAN("Aura.CreatedGpuBrowserCompositor", |
| 312 created_gpu_browser_compositor); | 312 created_gpu_browser_compositor); |
| 313 | 313 |
| 314 if (!created_gpu_browser_compositor) { | 314 if (!created_gpu_browser_compositor) { |
| 315 // Try again. | 315 // Try again. |
| 316 CauseForGpuLaunch cause = | 316 gpu::CauseForGpuLaunch cause = gpu:: |
| 317 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE; | 317 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE; |
| 318 BrowserGpuChannelHostFactory::instance()->EstablishGpuChannel( | 318 BrowserGpuChannelHostFactory::instance()->EstablishGpuChannel( |
| 319 cause, base::Bind(&GpuProcessTransportFactory::EstablishedGpuChannel, | 319 cause, base::Bind(&GpuProcessTransportFactory::EstablishedGpuChannel, |
| 320 callback_factory_.GetWeakPtr(), compositor, | 320 callback_factory_.GetWeakPtr(), compositor, |
| 321 create_gpu_output_surface, num_attempts + 1)); | 321 create_gpu_output_surface, num_attempts + 1)); |
| 322 return; | 322 return; |
| 323 } | 323 } |
| 324 } | 324 } |
| 325 | 325 |
| 326 scoped_ptr<BrowserCompositorOutputSurface> surface; | 326 scoped_ptr<BrowserCompositorOutputSurface> surface; |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, | 658 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, |
| 659 observer_list_, | 659 observer_list_, |
| 660 OnLostResources()); | 660 OnLostResources()); |
| 661 | 661 |
| 662 // Kill things that use the shared context before killing the shared context. | 662 // Kill things that use the shared context before killing the shared context. |
| 663 lost_gl_helper.reset(); | 663 lost_gl_helper.reset(); |
| 664 lost_shared_main_thread_contexts = NULL; | 664 lost_shared_main_thread_contexts = NULL; |
| 665 } | 665 } |
| 666 | 666 |
| 667 } // namespace content | 667 } // namespace content |
| OLD | NEW |