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

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

Issue 331103002: aw: Remove legacy rendering path (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 6 years, 6 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 | Annotate | Revision Log
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 "content/browser/android/in_process/synchronous_compositor_output_surfa ce.h" 7 #include "content/browser/android/in_process/synchronous_compositor_output_surfa ce.h"
8 #include "content/public/browser/browser_thread.h" 8 #include "content/public/browser/browser_thread.h"
9 #include "gpu/command_buffer/client/gl_in_process_context.h" 9 #include "gpu/command_buffer/client/gl_in_process_context.h"
10 #include "ui/gl/android/surface_texture.h" 10 #include "ui/gl/android/surface_texture.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 gfx::kNullAcceleratedWidget, 48 gfx::kNullAcceleratedWidget,
49 gfx::Size(1, 1), 49 gfx::Size(1, 1),
50 NULL /* share_context */, 50 NULL /* share_context */,
51 false /* share_resources */, 51 false /* share_resources */,
52 in_process_attribs, 52 in_process_attribs,
53 gpu_preference)); 53 gpu_preference));
54 return context.Pass(); 54 return context.Pass();
55 } 55 }
56 56
57 scoped_ptr<gpu::GLInProcessContext> CreateContext( 57 scoped_ptr<gpu::GLInProcessContext> CreateContext(
58 scoped_refptr<gfx::GLSurface> surface,
59 scoped_refptr<gpu::InProcessCommandBuffer::Service> service, 58 scoped_refptr<gpu::InProcessCommandBuffer::Service> service,
60 gpu::GLInProcessContext* share_context) { 59 gpu::GLInProcessContext* share_context) {
61 const gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu; 60 const gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu;
62 gpu::GLInProcessContextAttribs in_process_attribs; 61 gpu::GLInProcessContextAttribs in_process_attribs;
63 WebGraphicsContext3DInProcessCommandBufferImpl::ConvertAttributes( 62 WebGraphicsContext3DInProcessCommandBufferImpl::ConvertAttributes(
64 GetDefaultAttribs(), &in_process_attribs); 63 GetDefaultAttribs(), &in_process_attribs);
65 in_process_attribs.lose_context_when_out_of_memory = 1; 64 in_process_attribs.lose_context_when_out_of_memory = 1;
66 65
67
68 bool is_offscreen = false;
69 gfx::Size size(1, 1);
70 if (surface) {
71 is_offscreen = surface->IsOffscreen();
72 size = surface->GetSize();
73 }
74
75 scoped_ptr<gpu::GLInProcessContext> context( 66 scoped_ptr<gpu::GLInProcessContext> context(
76 gpu::GLInProcessContext::Create(service, 67 gpu::GLInProcessContext::Create(service,
77 surface, 68 NULL /* surface */,
no sievers 2014/06/17 00:32:35 Can we remove the |surface| argument from GLInProc
boliu 2014/06/17 00:44:38 Nope, still used in aw code here for exact same re
78 is_offscreen, 69 false /* is_offscreen */,
79 gfx::kNullAcceleratedWidget, 70 gfx::kNullAcceleratedWidget,
80 size, 71 gfx::Size(1, 1),
81 share_context, 72 share_context,
82 false /* share_resources */, 73 false /* share_resources */,
83 in_process_attribs, 74 in_process_attribs,
84 gpu_preference)); 75 gpu_preference));
85 return context.Pass(); 76 return context.Pass();
86 } 77 }
87 78
88 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> WrapContext( 79 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> WrapContext(
89 scoped_ptr<gpu::GLInProcessContext> context) { 80 scoped_ptr<gpu::GLInProcessContext> context) {
90 if (!context.get()) 81 if (!context.get())
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 !offscreen_context_for_main_thread_->BindToCurrentThread(); 161 !offscreen_context_for_main_thread_->BindToCurrentThread();
171 } 162 }
172 163
173 if (failed) { 164 if (failed) {
174 offscreen_context_for_main_thread_ = NULL; 165 offscreen_context_for_main_thread_ = NULL;
175 } 166 }
176 return offscreen_context_for_main_thread_; 167 return offscreen_context_for_main_thread_;
177 } 168 }
178 169
179 scoped_refptr<cc::ContextProvider> SynchronousCompositorFactoryImpl:: 170 scoped_refptr<cc::ContextProvider> SynchronousCompositorFactoryImpl::
180 CreateOnscreenContextProviderForCompositorThread( 171 CreateOnscreenContextProviderForCompositorThread() {
181 scoped_refptr<gfx::GLSurface> surface) {
182 DCHECK(service_); 172 DCHECK(service_);
183 173
184 if (!share_context_.get()) 174 if (!share_context_.get())
185 share_context_ = CreateContext(NULL, service_, NULL); 175 share_context_ = CreateContext(service_, NULL);
186 return webkit::gpu::ContextProviderInProcess::Create( 176 return webkit::gpu::ContextProviderInProcess::Create(
187 WrapContext(CreateContext(surface, service_, share_context_.get())), 177 WrapContext(CreateContext(service_, share_context_.get())),
188 "Child-Compositor"); 178 "Child-Compositor");
189 } 179 }
190 180
191 gpu::GLInProcessContext* SynchronousCompositorFactoryImpl::GetShareContext() { 181 gpu::GLInProcessContext* SynchronousCompositorFactoryImpl::GetShareContext() {
192 DCHECK(share_context_.get()); 182 DCHECK(share_context_.get());
193 return share_context_.get(); 183 return share_context_.get();
194 } 184 }
195 185
196 scoped_refptr<StreamTextureFactory> 186 scoped_refptr<StreamTextureFactory>
197 SynchronousCompositorFactoryImpl::CreateStreamTextureFactory(int frame_id) { 187 SynchronousCompositorFactoryImpl::CreateStreamTextureFactory(int frame_id) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 context_provider; 222 context_provider;
233 // This check only guarantees the main thread context is created after 223 // This check only guarantees the main thread context is created after
234 // a compositor did successfully initialize hardware draw in the past. 224 // a compositor did successfully initialize hardware draw in the past.
235 // In particular this does not guarantee that the main thread context 225 // In particular this does not guarantee that the main thread context
236 // will fail creation when all compositors release hardware draw. 226 // will fail creation when all compositors release hardware draw.
237 if (CanCreateMainThreadContext() && !video_context_provider_) { 227 if (CanCreateMainThreadContext() && !video_context_provider_) {
238 DCHECK(service_); 228 DCHECK(service_);
239 DCHECK(share_context_.get()); 229 DCHECK(share_context_.get());
240 230
241 video_context_provider_ = new VideoContextProvider( 231 video_context_provider_ = new VideoContextProvider(
242 CreateContext(NULL, service_, share_context_.get())); 232 CreateContext(service_, share_context_.get()));
243 } 233 }
244 return video_context_provider_; 234 return video_context_provider_;
245 } 235 }
246 236
247 void SynchronousCompositorFactoryImpl::SetDeferredGpuService( 237 void SynchronousCompositorFactoryImpl::SetDeferredGpuService(
248 scoped_refptr<gpu::InProcessCommandBuffer::Service> service) { 238 scoped_refptr<gpu::InProcessCommandBuffer::Service> service) {
249 DCHECK(!service_); 239 DCHECK(!service_);
250 service_ = service; 240 service_ = service;
251 } 241 }
252 242
253 } // namespace content 243 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698