| 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 // The callback is called the first time this frame is used to draw. |
| 42 void SubmitFrame(SurfaceId surface_id, |
| 43 scoped_ptr<CompositorFrame> frame, |
| 44 const base::Closure& callback); |
| 41 | 45 |
| 42 SurfaceFactoryClient* client() { return client_; } | 46 SurfaceFactoryClient* client() { return client_; } |
| 43 | 47 |
| 44 void ReceiveFromChild(const TransferableResourceArray& resources); | 48 void ReceiveFromChild(const TransferableResourceArray& resources); |
| 45 void RefResources(const TransferableResourceArray& resources); | 49 void RefResources(const TransferableResourceArray& resources); |
| 46 void UnrefResources(const ReturnedResourceArray& resources); | 50 void UnrefResources(const ReturnedResourceArray& resources); |
| 47 | 51 |
| 48 private: | 52 private: |
| 49 SurfaceManager* manager_; | 53 SurfaceManager* manager_; |
| 50 SurfaceFactoryClient* client_; | 54 SurfaceFactoryClient* client_; |
| 51 typedef base::ScopedPtrHashMap<SurfaceId, Surface> OwningSurfaceMap; | 55 typedef base::ScopedPtrHashMap<SurfaceId, Surface> OwningSurfaceMap; |
| 52 base::ScopedPtrHashMap<SurfaceId, Surface> surface_map_; | 56 base::ScopedPtrHashMap<SurfaceId, Surface> surface_map_; |
| 53 | 57 |
| 54 SurfaceResourceHolder holder_; | 58 SurfaceResourceHolder holder_; |
| 55 | 59 |
| 56 DISALLOW_COPY_AND_ASSIGN(SurfaceFactory); | 60 DISALLOW_COPY_AND_ASSIGN(SurfaceFactory); |
| 57 }; | 61 }; |
| 58 | 62 |
| 59 } // namespace cc | 63 } // namespace cc |
| 60 | 64 |
| 61 #endif // CC_SURFACES_SURFACE_FACTORY_H_ | 65 #endif // CC_SURFACES_SURFACE_FACTORY_H_ |
| OLD | NEW |