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

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

Issue 841773006: Extract WebGraphicsContext3DInProcessCommandBufferImpl from webkit/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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/observer_list.h" 7 #include "base/observer_list.h"
8 #include "content/browser/android/in_process/synchronous_compositor_external_beg in_frame_source.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_impl.h" 9 #include "content/browser/android/in_process/synchronous_compositor_impl.h"
10 #include "content/browser/android/in_process/synchronous_compositor_output_surfa ce.h" 10 #include "content/browser/android/in_process/synchronous_compositor_output_surfa ce.h"
11 #include "content/public/browser/browser_thread.h" 11 #include "content/public/browser/browser_thread.h"
12 #include "content/renderer/gpu/frame_swap_message_queue.h" 12 #include "content/renderer/gpu/frame_swap_message_queue.h"
13 #include "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h"
13 #include "gpu/command_buffer/client/gl_in_process_context.h" 14 #include "gpu/command_buffer/client/gl_in_process_context.h"
14 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 15 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
15 #include "ui/gl/android/surface_texture.h" 16 #include "ui/gl/android/surface_texture.h"
16 #include "ui/gl/gl_surface.h" 17 #include "ui/gl/gl_surface.h"
17 #include "ui/gl/gl_surface_stub.h" 18 #include "ui/gl/gl_surface_stub.h"
18 #include "webkit/common/gpu/context_provider_in_process.h" 19 #include "webkit/common/gpu/context_provider_in_process.h"
19 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl. h"
20 20
21 using gpu_blink::WebGraphicsContext3DImpl;
22 using gpu_blink::WebGraphicsContext3DInProcessCommandBufferImpl;
21 using webkit::gpu::ContextProviderWebContext; 23 using webkit::gpu::ContextProviderWebContext;
22 24
23 namespace content { 25 namespace content {
24 26
25 namespace { 27 namespace {
26 28
27 blink::WebGraphicsContext3D::Attributes GetDefaultAttribs() { 29 blink::WebGraphicsContext3D::Attributes GetDefaultAttribs() {
28 blink::WebGraphicsContext3D::Attributes attributes; 30 blink::WebGraphicsContext3D::Attributes attributes;
29 attributes.antialias = false; 31 attributes.antialias = false;
30 attributes.depth = false; 32 attributes.depth = false;
31 attributes.stencil = false; 33 attributes.stencil = false;
32 attributes.shareResources = true; 34 attributes.shareResources = true;
33 attributes.noAutomaticFlushes = true; 35 attributes.noAutomaticFlushes = true;
34 36
35 return attributes; 37 return attributes;
36 } 38 }
37 39
38 using gpu_blink::WebGraphicsContext3DImpl;
39 using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl;
40
41 scoped_ptr<gpu::GLInProcessContext> CreateOffscreenContext( 40 scoped_ptr<gpu::GLInProcessContext> CreateOffscreenContext(
42 const blink::WebGraphicsContext3D::Attributes& attributes) { 41 const blink::WebGraphicsContext3D::Attributes& attributes) {
43 const gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu; 42 const gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu;
44 43
45 gpu::gles2::ContextCreationAttribHelper in_process_attribs; 44 gpu::gles2::ContextCreationAttribHelper in_process_attribs;
46 WebGraphicsContext3DImpl::ConvertAttributes( 45 WebGraphicsContext3DImpl::ConvertAttributes(
47 attributes, &in_process_attribs); 46 attributes, &in_process_attribs);
48 in_process_attribs.lose_context_when_out_of_memory = true; 47 in_process_attribs.lose_context_when_out_of_memory = true;
49 48
50 scoped_ptr<gpu::GLInProcessContext> context(gpu::GLInProcessContext::Create( 49 scoped_ptr<gpu::GLInProcessContext> context(gpu::GLInProcessContext::Create(
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 friend class base::RefCountedThreadSafe<VideoContextProvider>; 152 friend class base::RefCountedThreadSafe<VideoContextProvider>;
154 virtual ~VideoContextProvider() {} 153 virtual ~VideoContextProvider() {}
155 154
156 scoped_refptr<cc::ContextProvider> context_provider_; 155 scoped_refptr<cc::ContextProvider> context_provider_;
157 gpu::GLInProcessContext* gl_in_process_context_; 156 gpu::GLInProcessContext* gl_in_process_context_;
158 ObserverList<StreamTextureFactoryContextObserver> observer_list_; 157 ObserverList<StreamTextureFactoryContextObserver> observer_list_;
159 158
160 DISALLOW_COPY_AND_ASSIGN(VideoContextProvider); 159 DISALLOW_COPY_AND_ASSIGN(VideoContextProvider);
161 }; 160 };
162 161
163 using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl;
164 162
165 SynchronousCompositorFactoryImpl::SynchronousCompositorFactoryImpl() 163 SynchronousCompositorFactoryImpl::SynchronousCompositorFactoryImpl()
166 : record_full_layer_(true), 164 : record_full_layer_(true),
167 num_hardware_compositors_(0) { 165 num_hardware_compositors_(0) {
168 SynchronousCompositorFactory::SetInstance(this); 166 SynchronousCompositorFactory::SetInstance(this);
169 } 167 }
170 168
171 SynchronousCompositorFactoryImpl::~SynchronousCompositorFactoryImpl() {} 169 SynchronousCompositorFactoryImpl::~SynchronousCompositorFactoryImpl() {}
172 170
173 scoped_refptr<base::MessageLoopProxy> 171 scoped_refptr<base::MessageLoopProxy>
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 SynchronousCompositorFactoryImpl::CreateStreamTextureFactory(int frame_id) { 227 SynchronousCompositorFactoryImpl::CreateStreamTextureFactory(int frame_id) {
230 scoped_refptr<StreamTextureFactorySynchronousImpl> factory( 228 scoped_refptr<StreamTextureFactorySynchronousImpl> factory(
231 StreamTextureFactorySynchronousImpl::Create( 229 StreamTextureFactorySynchronousImpl::Create(
232 base::Bind( 230 base::Bind(
233 &SynchronousCompositorFactoryImpl::TryCreateStreamTextureFactory, 231 &SynchronousCompositorFactoryImpl::TryCreateStreamTextureFactory,
234 base::Unretained(this)), 232 base::Unretained(this)),
235 frame_id)); 233 frame_id));
236 return factory; 234 return factory;
237 } 235 }
238 236
239 webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl* 237 WebGraphicsContext3DInProcessCommandBufferImpl*
240 SynchronousCompositorFactoryImpl::CreateOffscreenGraphicsContext3D( 238 SynchronousCompositorFactoryImpl::CreateOffscreenGraphicsContext3D(
241 const blink::WebGraphicsContext3D::Attributes& attributes) { 239 const blink::WebGraphicsContext3D::Attributes& attributes) {
242 return WrapContextWithAttributes(CreateOffscreenContext(attributes), 240 return WrapContextWithAttributes(CreateOffscreenContext(attributes),
243 attributes).release(); 241 attributes).release();
244 } 242 }
245 243
246 void SynchronousCompositorFactoryImpl::CompositorInitializedHardwareDraw() { 244 void SynchronousCompositorFactoryImpl::CompositorInitializedHardwareDraw() {
247 base::AutoLock lock(num_hardware_compositor_lock_); 245 base::AutoLock lock(num_hardware_compositor_lock_);
248 num_hardware_compositors_++; 246 num_hardware_compositors_++;
249 if (num_hardware_compositors_ == 1 && main_thread_proxy_.get()) { 247 if (num_hardware_compositors_ == 1 && main_thread_proxy_.get()) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 DCHECK(!service_.get()); 300 DCHECK(!service_.get());
303 service_ = service; 301 service_ = service;
304 } 302 }
305 303
306 void SynchronousCompositorFactoryImpl::SetRecordFullDocument( 304 void SynchronousCompositorFactoryImpl::SetRecordFullDocument(
307 bool record_full_document) { 305 bool record_full_document) {
308 record_full_layer_ = record_full_document; 306 record_full_layer_ = record_full_document;
309 } 307 }
310 308
311 } // namespace content 309 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/in_process/synchronous_compositor_factory_impl.h ('k') | content/browser/gpu/gpu_ipc_browsertests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698