| 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_OUTPUT_OUTPUT_SURFACE_H_ | 5 #ifndef CC_OUTPUT_OUTPUT_SURFACE_H_ |
| 6 #define CC_OUTPUT_OUTPUT_SURFACE_H_ | 6 #define CC_OUTPUT_OUTPUT_SURFACE_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 void OnVSyncParametersChanged(base::TimeTicks timebase, | 154 void OnVSyncParametersChanged(base::TimeTicks timebase, |
| 155 base::TimeDelta interval); | 155 base::TimeDelta interval); |
| 156 virtual void FrameRateControllerTick(bool throttled, | 156 virtual void FrameRateControllerTick(bool throttled, |
| 157 const BeginFrameArgs& args) OVERRIDE; | 157 const BeginFrameArgs& args) OVERRIDE; |
| 158 scoped_ptr<FrameRateController> frame_rate_controller_; | 158 scoped_ptr<FrameRateController> frame_rate_controller_; |
| 159 int max_frames_pending_; | 159 int max_frames_pending_; |
| 160 int pending_swap_buffers_; | 160 int pending_swap_buffers_; |
| 161 bool needs_begin_frame_; | 161 bool needs_begin_frame_; |
| 162 bool begin_frame_pending_; | 162 bool begin_frame_pending_; |
| 163 | 163 |
| 164 // This stores a BeginFrame that we couldn't process immediately, but might |
| 165 // process retroactively in the near future. |
| 166 BeginFrameArgs skipped_begin_frame_args_; |
| 167 |
| 164 // Forwarded to OutputSurfaceClient but threaded through OutputSurface | 168 // Forwarded to OutputSurfaceClient but threaded through OutputSurface |
| 165 // first so OutputSurface has a chance to update the FrameRateController | 169 // first so OutputSurface has a chance to update the FrameRateController |
| 166 bool HasClient() { return !!client_; } | 170 bool HasClient() { return !!client_; } |
| 167 void SetNeedsRedrawRect(gfx::Rect damage_rect); | 171 void SetNeedsRedrawRect(gfx::Rect damage_rect); |
| 168 void BeginFrame(const BeginFrameArgs& args); | 172 void BeginFrame(const BeginFrameArgs& args); |
| 169 void DidSwapBuffers(); | 173 void DidSwapBuffers(); |
| 170 void OnSwapBuffersComplete(const CompositorFrameAck* ack); | 174 void OnSwapBuffersComplete(const CompositorFrameAck* ack); |
| 171 void DidLoseOutputSurface(); | 175 void DidLoseOutputSurface(); |
| 172 void SetExternalStencilTest(bool enabled); | 176 void SetExternalStencilTest(bool enabled); |
| 173 void SetExternalDrawConstraints(const gfx::Transform& transform, | 177 void SetExternalDrawConstraints(const gfx::Transform& transform, |
| 174 gfx::Rect viewport); | 178 gfx::Rect viewport); |
| 175 | 179 |
| 176 // virtual for testing. | 180 // virtual for testing. |
| 177 virtual base::TimeDelta AlternateRetroactiveBeginFramePeriod(); | 181 virtual base::TimeTicks RetroactiveBeginFrameDeadline(); |
| 178 virtual void PostCheckForRetroactiveBeginFrame(); | 182 virtual void PostCheckForRetroactiveBeginFrame(); |
| 179 void CheckForRetroactiveBeginFrame(); | 183 void CheckForRetroactiveBeginFrame(); |
| 180 | 184 |
| 181 private: | 185 private: |
| 182 OutputSurfaceClient* client_; | 186 OutputSurfaceClient* client_; |
| 183 friend class OutputSurfaceCallbacks; | 187 friend class OutputSurfaceCallbacks; |
| 184 | 188 |
| 185 void SetContext3D(scoped_ptr<WebKit::WebGraphicsContext3D> context3d); | 189 void SetContext3D(scoped_ptr<WebKit::WebGraphicsContext3D> context3d); |
| 186 void ResetContext3D(); | 190 void ResetContext3D(); |
| 187 void SetMemoryPolicy(const ManagedMemoryPolicy& policy, | 191 void SetMemoryPolicy(const ManagedMemoryPolicy& policy, |
| 188 bool discard_backbuffer_when_not_visible); | 192 bool discard_backbuffer_when_not_visible); |
| 189 | 193 |
| 190 // This stores a BeginFrame that we couldn't process immediately, but might | |
| 191 // process retroactively in the near future. | |
| 192 BeginFrameArgs skipped_begin_frame_args_; | |
| 193 | |
| 194 // check_for_retroactive_begin_frame_pending_ is used to avoid posting | 194 // check_for_retroactive_begin_frame_pending_ is used to avoid posting |
| 195 // redundant checks for a retroactive BeginFrame. | 195 // redundant checks for a retroactive BeginFrame. |
| 196 bool check_for_retroactive_begin_frame_pending_; | 196 bool check_for_retroactive_begin_frame_pending_; |
| 197 | 197 |
| 198 DISALLOW_COPY_AND_ASSIGN(OutputSurface); | 198 DISALLOW_COPY_AND_ASSIGN(OutputSurface); |
| 199 }; | 199 }; |
| 200 | 200 |
| 201 } // namespace cc | 201 } // namespace cc |
| 202 | 202 |
| 203 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ | 203 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ |
| OLD | NEW |