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

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

Issue 916723002: cc: Add threaded GPU rasterization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Implement ContextProviderInProcess::DetachFromThread(). 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
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/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"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 gpu_preference, 60 gpu_preference,
61 gpu::GLInProcessContextSharedMemoryLimits(), 61 gpu::GLInProcessContextSharedMemoryLimits(),
62 nullptr, 62 nullptr,
63 nullptr)); 63 nullptr));
64 return context.Pass(); 64 return context.Pass();
65 } 65 }
66 66
67 scoped_ptr<gpu::GLInProcessContext> CreateContext( 67 scoped_ptr<gpu::GLInProcessContext> CreateContext(
68 scoped_refptr<gpu::InProcessCommandBuffer::Service> service, 68 scoped_refptr<gpu::InProcessCommandBuffer::Service> service,
69 const gpu::GLInProcessContextSharedMemoryLimits& mem_limits, 69 const gpu::GLInProcessContextSharedMemoryLimits& mem_limits,
70 bool is_offscreen) { 70 bool is_offscreen,
71 bool share_resources) {
71 const gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu; 72 const gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu;
72 gpu::gles2::ContextCreationAttribHelper in_process_attribs; 73 gpu::gles2::ContextCreationAttribHelper in_process_attribs;
73 WebGraphicsContext3DImpl::ConvertAttributes( 74 WebGraphicsContext3DImpl::ConvertAttributes(
74 GetDefaultAttribs(), &in_process_attribs); 75 GetDefaultAttribs(), &in_process_attribs);
75 in_process_attribs.lose_context_when_out_of_memory = true; 76 in_process_attribs.lose_context_when_out_of_memory = true;
76 77
77 scoped_ptr<gpu::GLInProcessContext> context(gpu::GLInProcessContext::Create( 78 scoped_ptr<gpu::GLInProcessContext> context(gpu::GLInProcessContext::Create(
78 service, 79 service,
79 NULL /* surface */, 80 NULL /* surface */,
80 is_offscreen, 81 is_offscreen,
81 gfx::kNullAcceleratedWidget, 82 gfx::kNullAcceleratedWidget,
82 gfx::Size(1, 1), 83 gfx::Size(1, 1),
83 NULL /* share_context */, 84 NULL /* share_context */,
84 false /* share_resources */, 85 share_resources /* share_resources */,
85 in_process_attribs, 86 in_process_attribs,
86 gpu_preference, 87 gpu_preference,
87 mem_limits, 88 mem_limits,
88 nullptr, 89 nullptr,
89 nullptr)); 90 nullptr));
90 return context.Pass(); 91 return context.Pass();
91 } 92 }
92 93
93 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> WrapContext( 94 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> WrapContext(
94 scoped_ptr<gpu::GLInProcessContext> context) { 95 scoped_ptr<gpu::GLInProcessContext> context) {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 scoped_refptr<ContextProviderWebContext> 206 scoped_refptr<ContextProviderWebContext>
206 SynchronousCompositorFactoryImpl::CreateOffscreenContextProvider( 207 SynchronousCompositorFactoryImpl::CreateOffscreenContextProvider(
207 const blink::WebGraphicsContext3D::Attributes& attributes, 208 const blink::WebGraphicsContext3D::Attributes& attributes,
208 const std::string& debug_name) { 209 const std::string& debug_name) {
209 scoped_ptr<gpu::GLInProcessContext> context = 210 scoped_ptr<gpu::GLInProcessContext> context =
210 CreateOffscreenContext(attributes); 211 CreateOffscreenContext(attributes);
211 return webkit::gpu::ContextProviderInProcess::Create( 212 return webkit::gpu::ContextProviderInProcess::Create(
212 WrapContext(context.Pass()), debug_name); 213 WrapContext(context.Pass()), debug_name);
213 } 214 }
214 215
215 scoped_refptr<cc::ContextProvider> SynchronousCompositorFactoryImpl:: 216 scoped_refptr<cc::ContextProvider>
216 CreateOnscreenContextProviderForCompositorThread() { 217 SynchronousCompositorFactoryImpl::CreateContextProviderForCompositor() {
217 DCHECK(service_.get()); 218 DCHECK(service_.get());
218 219
219 gpu::GLInProcessContextSharedMemoryLimits mem_limits; 220 gpu::GLInProcessContextSharedMemoryLimits mem_limits;
220 // This is half of what RenderWidget uses because synchronous compositor 221 // This is half of what RenderWidget uses because synchronous compositor
221 // pipeline is only one frame deep. 222 // pipeline is only one frame deep.
222 mem_limits.mapped_memory_reclaim_limit = 6 * 1024 * 1024; 223 mem_limits.mapped_memory_reclaim_limit = 6 * 1024 * 1024;
223 return webkit::gpu::ContextProviderInProcess::Create( 224 return webkit::gpu::ContextProviderInProcess::Create(
224 WrapContext(CreateContext(nullptr, mem_limits, true)), 225 WrapContext(CreateContext(nullptr, mem_limits, true, true)),
225 "Child-Compositor"); 226 "Child-Compositor");
226 } 227 }
227 228
228 scoped_refptr<StreamTextureFactory> 229 scoped_refptr<StreamTextureFactory>
229 SynchronousCompositorFactoryImpl::CreateStreamTextureFactory(int frame_id) { 230 SynchronousCompositorFactoryImpl::CreateStreamTextureFactory(int frame_id) {
230 scoped_refptr<StreamTextureFactorySynchronousImpl> factory( 231 scoped_refptr<StreamTextureFactorySynchronousImpl> factory(
231 StreamTextureFactorySynchronousImpl::Create( 232 StreamTextureFactorySynchronousImpl::Create(
232 base::Bind( 233 base::Bind(
233 &SynchronousCompositorFactoryImpl::TryCreateStreamTextureFactory, 234 &SynchronousCompositorFactoryImpl::TryCreateStreamTextureFactory,
234 base::Unretained(this)), 235 base::Unretained(this)),
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 return 287 return
287 scoped_refptr<StreamTextureFactorySynchronousImpl::ContextProvider>(); 288 scoped_refptr<StreamTextureFactorySynchronousImpl::ContextProvider>();
288 } 289 }
289 290
290 if (!video_context_provider_.get()) { 291 if (!video_context_provider_.get()) {
291 DCHECK(service_.get()); 292 DCHECK(service_.get());
292 293
293 // This needs to run in on-screen |service_| context due to SurfaceTexture 294 // This needs to run in on-screen |service_| context due to SurfaceTexture
294 // limitations. 295 // limitations.
295 video_context_provider_ = new VideoContextProvider(CreateContext( 296 video_context_provider_ = new VideoContextProvider(CreateContext(
296 service_, gpu::GLInProcessContextSharedMemoryLimits(), false)); 297 service_, gpu::GLInProcessContextSharedMemoryLimits(), false, false));
297 } 298 }
298 return video_context_provider_; 299 return video_context_provider_;
299 } 300 }
300 301
301 void SynchronousCompositorFactoryImpl::SetDeferredGpuService( 302 void SynchronousCompositorFactoryImpl::SetDeferredGpuService(
302 scoped_refptr<gpu::InProcessCommandBuffer::Service> service) { 303 scoped_refptr<gpu::InProcessCommandBuffer::Service> service) {
303 DCHECK(!service_.get()); 304 DCHECK(!service_.get());
304 service_ = service; 305 service_ = service;
305 } 306 }
306 307
307 void SynchronousCompositorFactoryImpl::SetRecordFullDocument( 308 void SynchronousCompositorFactoryImpl::SetRecordFullDocument(
308 bool record_full_document) { 309 bool record_full_document) {
309 record_full_layer_ = record_full_document; 310 record_full_layer_ = record_full_document;
310 } 311 }
311 312
312 } // namespace content 313 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698