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_FACTORY_H_ | 5 #ifndef CC_SURFACES_SURFACE_FACTORY_H_ |
6 #define CC_SURFACES_SURFACE_FACTORY_H_ | 6 #define CC_SURFACES_SURFACE_FACTORY_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <set> | 9 #include <set> |
10 #include <unordered_map> | 10 #include <unordered_map> |
(...skipping 12 matching lines...) Expand all Loading... |
23 class Size; | 23 class Size; |
24 } | 24 } |
25 | 25 |
26 namespace cc { | 26 namespace cc { |
27 class BeginFrameSource; | 27 class BeginFrameSource; |
28 class CopyOutputRequest; | 28 class CopyOutputRequest; |
29 class Surface; | 29 class Surface; |
30 class SurfaceFactoryClient; | 30 class SurfaceFactoryClient; |
31 class SurfaceManager; | 31 class SurfaceManager; |
32 | 32 |
33 enum class SurfaceDrawStatus { DRAW_SKIPPED, DRAWN }; | |
34 | |
35 // A SurfaceFactory is used to create surfaces that may share resources and | 33 // A SurfaceFactory is used to create surfaces that may share resources and |
36 // receive returned resources for frames submitted to those surfaces. Resources | 34 // receive returned resources for frames submitted to those surfaces. Resources |
37 // submitted to frames created by a particular factory will be returned to that | 35 // submitted to frames created by a particular factory will be returned to that |
38 // factory's client when they are no longer being used. This is the only class | 36 // factory's client when they are no longer being used. This is the only class |
39 // most users of surfaces will need to directly interact with. | 37 // most users of surfaces will need to directly interact with. |
40 class CC_SURFACES_EXPORT SurfaceFactory | 38 class CC_SURFACES_EXPORT SurfaceFactory |
41 : public base::SupportsWeakPtr<SurfaceFactory> { | 39 : public base::SupportsWeakPtr<SurfaceFactory> { |
42 public: | 40 public: |
43 using DrawCallback = base::Callback<void(SurfaceDrawStatus)>; | 41 using DrawCallback = base::Callback<void()>; |
44 | 42 |
45 SurfaceFactory(SurfaceManager* manager, SurfaceFactoryClient* client); | 43 SurfaceFactory(SurfaceManager* manager, SurfaceFactoryClient* client); |
46 ~SurfaceFactory(); | 44 ~SurfaceFactory(); |
47 | 45 |
48 void Create(const SurfaceId& surface_id); | 46 void Create(const SurfaceId& surface_id); |
49 void Destroy(const SurfaceId& surface_id); | 47 void Destroy(const SurfaceId& surface_id); |
50 void DestroyAll(); | 48 void DestroyAll(); |
51 | 49 |
52 // Set that the current frame on new_id is to be treated as the successor to | 50 // Set that the current frame on new_id is to be treated as the successor to |
53 // the current frame on old_id for the purposes of calculating damage. | 51 // the current frame on old_id for the purposes of calculating damage. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 using OwningSurfaceMap = | 92 using OwningSurfaceMap = |
95 std::unordered_map<SurfaceId, std::unique_ptr<Surface>, SurfaceIdHash>; | 93 std::unordered_map<SurfaceId, std::unique_ptr<Surface>, SurfaceIdHash>; |
96 OwningSurfaceMap surface_map_; | 94 OwningSurfaceMap surface_map_; |
97 | 95 |
98 DISALLOW_COPY_AND_ASSIGN(SurfaceFactory); | 96 DISALLOW_COPY_AND_ASSIGN(SurfaceFactory); |
99 }; | 97 }; |
100 | 98 |
101 } // namespace cc | 99 } // namespace cc |
102 | 100 |
103 #endif // CC_SURFACES_SURFACE_FACTORY_H_ | 101 #endif // CC_SURFACES_SURFACE_FACTORY_H_ |
OLD | NEW |