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

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

Issue 15860003: AW hardware draw mega patch (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: r205552 Created 7 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
« no previous file with comments | « content/browser/android/in_process/synchronous_compositor_output_surface.h ('k') | 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_output_surfa ce.h" 5 #include "content/browser/android/in_process/synchronous_compositor_output_surfa ce.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "cc/output/compositor_frame.h" 10 #include "cc/output/compositor_frame.h"
11 #include "cc/output/compositor_frame_ack.h" 11 #include "cc/output/compositor_frame_ack.h"
12 #include "cc/output/context_provider.h" 12 #include "cc/output/context_provider.h"
13 #include "cc/output/output_surface_client.h" 13 #include "cc/output/output_surface_client.h"
14 #include "cc/output/software_output_device.h" 14 #include "cc/output/software_output_device.h"
15 #include "content/browser/android/in_process/synchronous_compositor_impl.h" 15 #include "content/browser/android/in_process/synchronous_compositor_impl.h"
16 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" 16 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
17 #include "content/public/browser/android/synchronous_compositor_client.h" 17 #include "content/public/browser/android/synchronous_compositor_client.h"
18 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
19 #include "content/public/common/content_switches.h" 19 #include "content/public/common/content_switches.h"
20 #include "content/renderer/android/synchronous_compositor_factory.h"
20 #include "skia/ext/refptr.h" 21 #include "skia/ext/refptr.h"
21 #include "third_party/skia/include/core/SkCanvas.h" 22 #include "third_party/skia/include/core/SkCanvas.h"
22 #include "third_party/skia/include/core/SkDevice.h" 23 #include "third_party/skia/include/core/SkDevice.h"
23 #include "third_party/skia/include/core/SkPicture.h" 24 #include "third_party/skia/include/core/SkPicture.h"
24 #include "ui/gfx/rect_conversions.h" 25 #include "ui/gfx/rect_conversions.h"
25 #include "ui/gfx/skia_util.h" 26 #include "ui/gfx/skia_util.h"
26 #include "ui/gfx/transform.h" 27 #include "ui/gfx/transform.h"
27 #include "ui/gl/gl_context.h" 28 #include "ui/gl/gl_context.h"
28 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl. h" 29 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl. h"
29 30
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 int routing_id) 86 int routing_id)
86 : cc::OutputSurface( 87 : cc::OutputSurface(
87 scoped_ptr<cc::SoftwareOutputDevice>(new SoftwareDevice(this))), 88 scoped_ptr<cc::SoftwareOutputDevice>(new SoftwareDevice(this))),
88 routing_id_(routing_id), 89 routing_id_(routing_id),
89 needs_begin_frame_(false), 90 needs_begin_frame_(false),
90 did_swap_buffer_(false), 91 did_swap_buffer_(false),
91 current_sw_canvas_(NULL) { 92 current_sw_canvas_(NULL) {
92 capabilities_.deferred_gl_initialization = true; 93 capabilities_.deferred_gl_initialization = true;
93 // Cannot call out to GetDelegate() here as the output surface is not 94 // Cannot call out to GetDelegate() here as the output surface is not
94 // constructed on the correct thread. 95 // constructed on the correct thread.
96
97 SynchronousCompositorFactory* factory =
98 SynchronousCompositorFactory::GetInstance();
99 DCHECK(factory);
100 context_provider_for_compositor_thread_ =
101 factory->GetOffscreenContextProviderForCompositorThread();
95 } 102 }
96 103
97 SynchronousCompositorOutputSurface::~SynchronousCompositorOutputSurface() { 104 SynchronousCompositorOutputSurface::~SynchronousCompositorOutputSurface() {
98 DCHECK(CalledOnValidThread()); 105 DCHECK(CalledOnValidThread());
99 SynchronousCompositorOutputSurfaceDelegate* delegate = GetDelegate(); 106 SynchronousCompositorOutputSurfaceDelegate* delegate = GetDelegate();
100 if (delegate) 107 if (delegate)
101 delegate->DidDestroySynchronousOutputSurface(this); 108 delegate->DidDestroySynchronousOutputSurface(this);
102 } 109 }
103 110
104 bool SynchronousCompositorOutputSurface::ForcedDrawToSoftwareDevice() const { 111 bool SynchronousCompositorOutputSurface::ForcedDrawToSoftwareDevice() const {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 // origin of the clip rect, but CC's draw origin starts at the clip. 153 // origin of the clip rect, but CC's draw origin starts at the clip.
147 transform->matrix().postTranslate(-clip.x(), -clip.y(), 0); 154 transform->matrix().postTranslate(-clip.x(), -clip.y(), 0);
148 } 155 }
149 } // namespace 156 } // namespace
150 157
151 bool SynchronousCompositorOutputSurface::InitializeHwDraw() { 158 bool SynchronousCompositorOutputSurface::InitializeHwDraw() {
152 DCHECK(CalledOnValidThread()); 159 DCHECK(CalledOnValidThread());
153 DCHECK(client_); 160 DCHECK(client_);
154 DCHECK(!context3d_); 161 DCHECK(!context3d_);
155 162
156 // TODO(boliu): Get a context provider in constructor and pass here. 163 scoped_refptr<cc::ContextProvider> provider;
164 provider.swap(context_provider_for_compositor_thread_);
165
157 return InitializeAndSetContext3D(CreateWebGraphicsContext3D().Pass(), 166 return InitializeAndSetContext3D(CreateWebGraphicsContext3D().Pass(),
158 scoped_refptr<cc::ContextProvider>()); 167 provider);
159 } 168 }
160 169
161 bool SynchronousCompositorOutputSurface::DemandDrawHw( 170 bool SynchronousCompositorOutputSurface::DemandDrawHw(
162 gfx::Size surface_size, 171 gfx::Size surface_size,
163 const gfx::Transform& transform, 172 const gfx::Transform& transform,
164 gfx::Rect clip) { 173 gfx::Rect clip) {
165 DCHECK(CalledOnValidThread()); 174 DCHECK(CalledOnValidThread());
166 DCHECK(client_); 175 DCHECK(client_);
167 DCHECK(context3d()); 176 DCHECK(context3d());
168 177
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const { 235 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const {
227 return BrowserThread::CurrentlyOn(BrowserThread::UI); 236 return BrowserThread::CurrentlyOn(BrowserThread::UI);
228 } 237 }
229 238
230 SynchronousCompositorOutputSurfaceDelegate* 239 SynchronousCompositorOutputSurfaceDelegate*
231 SynchronousCompositorOutputSurface::GetDelegate() { 240 SynchronousCompositorOutputSurface::GetDelegate() {
232 return SynchronousCompositorImpl::FromRoutingID(routing_id_); 241 return SynchronousCompositorImpl::FromRoutingID(routing_id_);
233 } 242 }
234 243
235 } // namespace content 244 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/in_process/synchronous_compositor_output_surface.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698