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 "base/callback_forward.h" | |
8 #include "base/containers/scoped_ptr_hash_map.h" | 9 #include "base/containers/scoped_ptr_hash_map.h" |
9 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
11 #include "cc/surfaces/surface_id.h" | 12 #include "cc/surfaces/surface_id.h" |
12 #include "cc/surfaces/surface_resource_holder.h" | 13 #include "cc/surfaces/surface_resource_holder.h" |
13 #include "cc/surfaces/surfaces_export.h" | 14 #include "cc/surfaces/surfaces_export.h" |
14 | 15 |
15 namespace gfx { | 16 namespace gfx { |
16 class Size; | 17 class Size; |
17 } | 18 } |
(...skipping 12 matching lines...) Expand all Loading... | |
30 class CC_SURFACES_EXPORT SurfaceFactory | 31 class CC_SURFACES_EXPORT SurfaceFactory |
31 : public base::SupportsWeakPtr<SurfaceFactory> { | 32 : public base::SupportsWeakPtr<SurfaceFactory> { |
32 public: | 33 public: |
33 SurfaceFactory(SurfaceManager* manager, SurfaceFactoryClient* client); | 34 SurfaceFactory(SurfaceManager* manager, SurfaceFactoryClient* client); |
34 ~SurfaceFactory(); | 35 ~SurfaceFactory(); |
35 | 36 |
36 void Create(SurfaceId surface_id, const gfx::Size& size); | 37 void Create(SurfaceId surface_id, const gfx::Size& size); |
37 void Destroy(SurfaceId surface_id); | 38 void Destroy(SurfaceId surface_id); |
38 // A frame can only be submitted to a surface created by this factory, | 39 // A frame can only be submitted to a surface created by this factory, |
39 // although the frame may reference surfaces created by other factories. | 40 // although the frame may reference surfaces created by other factories. |
40 void SubmitFrame(SurfaceId surface_id, scoped_ptr<CompositorFrame> frame); | 41 void SubmitFrame(SurfaceId surface_id, |
jamesr
2014/08/22 06:00:12
can you document when the callback fires?
| |
42 scoped_ptr<CompositorFrame> frame, | |
43 const base::Closure& callback); | |
41 | 44 |
42 SurfaceFactoryClient* client() { return client_; } | 45 SurfaceFactoryClient* client() { return client_; } |
43 | 46 |
44 void ReceiveFromChild(const TransferableResourceArray& resources); | 47 void ReceiveFromChild(const TransferableResourceArray& resources); |
45 void RefResources(const TransferableResourceArray& resources); | 48 void RefResources(const TransferableResourceArray& resources); |
46 void UnrefResources(const ReturnedResourceArray& resources); | 49 void UnrefResources(const ReturnedResourceArray& resources); |
47 | 50 |
48 private: | 51 private: |
49 SurfaceManager* manager_; | 52 SurfaceManager* manager_; |
50 SurfaceFactoryClient* client_; | 53 SurfaceFactoryClient* client_; |
51 typedef base::ScopedPtrHashMap<SurfaceId, Surface> OwningSurfaceMap; | 54 typedef base::ScopedPtrHashMap<SurfaceId, Surface> OwningSurfaceMap; |
52 base::ScopedPtrHashMap<SurfaceId, Surface> surface_map_; | 55 base::ScopedPtrHashMap<SurfaceId, Surface> surface_map_; |
53 | 56 |
54 SurfaceResourceHolder holder_; | 57 SurfaceResourceHolder holder_; |
55 | 58 |
56 DISALLOW_COPY_AND_ASSIGN(SurfaceFactory); | 59 DISALLOW_COPY_AND_ASSIGN(SurfaceFactory); |
57 }; | 60 }; |
58 | 61 |
59 } // namespace cc | 62 } // namespace cc |
60 | 63 |
61 #endif // CC_SURFACES_SURFACE_FACTORY_H_ | 64 #endif // CC_SURFACES_SURFACE_FACTORY_H_ |
OLD | NEW |