| 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 "cc/output/output_surface_client.h" |
| 8 |
| 7 namespace cc { | 9 namespace cc { |
| 8 | 10 |
| 9 FakeOutputSurface::FakeOutputSurface( | 11 FakeOutputSurface::FakeOutputSurface( |
| 10 scoped_ptr<WebKit::WebGraphicsContext3D> context3d, bool has_parent) | 12 scoped_ptr<WebKit::WebGraphicsContext3D> context3d, bool has_parent) |
| 11 : OutputSurface(context3d.Pass()), | 13 : OutputSurface(context3d.Pass()), |
| 12 num_sent_frames_(0) { | 14 num_sent_frames_(0), |
| 15 vsync_notification_enabled_(false) { |
| 13 capabilities_.has_parent_compositor = has_parent; | 16 capabilities_.has_parent_compositor = has_parent; |
| 14 } | 17 } |
| 15 | 18 |
| 16 FakeOutputSurface::FakeOutputSurface( | 19 FakeOutputSurface::FakeOutputSurface( |
| 17 scoped_ptr<SoftwareOutputDevice> software_device, bool has_parent) | 20 scoped_ptr<SoftwareOutputDevice> software_device, bool has_parent) |
| 18 : OutputSurface(software_device.Pass()), | 21 : OutputSurface(software_device.Pass()), |
| 19 num_sent_frames_(0) { | 22 num_sent_frames_(0) { |
| 20 capabilities_.has_parent_compositor = has_parent; | 23 capabilities_.has_parent_compositor = has_parent; |
| 21 } | 24 } |
| 22 | 25 |
| 23 FakeOutputSurface::~FakeOutputSurface() {} | 26 FakeOutputSurface::~FakeOutputSurface() {} |
| 24 | 27 |
| 25 bool FakeOutputSurface::BindToClient( | 28 bool FakeOutputSurface::BindToClient( |
| 26 cc::OutputSurfaceClient* client) { | 29 cc::OutputSurfaceClient* client) { |
| 27 DCHECK(client); | 30 DCHECK(client); |
| 28 client_ = client; | 31 client_ = client; |
| 29 if (!context3d_) | 32 if (!context3d_) |
| 30 return true; | 33 return true; |
| 31 return context3d_->makeContextCurrent(); | 34 return context3d_->makeContextCurrent(); |
| 32 } | 35 } |
| 33 | 36 |
| 34 void FakeOutputSurface::SendFrameToParentCompositor( | 37 void FakeOutputSurface::SendFrameToParentCompositor( |
| 35 CompositorFrame* frame) { | 38 CompositorFrame* frame) { |
| 36 frame->AssignTo(&last_sent_frame_); | 39 frame->AssignTo(&last_sent_frame_); |
| 37 ++num_sent_frames_; | 40 ++num_sent_frames_; |
| 38 } | 41 } |
| 39 | 42 |
| 43 void FakeOutputSurface::EnableVSyncNotification(bool enable) { |
| 44 vsync_notification_enabled_ = enable; |
| 45 } |
| 46 |
| 47 void FakeOutputSurface::DidVSync(base::TimeTicks frame_time) { |
| 48 client_->DidVSync(frame_time); |
| 49 } |
| 50 |
| 40 } // namespace cc | 51 } // namespace cc |
| OLD | NEW |