| 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/time.h" | 8 #include "base/time.h" |
| 9 #include "cc/output/compositor_frame.h" | 9 #include "cc/output/compositor_frame.h" |
| 10 #include "cc/output/output_surface.h" | 10 #include "cc/output/output_surface.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 67 |
| 68 CompositorFrame& last_sent_frame() { return last_sent_frame_; } | 68 CompositorFrame& last_sent_frame() { return last_sent_frame_; } |
| 69 size_t num_sent_frames() { return num_sent_frames_; } | 69 size_t num_sent_frames() { return num_sent_frames_; } |
| 70 | 70 |
| 71 virtual void SwapBuffers(CompositorFrame* frame) OVERRIDE; | 71 virtual void SwapBuffers(CompositorFrame* frame) OVERRIDE; |
| 72 | 72 |
| 73 virtual void SetNeedsBeginFrame(bool enable) OVERRIDE; | 73 virtual void SetNeedsBeginFrame(bool enable) OVERRIDE; |
| 74 bool needs_begin_frame() const { | 74 bool needs_begin_frame() const { |
| 75 return needs_begin_frame_; | 75 return needs_begin_frame_; |
| 76 } | 76 } |
| 77 void BeginFrame(base::TimeTicks frame_time); |
| 77 | 78 |
| 78 void set_forced_draw_to_software_device(bool forced) { | 79 void set_forced_draw_to_software_device(bool forced) { |
| 79 forced_draw_to_software_device_ = forced; | 80 forced_draw_to_software_device_ = forced; |
| 80 } | 81 } |
| 81 virtual bool ForcedDrawToSoftwareDevice() const OVERRIDE; | 82 virtual bool ForcedDrawToSoftwareDevice() const OVERRIDE; |
| 82 | 83 |
| 83 protected: | 84 protected: |
| 84 FakeOutputSurface( | 85 FakeOutputSurface( |
| 85 scoped_ptr<WebKit::WebGraphicsContext3D> context3d, | 86 scoped_ptr<WebKit::WebGraphicsContext3D> context3d, |
| 86 bool delegated_rendering); | 87 bool delegated_rendering); |
| 87 | 88 |
| 88 FakeOutputSurface( | 89 FakeOutputSurface( |
| 89 scoped_ptr<SoftwareOutputDevice> software_device, | 90 scoped_ptr<SoftwareOutputDevice> software_device, |
| 90 bool delegated_rendering); | 91 bool delegated_rendering); |
| 91 | 92 |
| 92 FakeOutputSurface( | 93 FakeOutputSurface( |
| 93 scoped_ptr<WebKit::WebGraphicsContext3D> context3d, | 94 scoped_ptr<WebKit::WebGraphicsContext3D> context3d, |
| 94 scoped_ptr<SoftwareOutputDevice> software_device, | 95 scoped_ptr<SoftwareOutputDevice> software_device, |
| 95 bool delegated_rendering); | 96 bool delegated_rendering); |
| 96 | 97 |
| 97 void OnBeginFrame(); | |
| 98 | |
| 99 CompositorFrame last_sent_frame_; | 98 CompositorFrame last_sent_frame_; |
| 100 size_t num_sent_frames_; | 99 size_t num_sent_frames_; |
| 101 bool needs_begin_frame_; | 100 bool needs_begin_frame_; |
| 102 bool forced_draw_to_software_device_; | 101 bool forced_draw_to_software_device_; |
| 103 base::WeakPtrFactory<FakeOutputSurface> fake_weak_ptr_factory_; | |
| 104 }; | 102 }; |
| 105 | 103 |
| 106 static inline scoped_ptr<cc::OutputSurface> CreateFakeOutputSurface() { | 104 static inline scoped_ptr<cc::OutputSurface> CreateFakeOutputSurface() { |
| 107 return FakeOutputSurface::Create3d( | 105 return FakeOutputSurface::Create3d( |
| 108 TestWebGraphicsContext3D::Create( | 106 TestWebGraphicsContext3D::Create( |
| 109 WebKit::WebGraphicsContext3D::Attributes()) | 107 WebKit::WebGraphicsContext3D::Attributes()) |
| 110 .PassAs<WebKit::WebGraphicsContext3D>()).PassAs<cc::OutputSurface>(); | 108 .PassAs<WebKit::WebGraphicsContext3D>()).PassAs<cc::OutputSurface>(); |
| 111 } | 109 } |
| 112 | 110 |
| 113 } // namespace cc | 111 } // namespace cc |
| 114 | 112 |
| 115 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ | 113 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ |
| OLD | NEW |