| 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 27 matching lines...) Expand all Loading... |
| 38 // factory's client when they are no longer being used. This is the only class | 38 // 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. | 39 // most users of surfaces will need to directly interact with. |
| 40 class CC_SURFACES_EXPORT SurfaceFactory | 40 class CC_SURFACES_EXPORT SurfaceFactory |
| 41 : public base::SupportsWeakPtr<SurfaceFactory> { | 41 : public base::SupportsWeakPtr<SurfaceFactory> { |
| 42 public: | 42 public: |
| 43 using DrawCallback = base::Callback<void(SurfaceDrawStatus)>; | 43 using DrawCallback = base::Callback<void(SurfaceDrawStatus)>; |
| 44 | 44 |
| 45 SurfaceFactory(SurfaceManager* manager, SurfaceFactoryClient* client); | 45 SurfaceFactory(SurfaceManager* manager, SurfaceFactoryClient* client); |
| 46 ~SurfaceFactory(); | 46 ~SurfaceFactory(); |
| 47 | 47 |
| 48 void Create(SurfaceId surface_id); | 48 void Create(const SurfaceId& surface_id); |
| 49 void Destroy(SurfaceId surface_id); | 49 void Destroy(const SurfaceId& surface_id); |
| 50 void DestroyAll(); | 50 void DestroyAll(); |
| 51 | 51 |
| 52 // Set that the current frame on new_id is to be treated as the successor to | 52 // 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. | 53 // the current frame on old_id for the purposes of calculating damage. |
| 54 void SetPreviousFrameSurface(SurfaceId new_id, SurfaceId old_id); | 54 void SetPreviousFrameSurface(const SurfaceId& new_id, |
| 55 const SurfaceId& old_id); |
| 55 | 56 |
| 56 // A frame can only be submitted to a surface created by this factory, | 57 // A frame can only be submitted to a surface created by this factory, |
| 57 // although the frame may reference surfaces created by other factories. | 58 // although the frame may reference surfaces created by other factories. |
| 58 // The callback is called the first time this frame is used to draw, or if | 59 // The callback is called the first time this frame is used to draw, or if |
| 59 // the frame is discarded. | 60 // the frame is discarded. |
| 60 void SubmitCompositorFrame(SurfaceId surface_id, | 61 void SubmitCompositorFrame(const SurfaceId& surface_id, |
| 61 CompositorFrame frame, | 62 CompositorFrame frame, |
| 62 const DrawCallback& callback); | 63 const DrawCallback& callback); |
| 63 void RequestCopyOfSurface(SurfaceId surface_id, | 64 void RequestCopyOfSurface(const SurfaceId& surface_id, |
| 64 std::unique_ptr<CopyOutputRequest> copy_request); | 65 std::unique_ptr<CopyOutputRequest> copy_request); |
| 65 | 66 |
| 66 void WillDrawSurface(SurfaceId id, const gfx::Rect& damage_rect); | 67 void WillDrawSurface(const SurfaceId& id, const gfx::Rect& damage_rect); |
| 67 | 68 |
| 68 SurfaceFactoryClient* client() { return client_; } | 69 SurfaceFactoryClient* client() { return client_; } |
| 69 | 70 |
| 70 void ReceiveFromChild(const TransferableResourceArray& resources); | 71 void ReceiveFromChild(const TransferableResourceArray& resources); |
| 71 void RefResources(const TransferableResourceArray& resources); | 72 void RefResources(const TransferableResourceArray& resources); |
| 72 void UnrefResources(const ReturnedResourceArray& resources); | 73 void UnrefResources(const ReturnedResourceArray& resources); |
| 73 | 74 |
| 74 SurfaceManager* manager() { return manager_; } | 75 SurfaceManager* manager() { return manager_; } |
| 75 | 76 |
| 76 // This can be set to false if resources from this SurfaceFactory don't need | 77 // This can be set to false if resources from this SurfaceFactory don't need |
| (...skipping 16 matching lines...) Expand all Loading... |
| 93 using OwningSurfaceMap = | 94 using OwningSurfaceMap = |
| 94 std::unordered_map<SurfaceId, std::unique_ptr<Surface>, SurfaceIdHash>; | 95 std::unordered_map<SurfaceId, std::unique_ptr<Surface>, SurfaceIdHash>; |
| 95 OwningSurfaceMap surface_map_; | 96 OwningSurfaceMap surface_map_; |
| 96 | 97 |
| 97 DISALLOW_COPY_AND_ASSIGN(SurfaceFactory); | 98 DISALLOW_COPY_AND_ASSIGN(SurfaceFactory); |
| 98 }; | 99 }; |
| 99 | 100 |
| 100 } // namespace cc | 101 } // namespace cc |
| 101 | 102 |
| 102 #endif // CC_SURFACES_SURFACE_FACTORY_H_ | 103 #endif // CC_SURFACES_SURFACE_FACTORY_H_ |
| OLD | NEW |