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/android/in_process/synchronous_compositor_factory_impl
.h" | 5 #include "content/browser/android/in_process/synchronous_compositor_factory_impl
.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/observer_list.h" | 8 #include "base/observer_list.h" |
9 #include "base/sys_info.h" | 9 #include "base/sys_info.h" |
10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
11 #include "content/browser/android/in_process/context_provider_in_process.h" | 11 #include "content/browser/android/in_process/context_provider_in_process.h" |
| 12 #include "content/browser/android/in_process/synchronous_compositor_context_prov
ider.h" |
12 #include "content/browser/android/in_process/synchronous_compositor_external_beg
in_frame_source.h" | 13 #include "content/browser/android/in_process/synchronous_compositor_external_beg
in_frame_source.h" |
13 #include "content/browser/android/in_process/synchronous_compositor_impl.h" | 14 #include "content/browser/android/in_process/synchronous_compositor_impl.h" |
14 #include "content/browser/android/in_process/synchronous_compositor_output_surfa
ce.h" | 15 #include "content/browser/android/in_process/synchronous_compositor_output_surfa
ce.h" |
15 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" | 16 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" |
16 #include "content/common/gpu/client/context_provider_command_buffer.h" | |
17 #include "content/common/gpu/client/gpu_channel_host.h" | 17 #include "content/common/gpu/client/gpu_channel_host.h" |
18 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 18 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
19 #include "content/gpu/in_process_gpu_thread.h" | 19 #include "content/gpu/in_process_gpu_thread.h" |
20 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
21 #include "content/public/browser/gpu_data_manager.h" | 21 #include "content/public/browser/gpu_data_manager.h" |
22 #include "content/renderer/gpu/frame_swap_message_queue.h" | 22 #include "content/renderer/gpu/frame_swap_message_queue.h" |
23 #include "content/renderer/render_thread_impl.h" | 23 #include "content/renderer/render_thread_impl.h" |
24 #include "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h" | 24 #include "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h" |
25 #include "gpu/command_buffer/client/gl_in_process_context.h" | 25 #include "gpu/command_buffer/client/gl_in_process_context.h" |
26 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 26 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 // because 16bit texture is not supported. | 215 // because 16bit texture is not supported. |
216 unsigned int mapped_memory_reclaim_limit = | 216 unsigned int mapped_memory_reclaim_limit = |
217 (base::SysInfo::IsLowEndDevice() ? 2 : 6) * 1024 * 1024; | 217 (base::SysInfo::IsLowEndDevice() ? 2 : 6) * 1024 * 1024; |
218 blink::WebGraphicsContext3D::Attributes attributes = GetDefaultAttribs(); | 218 blink::WebGraphicsContext3D::Attributes attributes = GetDefaultAttribs(); |
219 | 219 |
220 if (use_ipc_command_buffer_) { | 220 if (use_ipc_command_buffer_) { |
221 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits mem_limits; | 221 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits mem_limits; |
222 mem_limits.mapped_memory_reclaim_limit = mapped_memory_reclaim_limit; | 222 mem_limits.mapped_memory_reclaim_limit = mapped_memory_reclaim_limit; |
223 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context = | 223 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context = |
224 CreateContext3D(surface_id, GetDefaultAttribs(), mem_limits); | 224 CreateContext3D(surface_id, GetDefaultAttribs(), mem_limits); |
225 return ContextProviderCommandBuffer::Create(context.Pass(), type); | 225 return make_scoped_refptr( |
| 226 new SynchronousCompositorContextProvider(context.Pass(), type)); |
226 } | 227 } |
227 | 228 |
228 gpu::GLInProcessContextSharedMemoryLimits mem_limits; | 229 gpu::GLInProcessContextSharedMemoryLimits mem_limits; |
229 mem_limits.mapped_memory_reclaim_limit = mapped_memory_reclaim_limit; | 230 mem_limits.mapped_memory_reclaim_limit = mapped_memory_reclaim_limit; |
230 ContextHolder holder = | 231 ContextHolder holder = |
231 CreateContextHolder(attributes, GpuThreadService(), mem_limits, true); | 232 CreateContextHolder(attributes, GpuThreadService(), mem_limits, true); |
232 return ContextProviderInProcess::Create(holder.command_buffer.Pass(), | 233 return ContextProviderInProcess::Create(holder.command_buffer.Pass(), |
233 "Child-Compositor"); | 234 "Child-Compositor"); |
234 } | 235 } |
235 | 236 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 void SynchronousCompositorFactoryImpl::SetRecordFullDocument( | 349 void SynchronousCompositorFactoryImpl::SetRecordFullDocument( |
349 bool record_full_document) { | 350 bool record_full_document) { |
350 record_full_layer_ = record_full_document; | 351 record_full_layer_ = record_full_document; |
351 } | 352 } |
352 | 353 |
353 void SynchronousCompositorFactoryImpl::SetUseIpcCommandBuffer() { | 354 void SynchronousCompositorFactoryImpl::SetUseIpcCommandBuffer() { |
354 use_ipc_command_buffer_ = true; | 355 use_ipc_command_buffer_ = true; |
355 } | 356 } |
356 | 357 |
357 } // namespace content | 358 } // namespace content |
OLD | NEW |