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

Side by Side Diff: cc/test/fake_output_surface.cc

Issue 12674030: cc: Hook vsync time source to output surface (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 7 years, 9 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "cc/test/fake_output_surface.h" 5 #include "cc/test/fake_output_surface.h"
6 6
7 #include "base/time.h"
8 #include "cc/output/output_surface_client.h"
9
7 namespace cc { 10 namespace cc {
8 11
9 FakeOutputSurface::FakeOutputSurface( 12 FakeOutputSurface::FakeOutputSurface(
10 scoped_ptr<WebKit::WebGraphicsContext3D> context3d, bool has_parent) 13 scoped_ptr<WebKit::WebGraphicsContext3D> context3d, bool has_parent)
11 : OutputSurface(context3d.Pass()), 14 : OutputSurface(context3d.Pass()),
12 num_sent_frames_(0) { 15 num_sent_frames_(0),
16 vsync_notification_enabled_(false) {
13 capabilities_.has_parent_compositor = has_parent; 17 capabilities_.has_parent_compositor = has_parent;
14 } 18 }
15 19
16 FakeOutputSurface::FakeOutputSurface( 20 FakeOutputSurface::FakeOutputSurface(
17 scoped_ptr<SoftwareOutputDevice> software_device, bool has_parent) 21 scoped_ptr<SoftwareOutputDevice> software_device, bool has_parent)
18 : OutputSurface(software_device.Pass()), 22 : OutputSurface(software_device.Pass()),
19 num_sent_frames_(0) { 23 num_sent_frames_(0) {
20 capabilities_.has_parent_compositor = has_parent; 24 capabilities_.has_parent_compositor = has_parent;
21 } 25 }
22 26
23 FakeOutputSurface::~FakeOutputSurface() {} 27 FakeOutputSurface::~FakeOutputSurface() {}
24 28
25 bool FakeOutputSurface::BindToClient( 29 bool FakeOutputSurface::BindToClient(
26 cc::OutputSurfaceClient* client) { 30 cc::OutputSurfaceClient* client) {
27 DCHECK(client); 31 DCHECK(client);
28 client_ = client; 32 client_ = client;
29 if (!context3d_) 33 if (!context3d_)
30 return true; 34 return true;
31 return context3d_->makeContextCurrent(); 35 return context3d_->makeContextCurrent();
32 } 36 }
33 37
34 void FakeOutputSurface::SendFrameToParentCompositor( 38 void FakeOutputSurface::SendFrameToParentCompositor(
35 CompositorFrame* frame) { 39 CompositorFrame* frame) {
36 frame->AssignTo(&last_sent_frame_); 40 frame->AssignTo(&last_sent_frame_);
37 ++num_sent_frames_; 41 ++num_sent_frames_;
38 } 42 }
39 43
44 void FakeOutputSurface::EnableVSyncNotification(bool enable) {
45 vsync_notification_enabled_ = enable;
46 }
47
48 void FakeOutputSurface::DidVSync(base::TimeTicks frame_time) {
49 client_->DidVSync(frame_time);
50 }
51
40 } // namespace cc 52 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698