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" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
76 WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( | 76 WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( |
77 context.Pass(), attributes)); | 77 context.Pass(), attributes)); |
78 } | 78 } |
79 | 79 |
80 } // namespace | 80 } // namespace |
81 | 81 |
82 class SynchronousCompositorFactoryImpl::VideoContextProvider | 82 class SynchronousCompositorFactoryImpl::VideoContextProvider |
83 : public StreamTextureFactorySynchronousImpl::ContextProvider { | 83 : public StreamTextureFactorySynchronousImpl::ContextProvider { |
84 public: | 84 public: |
85 VideoContextProvider( | 85 VideoContextProvider( |
86 scoped_refptr<cc::ContextProvider> context_provider, | |
86 scoped_ptr<gpu::GLInProcessContext> gl_in_process_context) | 87 scoped_ptr<gpu::GLInProcessContext> gl_in_process_context) |
87 : gl_in_process_context_(gl_in_process_context.get()) { | 88 : context_provider_(context_provider), |
88 context_provider_ = webkit::gpu::ContextProviderInProcess::Create( | 89 gl_in_process_context_(gl_in_process_context.get()) { |
89 WrapContext(gl_in_process_context.Pass(), GetDefaultAttribs()), | |
90 "Video-Offscreen-main-thread"); | |
91 context_provider_->BindToCurrentThread(); | 90 context_provider_->BindToCurrentThread(); |
92 } | 91 } |
93 | 92 |
94 scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture( | 93 scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture( |
95 uint32 stream_id) override { | 94 uint32 stream_id) override { |
96 return gl_in_process_context_->GetSurfaceTexture(stream_id); | 95 return gl_in_process_context_->GetSurfaceTexture(stream_id); |
97 } | 96 } |
98 | 97 |
99 gpu::gles2::GLES2Interface* ContextGL() override { | 98 gpu::gles2::GLES2Interface* ContextGL() override { |
100 return context_provider_->ContextGL(); | 99 return context_provider_->ContextGL(); |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
255 scoped_refptr<StreamTextureFactorySynchronousImpl::ContextProvider>(); | 254 scoped_refptr<StreamTextureFactorySynchronousImpl::ContextProvider>(); |
256 } | 255 } |
257 | 256 |
258 if (!video_context_provider_.get()) { | 257 if (!video_context_provider_.get()) { |
259 DCHECK(service_.get()); | 258 DCHECK(service_.get()); |
260 | 259 |
261 blink::WebGraphicsContext3D::Attributes attributes = GetDefaultAttribs(); | 260 blink::WebGraphicsContext3D::Attributes attributes = GetDefaultAttribs(); |
262 attributes.shareResources = false; | 261 attributes.shareResources = false; |
263 // This needs to run in on-screen |service_| context due to SurfaceTexture | 262 // This needs to run in on-screen |service_| context due to SurfaceTexture |
264 // limitations. | 263 // limitations. |
265 video_context_provider_ = new VideoContextProvider(CreateContextHolder( | 264 scoped_ptr<gpu::GLInProcessContext> context = |
266 attributes, service_, gpu::GLInProcessContextSharedMemoryLimits(), | 265 CreateContextHolder(attributes, service_, |
267 false)); | 266 gpu::GLInProcessContextSharedMemoryLimits(), false); |
267 video_context_provider_ = new VideoContextProvider( | |
268 webkit::gpu::ContextProviderInProcess::Create( | |
269 WrapContext(context.Pass(), GetDefaultAttribs()), | |
270 "Video-Offscreen-main-thread"), | |
271 context.Pass()); | |
tfarina
2015/04/07 23:16:27
This second Pass() isn't really right, is it? Is t
boliu
2015/04/08 03:26:08
Right, scoped_ptr can't be passed twice. The secon
tfarina
2015/04/08 19:37:20
Done.
| |
268 } | 272 } |
269 return video_context_provider_; | 273 return video_context_provider_; |
270 } | 274 } |
271 | 275 |
272 void SynchronousCompositorFactoryImpl::SetDeferredGpuService( | 276 void SynchronousCompositorFactoryImpl::SetDeferredGpuService( |
273 scoped_refptr<gpu::InProcessCommandBuffer::Service> service) { | 277 scoped_refptr<gpu::InProcessCommandBuffer::Service> service) { |
274 DCHECK(!service_.get()); | 278 DCHECK(!service_.get()); |
275 service_ = service; | 279 service_ = service; |
276 } | 280 } |
277 | 281 |
278 void SynchronousCompositorFactoryImpl::SetRecordFullDocument( | 282 void SynchronousCompositorFactoryImpl::SetRecordFullDocument( |
279 bool record_full_document) { | 283 bool record_full_document) { |
280 record_full_layer_ = record_full_document; | 284 record_full_layer_ = record_full_document; |
281 } | 285 } |
282 | 286 |
283 } // namespace content | 287 } // namespace content |
OLD | NEW |