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

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

Issue 1064263002: android: Pass cc::ContextProvider to VideoContextProvider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pointer Created 5 years, 8 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 | no next file » | 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/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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>( 75 return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>(
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(gpu::GLInProcessContext* gl_in_process_context,
86 scoped_ptr<gpu::GLInProcessContext> gl_in_process_context) 86 scoped_refptr<cc::ContextProvider> context_provider)
87 : gl_in_process_context_(gl_in_process_context.get()) { 87 : gl_in_process_context_(gl_in_process_context),
88 context_provider_ = webkit::gpu::ContextProviderInProcess::Create( 88 context_provider_(context_provider) {
89 WrapContext(gl_in_process_context.Pass(), GetDefaultAttribs()),
90 "Video-Offscreen-main-thread");
91 context_provider_->BindToCurrentThread(); 89 context_provider_->BindToCurrentThread();
92 } 90 }
93 91
94 scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture( 92 scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture(
95 uint32 stream_id) override { 93 uint32 stream_id) override {
96 return gl_in_process_context_->GetSurfaceTexture(stream_id); 94 return gl_in_process_context_->GetSurfaceTexture(stream_id);
97 } 95 }
98 96
99 gpu::gles2::GLES2Interface* ContextGL() override { 97 gpu::gles2::GLES2Interface* ContextGL() override {
100 return context_provider_->ContextGL(); 98 return context_provider_->ContextGL();
(...skipping 10 matching lines...) Expand all
111 void RestoreContext() { 109 void RestoreContext() {
112 FOR_EACH_OBSERVER(StreamTextureFactoryContextObserver, 110 FOR_EACH_OBSERVER(StreamTextureFactoryContextObserver,
113 observer_list_, 111 observer_list_,
114 ResetStreamTextureProxy()); 112 ResetStreamTextureProxy());
115 } 113 }
116 114
117 private: 115 private:
118 friend class base::RefCountedThreadSafe<VideoContextProvider>; 116 friend class base::RefCountedThreadSafe<VideoContextProvider>;
119 ~VideoContextProvider() override {} 117 ~VideoContextProvider() override {}
120 118
119 gpu::GLInProcessContext* gl_in_process_context_;
boliu 2015/04/08 20:24:26 Why the reorder? In theory, this would lead to a m
121 scoped_refptr<cc::ContextProvider> context_provider_; 120 scoped_refptr<cc::ContextProvider> context_provider_;
122 gpu::GLInProcessContext* gl_in_process_context_;
123 ObserverList<StreamTextureFactoryContextObserver> observer_list_; 121 ObserverList<StreamTextureFactoryContextObserver> observer_list_;
124 122
125 DISALLOW_COPY_AND_ASSIGN(VideoContextProvider); 123 DISALLOW_COPY_AND_ASSIGN(VideoContextProvider);
126 }; 124 };
127 125
128 126
129 SynchronousCompositorFactoryImpl::SynchronousCompositorFactoryImpl() 127 SynchronousCompositorFactoryImpl::SynchronousCompositorFactoryImpl()
130 : record_full_layer_(true), 128 : record_full_layer_(true),
131 num_hardware_compositors_(0) { 129 num_hardware_compositors_(0) {
132 SynchronousCompositorFactory::SetInstance(this); 130 SynchronousCompositorFactory::SetInstance(this);
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 scoped_refptr<StreamTextureFactorySynchronousImpl::ContextProvider>(); 253 scoped_refptr<StreamTextureFactorySynchronousImpl::ContextProvider>();
256 } 254 }
257 255
258 if (!video_context_provider_.get()) { 256 if (!video_context_provider_.get()) {
259 DCHECK(service_.get()); 257 DCHECK(service_.get());
260 258
261 blink::WebGraphicsContext3D::Attributes attributes = GetDefaultAttribs(); 259 blink::WebGraphicsContext3D::Attributes attributes = GetDefaultAttribs();
262 attributes.shareResources = false; 260 attributes.shareResources = false;
263 // This needs to run in on-screen |service_| context due to SurfaceTexture 261 // This needs to run in on-screen |service_| context due to SurfaceTexture
264 // limitations. 262 // limitations.
265 video_context_provider_ = new VideoContextProvider(CreateContextHolder( 263 scoped_ptr<gpu::GLInProcessContext> context =
266 attributes, service_, gpu::GLInProcessContextSharedMemoryLimits(), 264 CreateContextHolder(attributes, service_,
267 false)); 265 gpu::GLInProcessContextSharedMemoryLimits(), false);
266 video_context_provider_ = new VideoContextProvider(
267 context.get(), webkit::gpu::ContextProviderInProcess::Create(
boliu 2015/04/08 20:24:26 Just save the raw pointer in a local variable. Thi
tfarina 2015/04/08 20:26:25 Unfortunately that didn't work very well with Wrap
boliu 2015/04/08 20:29:58 This should work (ignore poor formatting): sc
tfarina 2015/04/08 20:56:46 Cool! thanks. Done.
268 WrapContext(context.Pass(), GetDefaultAttribs()),
269 "Video-Offscreen-main-thread"));
268 } 270 }
269 return video_context_provider_; 271 return video_context_provider_;
270 } 272 }
271 273
272 void SynchronousCompositorFactoryImpl::SetDeferredGpuService( 274 void SynchronousCompositorFactoryImpl::SetDeferredGpuService(
273 scoped_refptr<gpu::InProcessCommandBuffer::Service> service) { 275 scoped_refptr<gpu::InProcessCommandBuffer::Service> service) {
274 DCHECK(!service_.get()); 276 DCHECK(!service_.get());
275 service_ = service; 277 service_ = service;
276 } 278 }
277 279
278 void SynchronousCompositorFactoryImpl::SetRecordFullDocument( 280 void SynchronousCompositorFactoryImpl::SetRecordFullDocument(
279 bool record_full_document) { 281 bool record_full_document) {
280 record_full_layer_ = record_full_document; 282 record_full_layer_ = record_full_document;
281 } 283 }
282 284
283 } // namespace content 285 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698