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

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

Issue 15058004: cc: Rename VSync to BeginFrame (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase Created 7 years, 7 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 | « cc/test/fake_output_surface.h ('k') | cc/test/layer_tree_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "cc/output/compositor_frame_ack.h" 9 #include "cc/output/compositor_frame_ack.h"
10 #include "cc/output/output_surface_client.h" 10 #include "cc/output/output_surface_client.h"
11 11
12 namespace cc { 12 namespace cc {
13 13
14 FakeOutputSurface::FakeOutputSurface( 14 FakeOutputSurface::FakeOutputSurface(
15 scoped_ptr<WebKit::WebGraphicsContext3D> context3d, bool has_parent) 15 scoped_ptr<WebKit::WebGraphicsContext3D> context3d, bool has_parent)
16 : OutputSurface(context3d.Pass()), 16 : OutputSurface(context3d.Pass()),
17 num_sent_frames_(0), 17 num_sent_frames_(0),
18 vsync_notification_enabled_(false), 18 needs_begin_frame_(false),
19 forced_draw_to_software_device_(false), 19 forced_draw_to_software_device_(false),
20 weak_ptr_factory_(this) { 20 weak_ptr_factory_(this) {
21 capabilities_.has_parent_compositor = has_parent; 21 capabilities_.has_parent_compositor = has_parent;
22 } 22 }
23 23
24 FakeOutputSurface::FakeOutputSurface( 24 FakeOutputSurface::FakeOutputSurface(
25 scoped_ptr<SoftwareOutputDevice> software_device, bool has_parent) 25 scoped_ptr<SoftwareOutputDevice> software_device, bool has_parent)
26 : OutputSurface(software_device.Pass()), 26 : OutputSurface(software_device.Pass()),
27 num_sent_frames_(0), 27 num_sent_frames_(0),
28 forced_draw_to_software_device_(false), 28 forced_draw_to_software_device_(false),
29 weak_ptr_factory_(this) { 29 weak_ptr_factory_(this) {
30 capabilities_.has_parent_compositor = has_parent; 30 capabilities_.has_parent_compositor = has_parent;
31 } 31 }
32 32
33 FakeOutputSurface::~FakeOutputSurface() {} 33 FakeOutputSurface::~FakeOutputSurface() {}
34 34
35 void FakeOutputSurface::SendFrameToParentCompositor( 35 void FakeOutputSurface::SendFrameToParentCompositor(
36 CompositorFrame* frame) { 36 CompositorFrame* frame) {
37 frame->AssignTo(&last_sent_frame_); 37 frame->AssignTo(&last_sent_frame_);
38 ++num_sent_frames_; 38 ++num_sent_frames_;
39 MessageLoop::current()->PostTask( 39 MessageLoop::current()->PostTask(
40 FROM_HERE, base::Bind(&FakeOutputSurface::SendFrameAck, 40 FROM_HERE, base::Bind(&FakeOutputSurface::SendFrameAck,
41 weak_ptr_factory_.GetWeakPtr())); 41 weak_ptr_factory_.GetWeakPtr()));
42 } 42 }
43 43
44 void FakeOutputSurface::EnableVSyncNotification(bool enable) { 44 void FakeOutputSurface::SetNeedsBeginFrame(bool enable) {
45 vsync_notification_enabled_ = enable; 45 needs_begin_frame_ = enable;
46 } 46 }
47 47
48 void FakeOutputSurface::DidVSync(base::TimeTicks frame_time) { 48 void FakeOutputSurface::BeginFrame(base::TimeTicks frame_time) {
49 client_->DidVSync(frame_time); 49 client_->BeginFrame(frame_time);
50 } 50 }
51 51
52 bool FakeOutputSurface::ForcedDrawToSoftwareDevice() const { 52 bool FakeOutputSurface::ForcedDrawToSoftwareDevice() const {
53 return forced_draw_to_software_device_; 53 return forced_draw_to_software_device_;
54 } 54 }
55 55
56 void FakeOutputSurface::SendFrameAck() { 56 void FakeOutputSurface::SendFrameAck() {
57 CompositorFrameAck ack; 57 CompositorFrameAck ack;
58 client_->OnSendFrameToParentCompositorAck(ack); 58 client_->OnSendFrameToParentCompositorAck(ack);
59 } 59 }
60 60
61 } // namespace cc 61 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/fake_output_surface.h ('k') | cc/test/layer_tree_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698