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" |
11 #include "base/location.h" | 11 #include "base/location.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
14 #include "cc/output/compositor_frame.h" | 14 #include "cc/output/compositor_frame.h" |
15 #include "cc/output/output_surface.h" | 15 #include "cc/output/output_surface.h" |
16 #include "content/browser/compositor/browser_compositor_output_surface.h" | 16 #include "content/browser/compositor/browser_compositor_output_surface.h" |
17 #include "content/browser/compositor/browser_compositor_output_surface_proxy.h" | 17 #include "content/browser/compositor/browser_compositor_output_surface_proxy.h" |
18 #include "content/browser/compositor/gpu_browser_compositor_output_surface.h" | 18 #include "content/browser/compositor/gpu_browser_compositor_output_surface.h" |
19 #include "content/browser/compositor/reflector_impl.h" | 19 #include "content/browser/compositor/reflector_impl.h" |
20 #include "content/browser/compositor/software_browser_compositor_output_surface.
h" | 20 #include "content/browser/compositor/software_browser_compositor_output_surface.
h" |
21 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 21 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
22 #include "content/browser/gpu/gpu_data_manager_impl.h" | 22 #include "content/browser/gpu/gpu_data_manager_impl.h" |
23 #include "content/browser/gpu/gpu_surface_tracker.h" | 23 #include "content/browser/gpu/gpu_surface_tracker.h" |
24 #include "content/browser/renderer_host/render_widget_host_impl.h" | 24 #include "content/browser/renderer_host/render_widget_host_impl.h" |
25 #include "content/common/gpu/client/context_provider_command_buffer.h" | 25 #include "content/common/gpu/client/context_provider_command_buffer.h" |
26 #include "content/common/gpu/client/gl_helper.h" | 26 #include "content/common/gpu/client/gl_helper.h" |
27 #include "content/common/gpu/client/gpu_channel_host.h" | 27 #include "content/common/gpu/client/gpu_channel_host.h" |
28 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 28 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
29 #include "content/common/gpu/gpu_process_launch_causes.h" | 29 #include "content/common/gpu/gpu_process_launch_causes.h" |
| 30 #include "content/common/host_shared_bitmap_manager.h" |
30 #include "gpu/GLES2/gl2extchromium.h" | 31 #include "gpu/GLES2/gl2extchromium.h" |
31 #include "gpu/command_buffer/client/gles2_interface.h" | 32 #include "gpu/command_buffer/client/gles2_interface.h" |
32 #include "gpu/command_buffer/common/mailbox.h" | 33 #include "gpu/command_buffer/common/mailbox.h" |
33 #include "third_party/khronos/GLES2/gl2.h" | 34 #include "third_party/khronos/GLES2/gl2.h" |
34 #include "ui/compositor/compositor.h" | 35 #include "ui/compositor/compositor.h" |
35 #include "ui/compositor/compositor_constants.h" | 36 #include "ui/compositor/compositor_constants.h" |
36 #include "ui/compositor/compositor_switches.h" | 37 #include "ui/compositor/compositor_switches.h" |
37 #include "ui/gfx/native_widget_types.h" | 38 #include "ui/gfx/native_widget_types.h" |
38 #include "ui/gfx/size.h" | 39 #include "ui/gfx/size.h" |
39 | 40 |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 // local scoped_ptr. | 211 // local scoped_ptr. |
211 scoped_ptr<GLHelper> helper = gl_helper_.Pass(); | 212 scoped_ptr<GLHelper> helper = gl_helper_.Pass(); |
212 helper.reset(); | 213 helper.reset(); |
213 DCHECK(!gl_helper_) << "Destroying the GLHelper should not cause a new " | 214 DCHECK(!gl_helper_) << "Destroying the GLHelper should not cause a new " |
214 "GLHelper to be created."; | 215 "GLHelper to be created."; |
215 } | 216 } |
216 } | 217 } |
217 | 218 |
218 bool GpuProcessTransportFactory::DoesCreateTestContexts() { return false; } | 219 bool GpuProcessTransportFactory::DoesCreateTestContexts() { return false; } |
219 | 220 |
220 ui::ContextFactory* GpuProcessTransportFactory::AsContextFactory() { | 221 cc::SharedBitmapManager* GpuProcessTransportFactory::GetSharedBitmapManager() { |
221 return this; | 222 return HostSharedBitmapManager::current(); |
222 } | 223 } |
223 | 224 |
224 gfx::GLSurfaceHandle GpuProcessTransportFactory::GetSharedSurfaceHandle() { | 225 gfx::GLSurfaceHandle GpuProcessTransportFactory::GetSharedSurfaceHandle() { |
225 gfx::GLSurfaceHandle handle = gfx::GLSurfaceHandle( | 226 gfx::GLSurfaceHandle handle = gfx::GLSurfaceHandle( |
226 gfx::kNullPluginWindow, gfx::TEXTURE_TRANSPORT); | 227 gfx::kNullPluginWindow, gfx::TEXTURE_TRANSPORT); |
227 handle.parent_client_id = | 228 handle.parent_client_id = |
228 BrowserGpuChannelHostFactory::instance()->GetGpuChannelId(); | 229 BrowserGpuChannelHostFactory::instance()->GetGpuChannelId(); |
229 return handle; | 230 return handle; |
230 } | 231 } |
231 | 232 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, | 349 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, |
349 observer_list_, | 350 observer_list_, |
350 OnLostResources()); | 351 OnLostResources()); |
351 | 352 |
352 // Kill things that use the shared context before killing the shared context. | 353 // Kill things that use the shared context before killing the shared context. |
353 lost_gl_helper.reset(); | 354 lost_gl_helper.reset(); |
354 lost_shared_main_thread_contexts = NULL; | 355 lost_shared_main_thread_contexts = NULL; |
355 } | 356 } |
356 | 357 |
357 } // namespace content | 358 } // namespace content |
OLD | NEW |