OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SURFACES_SURFACE_H_ | 5 #ifndef CC_SURFACES_SURFACE_H_ |
6 #define CC_SURFACES_SURFACE_H_ | 6 #define CC_SURFACES_SURFACE_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 ~Surface(); | 25 ~Surface(); |
26 | 26 |
27 const gfx::Size& size() const { return size_; } | 27 const gfx::Size& size() const { return size_; } |
28 SurfaceId surface_id() const { return surface_id_; } | 28 SurfaceId surface_id() const { return surface_id_; } |
29 | 29 |
30 void QueueFrame(scoped_ptr<CompositorFrame> frame, | 30 void QueueFrame(scoped_ptr<CompositorFrame> frame, |
31 const base::Closure& draw_callback); | 31 const base::Closure& draw_callback); |
32 // Returns the most recent frame that is eligible to be rendered. | 32 // Returns the most recent frame that is eligible to be rendered. |
33 const CompositorFrame* GetEligibleFrame(); | 33 const CompositorFrame* GetEligibleFrame(); |
34 | 34 |
| 35 // Returns a number that increments by 1 every time a new frame is enqueued. |
| 36 int frame_index() const { return frame_index_; } |
| 37 |
35 void RunDrawCallbacks(); | 38 void RunDrawCallbacks(); |
36 | 39 |
37 SurfaceFactory* factory() { return factory_; } | 40 SurfaceFactory* factory() { return factory_; } |
38 | 41 |
39 private: | 42 private: |
40 SurfaceId surface_id_; | 43 SurfaceId surface_id_; |
41 gfx::Size size_; | 44 gfx::Size size_; |
42 SurfaceFactory* factory_; | 45 SurfaceFactory* factory_; |
43 // TODO(jamesr): Support multiple frames in flight. | 46 // TODO(jamesr): Support multiple frames in flight. |
44 scoped_ptr<CompositorFrame> current_frame_; | 47 scoped_ptr<CompositorFrame> current_frame_; |
| 48 int frame_index_; |
45 | 49 |
46 base::Closure draw_callback_; | 50 base::Closure draw_callback_; |
47 | 51 |
48 DISALLOW_COPY_AND_ASSIGN(Surface); | 52 DISALLOW_COPY_AND_ASSIGN(Surface); |
49 }; | 53 }; |
50 | 54 |
51 } // namespace cc | 55 } // namespace cc |
52 | 56 |
53 #endif // CC_SURFACES_SURFACE_H_ | 57 #endif // CC_SURFACES_SURFACE_H_ |
OLD | NEW |