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