OLD | NEW |
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 begin_frame_notification_enabled_(false), |
19 weak_ptr_factory_(this) { | 19 weak_ptr_factory_(this) { |
20 capabilities_.has_parent_compositor = has_parent; | 20 capabilities_.has_parent_compositor = has_parent; |
21 } | 21 } |
22 | 22 |
23 FakeOutputSurface::FakeOutputSurface( | 23 FakeOutputSurface::FakeOutputSurface( |
24 scoped_ptr<SoftwareOutputDevice> software_device, bool has_parent) | 24 scoped_ptr<SoftwareOutputDevice> software_device, bool has_parent) |
25 : OutputSurface(software_device.Pass()), | 25 : OutputSurface(software_device.Pass()), |
26 num_sent_frames_(0), | 26 num_sent_frames_(0), |
27 weak_ptr_factory_(this) { | 27 weak_ptr_factory_(this) { |
28 capabilities_.has_parent_compositor = has_parent; | 28 capabilities_.has_parent_compositor = has_parent; |
29 } | 29 } |
30 | 30 |
31 FakeOutputSurface::~FakeOutputSurface() {} | 31 FakeOutputSurface::~FakeOutputSurface() {} |
32 | 32 |
33 void FakeOutputSurface::SendFrameToParentCompositor( | 33 void FakeOutputSurface::SendFrameToParentCompositor( |
34 CompositorFrame* frame) { | 34 CompositorFrame* frame) { |
35 frame->AssignTo(&last_sent_frame_); | 35 frame->AssignTo(&last_sent_frame_); |
36 ++num_sent_frames_; | 36 ++num_sent_frames_; |
37 MessageLoop::current()->PostTask( | 37 MessageLoop::current()->PostTask( |
38 FROM_HERE, base::Bind(&FakeOutputSurface::SendFrameAck, | 38 FROM_HERE, base::Bind(&FakeOutputSurface::SendFrameAck, |
39 weak_ptr_factory_.GetWeakPtr())); | 39 weak_ptr_factory_.GetWeakPtr())); |
40 } | 40 } |
41 | 41 |
42 void FakeOutputSurface::EnableVSyncNotification(bool enable) { | 42 void FakeOutputSurface::EnableBeginFrameNotification(bool enable) { |
43 vsync_notification_enabled_ = enable; | 43 begin_frame_notification_enabled_ = enable; |
44 } | 44 } |
45 | 45 |
46 void FakeOutputSurface::DidVSync(base::TimeTicks frame_time) { | 46 void FakeOutputSurface::BeginFrame(base::TimeTicks frame_time) { |
47 client_->DidVSync(frame_time); | 47 client_->BeginFrame(frame_time); |
48 } | 48 } |
49 | 49 |
50 void FakeOutputSurface::SendFrameAck() { | 50 void FakeOutputSurface::SendFrameAck() { |
51 CompositorFrameAck ack; | 51 CompositorFrameAck ack; |
52 client_->OnSendFrameToParentCompositorAck(ack); | 52 client_->OnSendFrameToParentCompositorAck(ack); |
53 } | 53 } |
54 | 54 |
55 } // namespace cc | 55 } // namespace cc |
OLD | NEW |