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 <vector> |
| 9 |
8 #include "base/callback.h" | 10 #include "base/callback.h" |
9 #include "base/containers/hash_tables.h" | 11 #include "base/containers/hash_tables.h" |
10 #include "base/macros.h" | 12 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
12 #include "cc/surfaces/surface_id.h" | 14 #include "cc/surfaces/surface_id.h" |
13 #include "cc/surfaces/surfaces_export.h" | 15 #include "cc/surfaces/surfaces_export.h" |
14 #include "ui/gfx/size.h" | 16 #include "ui/gfx/size.h" |
15 | 17 |
| 18 namespace ui { |
| 19 struct LatencyInfo; |
| 20 } |
| 21 |
16 namespace cc { | 22 namespace cc { |
17 class CompositorFrame; | 23 class CompositorFrame; |
18 class CopyOutputRequest; | 24 class CopyOutputRequest; |
19 class SurfaceManager; | 25 class SurfaceManager; |
20 class SurfaceFactory; | 26 class SurfaceFactory; |
21 class SurfaceResourceHolder; | 27 class SurfaceResourceHolder; |
22 | 28 |
23 class CC_SURFACES_EXPORT Surface { | 29 class CC_SURFACES_EXPORT Surface { |
24 public: | 30 public: |
25 Surface(SurfaceId id, const gfx::Size& size, SurfaceFactory* factory); | 31 Surface(SurfaceId id, const gfx::Size& size, SurfaceFactory* factory); |
26 ~Surface(); | 32 ~Surface(); |
27 | 33 |
28 const gfx::Size& size() const { return size_; } | 34 const gfx::Size& size() const { return size_; } |
29 SurfaceId surface_id() const { return surface_id_; } | 35 SurfaceId surface_id() const { return surface_id_; } |
30 | 36 |
31 void QueueFrame(scoped_ptr<CompositorFrame> frame, | 37 void QueueFrame(scoped_ptr<CompositorFrame> frame, |
32 const base::Closure& draw_callback); | 38 const base::Closure& draw_callback); |
33 void RequestCopyOfOutput(scoped_ptr<CopyOutputRequest> copy_request); | 39 void RequestCopyOfOutput(scoped_ptr<CopyOutputRequest> copy_request); |
34 // Returns the most recent frame that is eligible to be rendered. | 40 // Returns the most recent frame that is eligible to be rendered. |
35 const CompositorFrame* GetEligibleFrame(); | 41 const CompositorFrame* GetEligibleFrame(); |
36 | 42 |
37 // Returns a number that increments by 1 every time a new frame is enqueued. | 43 // Returns a number that increments by 1 every time a new frame is enqueued. |
38 int frame_index() const { return frame_index_; } | 44 int frame_index() const { return frame_index_; } |
39 | 45 |
| 46 void TakeLatencyInfo(std::vector<ui::LatencyInfo>* latency_info); |
40 void RunDrawCallbacks(); | 47 void RunDrawCallbacks(); |
41 | 48 |
42 SurfaceFactory* factory() { return factory_; } | 49 SurfaceFactory* factory() { return factory_; } |
43 | 50 |
44 private: | 51 private: |
45 SurfaceId surface_id_; | 52 SurfaceId surface_id_; |
46 gfx::Size size_; | 53 gfx::Size size_; |
47 SurfaceFactory* factory_; | 54 SurfaceFactory* factory_; |
48 // TODO(jamesr): Support multiple frames in flight. | 55 // TODO(jamesr): Support multiple frames in flight. |
49 scoped_ptr<CompositorFrame> current_frame_; | 56 scoped_ptr<CompositorFrame> current_frame_; |
50 int frame_index_; | 57 int frame_index_; |
51 | 58 |
52 base::Closure draw_callback_; | 59 base::Closure draw_callback_; |
53 | 60 |
54 DISALLOW_COPY_AND_ASSIGN(Surface); | 61 DISALLOW_COPY_AND_ASSIGN(Surface); |
55 }; | 62 }; |
56 | 63 |
57 } // namespace cc | 64 } // namespace cc |
58 | 65 |
59 #endif // CC_SURFACES_SURFACE_H_ | 66 #endif // CC_SURFACES_SURFACE_H_ |
OLD | NEW |