Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: content/browser/android/in_process/synchronous_compositor_factory_impl.cc

Issue 769703005: Move AW renderer compositor context to gpu thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | gpu/command_buffer/service/async_pixel_transfer_manager_android.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/observer_list.h" 8 #include "base/observer_list.h"
8 #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"
9 #include "content/browser/android/in_process/synchronous_compositor_impl.h" 10 #include "content/browser/android/in_process/synchronous_compositor_impl.h"
10 #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"
11 #include "content/public/browser/browser_thread.h" 12 #include "content/public/browser/browser_thread.h"
12 #include "content/renderer/gpu/frame_swap_message_queue.h" 13 #include "content/renderer/gpu/frame_swap_message_queue.h"
13 #include "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h" 14 #include "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h"
14 #include "gpu/command_buffer/client/gl_in_process_context.h" 15 #include "gpu/command_buffer/client/gl_in_process_context.h"
15 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 16 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
17 #include "gpu/command_buffer/service/gpu_switches.h"
16 #include "ui/gl/android/surface_texture.h" 18 #include "ui/gl/android/surface_texture.h"
17 #include "ui/gl/gl_surface.h" 19 #include "ui/gl/gl_surface.h"
18 #include "ui/gl/gl_surface_stub.h" 20 #include "ui/gl/gl_surface_stub.h"
19 #include "webkit/common/gpu/context_provider_in_process.h" 21 #include "webkit/common/gpu/context_provider_in_process.h"
20 22
21 using cc_blink::ContextProviderWebContext; 23 using cc_blink::ContextProviderWebContext;
22 using gpu_blink::WebGraphicsContext3DImpl; 24 using gpu_blink::WebGraphicsContext3DImpl;
23 using gpu_blink::WebGraphicsContext3DInProcessCommandBufferImpl; 25 using gpu_blink::WebGraphicsContext3DInProcessCommandBufferImpl;
24 26
25 namespace content { 27 namespace content {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 in_process_attribs, 59 in_process_attribs,
58 gpu_preference, 60 gpu_preference,
59 gpu::GLInProcessContextSharedMemoryLimits(), 61 gpu::GLInProcessContextSharedMemoryLimits(),
60 nullptr, 62 nullptr,
61 nullptr)); 63 nullptr));
62 return context.Pass(); 64 return context.Pass();
63 } 65 }
64 66
65 scoped_ptr<gpu::GLInProcessContext> CreateContext( 67 scoped_ptr<gpu::GLInProcessContext> CreateContext(
66 scoped_refptr<gpu::InProcessCommandBuffer::Service> service, 68 scoped_refptr<gpu::InProcessCommandBuffer::Service> service,
67 const gpu::GLInProcessContextSharedMemoryLimits& mem_limits) { 69 const gpu::GLInProcessContextSharedMemoryLimits& mem_limits,
70 bool is_offscreen) {
68 const gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu; 71 const gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu;
69 gpu::gles2::ContextCreationAttribHelper in_process_attribs; 72 gpu::gles2::ContextCreationAttribHelper in_process_attribs;
70 WebGraphicsContext3DImpl::ConvertAttributes( 73 WebGraphicsContext3DImpl::ConvertAttributes(
71 GetDefaultAttribs(), &in_process_attribs); 74 GetDefaultAttribs(), &in_process_attribs);
72 in_process_attribs.lose_context_when_out_of_memory = true; 75 in_process_attribs.lose_context_when_out_of_memory = true;
73 76
74 scoped_ptr<gpu::GLInProcessContext> context(gpu::GLInProcessContext::Create( 77 scoped_ptr<gpu::GLInProcessContext> context(gpu::GLInProcessContext::Create(
75 service, 78 service,
76 NULL /* surface */, 79 NULL /* surface */,
77 false /* is_offscreen */, 80 is_offscreen,
78 gfx::kNullAcceleratedWidget, 81 gfx::kNullAcceleratedWidget,
79 gfx::Size(1, 1), 82 gfx::Size(1, 1),
80 NULL /* share_context */, 83 NULL /* share_context */,
81 false /* share_resources */, 84 false /* share_resources */,
82 in_process_attribs, 85 in_process_attribs,
83 gpu_preference, 86 gpu_preference,
84 mem_limits, 87 mem_limits,
85 nullptr, 88 nullptr,
86 nullptr)); 89 nullptr));
87 return context.Pass(); 90 return context.Pass();
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 215
213 scoped_refptr<cc::ContextProvider> SynchronousCompositorFactoryImpl:: 216 scoped_refptr<cc::ContextProvider> SynchronousCompositorFactoryImpl::
214 CreateOnscreenContextProviderForCompositorThread() { 217 CreateOnscreenContextProviderForCompositorThread() {
215 DCHECK(service_.get()); 218 DCHECK(service_.get());
216 219
217 gpu::GLInProcessContextSharedMemoryLimits mem_limits; 220 gpu::GLInProcessContextSharedMemoryLimits mem_limits;
218 // This is half of what RenderWidget uses because synchronous compositor 221 // This is half of what RenderWidget uses because synchronous compositor
219 // pipeline is only one frame deep. 222 // pipeline is only one frame deep.
220 mem_limits.mapped_memory_reclaim_limit = 6 * 1024 * 1024; 223 mem_limits.mapped_memory_reclaim_limit = 6 * 1024 * 1024;
221 return webkit::gpu::ContextProviderInProcess::Create( 224 return webkit::gpu::ContextProviderInProcess::Create(
222 WrapContext(CreateContext(service_, mem_limits)), 225 WrapContext(CreateContext(nullptr, mem_limits, true)),
223 "Child-Compositor"); 226 "Child-Compositor");
224 } 227 }
225 228
226 scoped_refptr<StreamTextureFactory> 229 scoped_refptr<StreamTextureFactory>
227 SynchronousCompositorFactoryImpl::CreateStreamTextureFactory(int frame_id) { 230 SynchronousCompositorFactoryImpl::CreateStreamTextureFactory(int frame_id) {
228 scoped_refptr<StreamTextureFactorySynchronousImpl> factory( 231 scoped_refptr<StreamTextureFactorySynchronousImpl> factory(
229 StreamTextureFactorySynchronousImpl::Create( 232 StreamTextureFactorySynchronousImpl::Create(
230 base::Bind( 233 base::Bind(
231 &SynchronousCompositorFactoryImpl::TryCreateStreamTextureFactory, 234 &SynchronousCompositorFactoryImpl::TryCreateStreamTextureFactory,
232 base::Unretained(this)), 235 base::Unretained(this)),
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 // |video_context_provider_| to null is also not safe since it makes 284 // |video_context_provider_| to null is also not safe since it makes
282 // synchronous destruction uncontrolled and possibly deadlock. 285 // synchronous destruction uncontrolled and possibly deadlock.
283 if (!CanCreateMainThreadContext()) { 286 if (!CanCreateMainThreadContext()) {
284 return 287 return
285 scoped_refptr<StreamTextureFactorySynchronousImpl::ContextProvider>(); 288 scoped_refptr<StreamTextureFactorySynchronousImpl::ContextProvider>();
286 } 289 }
287 290
288 if (!video_context_provider_.get()) { 291 if (!video_context_provider_.get()) {
289 DCHECK(service_.get()); 292 DCHECK(service_.get());
290 293
291 video_context_provider_ = new VideoContextProvider( 294 // This needs to run in on-screen |service_| context due to SurfaceTexture
292 CreateContext(service_, 295 // limitations.
293 gpu::GLInProcessContextSharedMemoryLimits())); 296 video_context_provider_ = new VideoContextProvider(CreateContext(
297 service_, gpu::GLInProcessContextSharedMemoryLimits(), false));
294 } 298 }
295 return video_context_provider_; 299 return video_context_provider_;
296 } 300 }
297 301
298 void SynchronousCompositorFactoryImpl::SetDeferredGpuService( 302 void SynchronousCompositorFactoryImpl::SetDeferredGpuService(
299 scoped_refptr<gpu::InProcessCommandBuffer::Service> service) { 303 scoped_refptr<gpu::InProcessCommandBuffer::Service> service) {
300 DCHECK(!service_.get()); 304 DCHECK(!service_.get());
301 service_ = service; 305 service_ = service;
302 } 306 }
303 307
304 void SynchronousCompositorFactoryImpl::SetRecordFullDocument( 308 void SynchronousCompositorFactoryImpl::SetRecordFullDocument(
305 bool record_full_document) { 309 bool record_full_document) {
306 record_full_layer_ = record_full_document; 310 record_full_layer_ = record_full_document;
307 } 311 }
308 312
309 } // namespace content 313 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/service/async_pixel_transfer_manager_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698