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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 new FakeOutputSurface(software_device.Pass(), false)); | 63 new FakeOutputSurface(software_device.Pass(), false)); |
64 result->capabilities_.deferred_gl_initialization = true; | 64 result->capabilities_.deferred_gl_initialization = true; |
65 return result.Pass(); | 65 return result.Pass(); |
66 } | 66 } |
67 | 67 |
68 virtual void SendFrameToParentCompositor(CompositorFrame* frame) OVERRIDE; | 68 virtual void SendFrameToParentCompositor(CompositorFrame* frame) OVERRIDE; |
69 | 69 |
70 CompositorFrame& last_sent_frame() { return last_sent_frame_; } | 70 CompositorFrame& last_sent_frame() { return last_sent_frame_; } |
71 size_t num_sent_frames() { return num_sent_frames_; } | 71 size_t num_sent_frames() { return num_sent_frames_; } |
72 | 72 |
73 virtual void EnableVSyncNotification(bool enable) OVERRIDE; | 73 virtual void SetNeedsBeginFrame(bool enable) OVERRIDE; |
74 bool vsync_notification_enabled() const { | 74 bool needs_begin_frame() const { |
75 return vsync_notification_enabled_; | 75 return needs_begin_frame_; |
76 } | 76 } |
77 void DidVSync(base::TimeTicks frame_time); | 77 void BeginFrame(base::TimeTicks frame_time); |
78 | 78 |
79 void set_forced_draw_to_software_device(bool forced) { | 79 void set_forced_draw_to_software_device(bool forced) { |
80 forced_draw_to_software_device_ = forced; | 80 forced_draw_to_software_device_ = forced; |
81 } | 81 } |
82 virtual bool ForcedDrawToSoftwareDevice() const OVERRIDE; | 82 virtual bool ForcedDrawToSoftwareDevice() const OVERRIDE; |
83 | 83 |
84 private: | 84 private: |
85 FakeOutputSurface( | 85 FakeOutputSurface( |
86 scoped_ptr<WebKit::WebGraphicsContext3D> context3d, | 86 scoped_ptr<WebKit::WebGraphicsContext3D> context3d, |
87 bool has_parent); | 87 bool has_parent); |
88 | 88 |
89 FakeOutputSurface( | 89 FakeOutputSurface( |
90 scoped_ptr<SoftwareOutputDevice> software_device, | 90 scoped_ptr<SoftwareOutputDevice> software_device, |
91 bool has_parent); | 91 bool has_parent); |
92 | 92 |
93 void SendFrameAck(); | 93 void SendFrameAck(); |
94 | 94 |
95 CompositorFrame last_sent_frame_; | 95 CompositorFrame last_sent_frame_; |
96 size_t num_sent_frames_; | 96 size_t num_sent_frames_; |
97 bool vsync_notification_enabled_; | 97 bool needs_begin_frame_; |
98 bool forced_draw_to_software_device_; | 98 bool forced_draw_to_software_device_; |
99 base::WeakPtrFactory<FakeOutputSurface> weak_ptr_factory_; | 99 base::WeakPtrFactory<FakeOutputSurface> weak_ptr_factory_; |
100 }; | 100 }; |
101 | 101 |
102 static inline scoped_ptr<cc::OutputSurface> CreateFakeOutputSurface() { | 102 static inline scoped_ptr<cc::OutputSurface> CreateFakeOutputSurface() { |
103 return FakeOutputSurface::Create3d( | 103 return FakeOutputSurface::Create3d( |
104 TestWebGraphicsContext3D::Create( | 104 TestWebGraphicsContext3D::Create( |
105 WebKit::WebGraphicsContext3D::Attributes()) | 105 WebKit::WebGraphicsContext3D::Attributes()) |
106 .PassAs<WebKit::WebGraphicsContext3D>()).PassAs<cc::OutputSurface>(); | 106 .PassAs<WebKit::WebGraphicsContext3D>()).PassAs<cc::OutputSurface>(); |
107 } | 107 } |
108 | 108 |
109 } // namespace cc | 109 } // namespace cc |
110 | 110 |
111 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ | 111 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ |
OLD | NEW |