| 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 #ifndef CC_TEST_FAKE_OUTPUT_SURFACE_H_ | 5 #ifndef CC_TEST_FAKE_OUTPUT_SURFACE_H_ |
| 6 #define CC_TEST_FAKE_OUTPUT_SURFACE_H_ | 6 #define CC_TEST_FAKE_OUTPUT_SURFACE_H_ |
| 7 | 7 |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 scoped_ptr<SoftwareOutputDevice> software_device) { | 55 scoped_ptr<SoftwareOutputDevice> software_device) { |
| 56 return make_scoped_ptr( | 56 return make_scoped_ptr( |
| 57 new FakeOutputSurface(software_device.Pass(), true)); | 57 new FakeOutputSurface(software_device.Pass(), true)); |
| 58 } | 58 } |
| 59 | 59 |
| 60 virtual void SendFrameToParentCompositor(CompositorFrame* frame) OVERRIDE; | 60 virtual void SendFrameToParentCompositor(CompositorFrame* frame) OVERRIDE; |
| 61 | 61 |
| 62 CompositorFrame& last_sent_frame() { return last_sent_frame_; } | 62 CompositorFrame& last_sent_frame() { return last_sent_frame_; } |
| 63 size_t num_sent_frames() { return num_sent_frames_; } | 63 size_t num_sent_frames() { return num_sent_frames_; } |
| 64 | 64 |
| 65 virtual void EnableVSyncNotification(bool enable) OVERRIDE; | 65 virtual void SetNeedsBeginImplFrame(bool enable) OVERRIDE; |
| 66 bool vsync_notification_enabled() const { | 66 bool needs_begin_impl_frame() const { |
| 67 return vsync_notification_enabled_; | 67 return needs_begin_impl_frame_; |
| 68 } | 68 } |
| 69 void DidVSync(base::TimeTicks frame_time); | 69 void BeginImplFrame(base::TimeTicks frame_time); |
| 70 | 70 |
| 71 private: | 71 private: |
| 72 FakeOutputSurface( | 72 FakeOutputSurface( |
| 73 scoped_ptr<WebKit::WebGraphicsContext3D> context3d, | 73 scoped_ptr<WebKit::WebGraphicsContext3D> context3d, |
| 74 bool has_parent); | 74 bool has_parent); |
| 75 | 75 |
| 76 FakeOutputSurface( | 76 FakeOutputSurface( |
| 77 scoped_ptr<SoftwareOutputDevice> software_device, | 77 scoped_ptr<SoftwareOutputDevice> software_device, |
| 78 bool has_parent); | 78 bool has_parent); |
| 79 | 79 |
| 80 void SendFrameAck(); | 80 void SendFrameAck(); |
| 81 | 81 |
| 82 CompositorFrame last_sent_frame_; | 82 CompositorFrame last_sent_frame_; |
| 83 size_t num_sent_frames_; | 83 size_t num_sent_frames_; |
| 84 bool vsync_notification_enabled_; | 84 bool needs_begin_impl_frame_; |
| 85 base::WeakPtrFactory<FakeOutputSurface> weak_ptr_factory_; | 85 base::WeakPtrFactory<FakeOutputSurface> weak_ptr_factory_; |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 static inline scoped_ptr<cc::OutputSurface> CreateFakeOutputSurface() { | 88 static inline scoped_ptr<cc::OutputSurface> CreateFakeOutputSurface() { |
| 89 return FakeOutputSurface::Create3d( | 89 return FakeOutputSurface::Create3d( |
| 90 TestWebGraphicsContext3D::Create( | 90 TestWebGraphicsContext3D::Create( |
| 91 WebKit::WebGraphicsContext3D::Attributes()) | 91 WebKit::WebGraphicsContext3D::Attributes()) |
| 92 .PassAs<WebKit::WebGraphicsContext3D>()).PassAs<cc::OutputSurface>(); | 92 .PassAs<WebKit::WebGraphicsContext3D>()).PassAs<cc::OutputSurface>(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 } // namespace cc | 95 } // namespace cc |
| 96 | 96 |
| 97 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ | 97 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ |
| OLD | NEW |