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 "content/browser/android/in_process/synchronous_compositor_external_beg
in_frame_source.h" | 9 #include "content/browser/android/in_process/synchronous_compositor_external_beg
in_frame_source.h" |
10 #include "content/browser/android/in_process/synchronous_compositor_impl.h" | 10 #include "content/browser/android/in_process/synchronous_compositor_impl.h" |
11 #include "content/browser/android/in_process/synchronous_compositor_output_surfa
ce.h" | 11 #include "content/browser/android/in_process/synchronous_compositor_output_surfa
ce.h" |
12 #include "content/browser/gpu/gpu_data_manager_impl.h" | |
13 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
14 #include "content/renderer/gpu/frame_swap_message_queue.h" | 13 #include "content/renderer/gpu/frame_swap_message_queue.h" |
15 #include "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h" | 14 #include "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h" |
16 #include "gpu/command_buffer/client/gl_in_process_context.h" | 15 #include "gpu/command_buffer/client/gl_in_process_context.h" |
17 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 16 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
18 #include "gpu/command_buffer/service/gpu_switches.h" | 17 #include "gpu/command_buffer/service/gpu_switches.h" |
19 #include "gpu/config/gpu_driver_bug_workaround_type.h" | |
20 #include "ui/gl/android/surface_texture.h" | 18 #include "ui/gl/android/surface_texture.h" |
21 #include "ui/gl/gl_surface.h" | 19 #include "ui/gl/gl_surface.h" |
22 #include "ui/gl/gl_surface_stub.h" | 20 #include "ui/gl/gl_surface_stub.h" |
23 #include "webkit/common/gpu/context_provider_in_process.h" | 21 #include "webkit/common/gpu/context_provider_in_process.h" |
24 | 22 |
25 using cc_blink::ContextProviderWebContext; | 23 using cc_blink::ContextProviderWebContext; |
26 using gpu_blink::WebGraphicsContext3DImpl; | 24 using gpu_blink::WebGraphicsContext3DImpl; |
27 using gpu_blink::WebGraphicsContext3DInProcessCommandBufferImpl; | 25 using gpu_blink::WebGraphicsContext3DInProcessCommandBufferImpl; |
28 | 26 |
29 namespace content { | 27 namespace content { |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 scoped_ptr<gpu::GLInProcessContext> context = | 210 scoped_ptr<gpu::GLInProcessContext> context = |
213 CreateOffscreenContext(attributes); | 211 CreateOffscreenContext(attributes); |
214 return webkit::gpu::ContextProviderInProcess::Create( | 212 return webkit::gpu::ContextProviderInProcess::Create( |
215 WrapContext(context.Pass()), debug_name); | 213 WrapContext(context.Pass()), debug_name); |
216 } | 214 } |
217 | 215 |
218 scoped_refptr<cc::ContextProvider> | 216 scoped_refptr<cc::ContextProvider> |
219 SynchronousCompositorFactoryImpl::CreateContextProviderForCompositor() { | 217 SynchronousCompositorFactoryImpl::CreateContextProviderForCompositor() { |
220 DCHECK(service_.get()); | 218 DCHECK(service_.get()); |
221 | 219 |
222 bool is_offscreen = true; | |
223 scoped_refptr<gpu::InProcessCommandBuffer::Service> service; | |
224 if (GpuDataManagerImpl::GetInstance()->IsDriverBugWorkaroundActive( | |
225 gpu::DISABLE_ANDROID_WEBVIEW_GPU_THREAD)) { | |
226 is_offscreen = false; | |
227 service = service_; | |
228 } | |
229 | |
230 gpu::GLInProcessContextSharedMemoryLimits mem_limits; | 220 gpu::GLInProcessContextSharedMemoryLimits mem_limits; |
231 // This is half of what RenderWidget uses because synchronous compositor | 221 // This is half of what RenderWidget uses because synchronous compositor |
232 // pipeline is only one frame deep. | 222 // pipeline is only one frame deep. |
233 mem_limits.mapped_memory_reclaim_limit = 6 * 1024 * 1024; | 223 mem_limits.mapped_memory_reclaim_limit = 6 * 1024 * 1024; |
234 return webkit::gpu::ContextProviderInProcess::Create( | 224 return webkit::gpu::ContextProviderInProcess::Create( |
235 WrapContext(CreateContext(service, mem_limits, is_offscreen, true)), | 225 WrapContext(CreateContext(nullptr, mem_limits, true, true)), |
236 "Child-Compositor"); | 226 "Child-Compositor"); |
237 } | 227 } |
238 | 228 |
239 scoped_refptr<StreamTextureFactory> | 229 scoped_refptr<StreamTextureFactory> |
240 SynchronousCompositorFactoryImpl::CreateStreamTextureFactory(int frame_id) { | 230 SynchronousCompositorFactoryImpl::CreateStreamTextureFactory(int frame_id) { |
241 scoped_refptr<StreamTextureFactorySynchronousImpl> factory( | 231 scoped_refptr<StreamTextureFactorySynchronousImpl> factory( |
242 StreamTextureFactorySynchronousImpl::Create( | 232 StreamTextureFactorySynchronousImpl::Create( |
243 base::Bind( | 233 base::Bind( |
244 &SynchronousCompositorFactoryImpl::TryCreateStreamTextureFactory, | 234 &SynchronousCompositorFactoryImpl::TryCreateStreamTextureFactory, |
245 base::Unretained(this)), | 235 base::Unretained(this)), |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 DCHECK(!service_.get()); | 304 DCHECK(!service_.get()); |
315 service_ = service; | 305 service_ = service; |
316 } | 306 } |
317 | 307 |
318 void SynchronousCompositorFactoryImpl::SetRecordFullDocument( | 308 void SynchronousCompositorFactoryImpl::SetRecordFullDocument( |
319 bool record_full_document) { | 309 bool record_full_document) { |
320 record_full_layer_ = record_full_document; | 310 record_full_layer_ = record_full_document; |
321 } | 311 } |
322 | 312 |
323 } // namespace content | 313 } // namespace content |
OLD | NEW |