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 <set> |
| 9 |
8 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
9 #include "base/macros.h" | 11 #include "base/macros.h" |
10 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
11 #include "cc/surfaces/surface_id.h" | 13 #include "cc/surfaces/surface_id.h" |
12 #include "cc/surfaces/surfaces_export.h" | 14 #include "cc/surfaces/surfaces_export.h" |
13 #include "ui/gfx/size.h" | 15 #include "ui/gfx/size.h" |
14 | 16 |
15 namespace cc { | 17 namespace cc { |
16 class CompositorFrame; | 18 class CompositorFrame; |
| 19 class Display; |
17 class SurfaceManager; | 20 class SurfaceManager; |
18 class SurfaceFactory; | 21 class SurfaceFactory; |
19 class SurfaceResourceHolder; | 22 class SurfaceResourceHolder; |
20 | 23 |
21 class CC_SURFACES_EXPORT Surface { | 24 class CC_SURFACES_EXPORT Surface { |
22 public: | 25 public: |
23 Surface(SurfaceId id, const gfx::Size& size, SurfaceFactory* factory); | 26 Surface(SurfaceId id, const gfx::Size& size, SurfaceFactory* factory); |
24 ~Surface(); | 27 ~Surface(); |
25 | 28 |
26 const gfx::Size& size() const { return size_; } | 29 const gfx::Size& size() const { return size_; } |
27 SurfaceId surface_id() const { return surface_id_; } | 30 SurfaceId surface_id() const { return surface_id_; } |
28 | 31 |
29 void QueueFrame(scoped_ptr<CompositorFrame> frame); | 32 void QueueFrame(scoped_ptr<CompositorFrame> frame); |
30 // Returns the most recent frame that is eligible to be rendered. | 33 // Returns the most recent frame that is eligible to be rendered. |
31 const CompositorFrame* GetEligibleFrame(); | 34 const CompositorFrame* GetEligibleFrame(); |
32 | 35 |
33 SurfaceFactory* factory() { return factory_; } | 36 SurfaceFactory* factory() { return factory_; } |
| 37 std::set<Display*>& containing_displays() { return containing_displays_; } |
34 | 38 |
35 private: | 39 private: |
36 SurfaceId surface_id_; | 40 SurfaceId surface_id_; |
37 gfx::Size size_; | 41 gfx::Size size_; |
38 SurfaceFactory* factory_; | 42 SurfaceFactory* factory_; |
39 // TODO(jamesr): Support multiple frames in flight. | 43 // TODO(jamesr): Support multiple frames in flight. |
40 scoped_ptr<CompositorFrame> current_frame_; | 44 scoped_ptr<CompositorFrame> current_frame_; |
41 | 45 |
| 46 // This is the set of Displays that used this surface the last time they |
| 47 // drew. |
| 48 std::set<Display*> containing_displays_; |
| 49 |
42 DISALLOW_COPY_AND_ASSIGN(Surface); | 50 DISALLOW_COPY_AND_ASSIGN(Surface); |
43 }; | 51 }; |
44 | 52 |
45 } // namespace cc | 53 } // namespace cc |
46 | 54 |
47 #endif // CC_SURFACES_SURFACE_H_ | 55 #endif // CC_SURFACES_SURFACE_H_ |
OLD | NEW |