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

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

Issue 16863005: cc: Add BeginFrameArgs (Closed) Base URL: http://git.chromium.org/chromium/src.git@nofrc12
Patch Set: Rebase and address comments 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
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"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 SynchronousCompositorOutputSurface::SynchronousCompositorOutputSurface( 84 SynchronousCompositorOutputSurface::SynchronousCompositorOutputSurface(
85 int routing_id) 85 int routing_id)
86 : cc::OutputSurface( 86 : cc::OutputSurface(
87 scoped_ptr<cc::SoftwareOutputDevice>(new SoftwareDevice(this))), 87 scoped_ptr<cc::SoftwareOutputDevice>(new SoftwareDevice(this))),
88 routing_id_(routing_id), 88 routing_id_(routing_id),
89 needs_begin_frame_(false), 89 needs_begin_frame_(false),
90 did_swap_buffer_(false), 90 did_swap_buffer_(false),
91 current_sw_canvas_(NULL) { 91 current_sw_canvas_(NULL) {
92 capabilities_.deferred_gl_initialization = true; 92 capabilities_.deferred_gl_initialization = true;
93 capabilities_.has_parent_compositor = false;
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.
95 } 96 }
96 97
97 SynchronousCompositorOutputSurface::~SynchronousCompositorOutputSurface() { 98 SynchronousCompositorOutputSurface::~SynchronousCompositorOutputSurface() {
98 DCHECK(CalledOnValidThread()); 99 DCHECK(CalledOnValidThread());
99 SynchronousCompositorOutputSurfaceDelegate* delegate = GetDelegate(); 100 SynchronousCompositorOutputSurfaceDelegate* delegate = GetDelegate();
100 if (delegate) 101 if (delegate)
101 delegate->DidDestroySynchronousOutputSurface(this); 102 delegate->DidDestroySynchronousOutputSurface(this);
102 } 103 }
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 213
213 current_sw_canvas_ = NULL; 214 current_sw_canvas_ = NULL;
214 return did_swap_buffer_; 215 return did_swap_buffer_;
215 } 216 }
216 217
217 void SynchronousCompositorOutputSurface::InvokeComposite( 218 void SynchronousCompositorOutputSurface::InvokeComposite(
218 gfx::Size damage_size) { 219 gfx::Size damage_size) {
219 did_swap_buffer_ = false; 220 did_swap_buffer_ = false;
220 SetNeedsRedrawRect(gfx::Rect(damage_size)); 221 SetNeedsRedrawRect(gfx::Rect(damage_size));
221 if (needs_begin_frame_) 222 if (needs_begin_frame_)
222 BeginFrame(base::TimeTicks::Now()); 223 BeginFrame(BeginFrameArgs::CreateForSynchronousCompositor());
223 224
224 if (did_swap_buffer_) 225 if (did_swap_buffer_)
225 OnSwapBuffersComplete(NULL); 226 OnSwapBuffersComplete(NULL);
226 } 227 }
227 228
228 // Not using base::NonThreadSafe as we want to enforce a more exacting threading 229 // Not using base::NonThreadSafe as we want to enforce a more exacting threading
229 // requirement: SynchronousCompositorOutputSurface() must only be used on the UI 230 // requirement: SynchronousCompositorOutputSurface() must only be used on the UI
230 // thread. 231 // thread.
231 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const { 232 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const {
232 return BrowserThread::CurrentlyOn(BrowserThread::UI); 233 return BrowserThread::CurrentlyOn(BrowserThread::UI);
233 } 234 }
234 235
235 SynchronousCompositorOutputSurfaceDelegate* 236 SynchronousCompositorOutputSurfaceDelegate*
236 SynchronousCompositorOutputSurface::GetDelegate() { 237 SynchronousCompositorOutputSurface::GetDelegate() {
237 return SynchronousCompositorImpl::FromRoutingID(routing_id_); 238 return SynchronousCompositorImpl::FromRoutingID(routing_id_);
238 } 239 }
239 240
240 } // namespace content 241 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698