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); | |
78 | 77 |
79 void set_forced_draw_to_software_device(bool forced) { | 78 void set_forced_draw_to_software_device(bool forced) { |
80 forced_draw_to_software_device_ = forced; | 79 forced_draw_to_software_device_ = forced; |
81 } | 80 } |
82 virtual bool ForcedDrawToSoftwareDevice() const OVERRIDE; | 81 virtual bool ForcedDrawToSoftwareDevice() const OVERRIDE; |
83 | 82 |
84 protected: | 83 protected: |
85 FakeOutputSurface( | 84 FakeOutputSurface( |
86 scoped_ptr<WebKit::WebGraphicsContext3D> context3d, | 85 scoped_ptr<WebKit::WebGraphicsContext3D> context3d, |
87 bool delegated_rendering); | 86 bool delegated_rendering); |
88 | 87 |
89 FakeOutputSurface( | 88 FakeOutputSurface( |
90 scoped_ptr<SoftwareOutputDevice> software_device, | 89 scoped_ptr<SoftwareOutputDevice> software_device, |
91 bool delegated_rendering); | 90 bool delegated_rendering); |
92 | 91 |
93 FakeOutputSurface( | 92 FakeOutputSurface( |
94 scoped_ptr<WebKit::WebGraphicsContext3D> context3d, | 93 scoped_ptr<WebKit::WebGraphicsContext3D> context3d, |
95 scoped_ptr<SoftwareOutputDevice> software_device, | 94 scoped_ptr<SoftwareOutputDevice> software_device, |
96 bool delegated_rendering); | 95 bool delegated_rendering); |
97 | 96 |
| 97 void OnBeginFrame(); |
| 98 |
98 CompositorFrame last_sent_frame_; | 99 CompositorFrame last_sent_frame_; |
99 size_t num_sent_frames_; | 100 size_t num_sent_frames_; |
100 bool needs_begin_frame_; | 101 bool needs_begin_frame_; |
101 bool forced_draw_to_software_device_; | 102 bool forced_draw_to_software_device_; |
| 103 base::WeakPtrFactory<FakeOutputSurface> fake_weak_ptr_factory_; |
102 }; | 104 }; |
103 | 105 |
104 static inline scoped_ptr<cc::OutputSurface> CreateFakeOutputSurface() { | 106 static inline scoped_ptr<cc::OutputSurface> CreateFakeOutputSurface() { |
105 return FakeOutputSurface::Create3d( | 107 return FakeOutputSurface::Create3d( |
106 TestWebGraphicsContext3D::Create( | 108 TestWebGraphicsContext3D::Create( |
107 WebKit::WebGraphicsContext3D::Attributes()) | 109 WebKit::WebGraphicsContext3D::Attributes()) |
108 .PassAs<WebKit::WebGraphicsContext3D>()).PassAs<cc::OutputSurface>(); | 110 .PassAs<WebKit::WebGraphicsContext3D>()).PassAs<cc::OutputSurface>(); |
109 } | 111 } |
110 | 112 |
111 } // namespace cc | 113 } // namespace cc |
112 | 114 |
113 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ | 115 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ |
OLD | NEW |