Index: cc/resources/resource_provider.h |
diff --git a/cc/resources/resource_provider.h b/cc/resources/resource_provider.h |
index df3c5b85fb6bf1fa476f80761982df271ce19fa2..8cef6de286abdf9096d4d0b0df9b2ac91884cb72 100644 |
--- a/cc/resources/resource_provider.h |
+++ b/cc/resources/resource_provider.h |
@@ -18,6 +18,7 @@ |
#include <vector> |
#include "base/callback.h" |
+#include "base/containers/small_map.h" |
#include "base/macros.h" |
#include "base/memory/linked_ptr.h" |
#include "base/threading/thread_checker.h" |
@@ -444,6 +445,19 @@ class CC_EXPORT ResourceProvider |
DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGpuMemoryBuffer); |
}; |
+ // All resources that are returned to children while an instance of this |
+ // class exists will be stored and returned when the instance is destroyed. |
+ class CC_EXPORT ScopedBatchReturnResources { |
+ public: |
+ explicit ScopedBatchReturnResources(ResourceProvider* resource_provider); |
+ ~ScopedBatchReturnResources(); |
+ |
+ private: |
+ ResourceProvider* resource_provider_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ScopedBatchReturnResources); |
+ }; |
+ |
class Fence : public base::RefCounted<Fence> { |
public: |
Fence() {} |
@@ -524,6 +538,8 @@ class CC_EXPORT ResourceProvider |
GLenum GetImageTextureTarget(gfx::BufferUsage usage, ResourceFormat format); |
+ void SetBatchReturnResources(bool aggregate); |
Daniele Castagna
2017/03/27 13:38:11
nit: Can this be moved away from the public Resour
|
+ |
// base::trace_event::MemoryDumpProvider implementation. |
bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, |
base::trace_event::ProcessMemoryDump* pmd) override; |
@@ -774,6 +790,12 @@ class CC_EXPORT ResourceProvider |
std::unique_ptr<TextureIdAllocator> texture_id_allocator_; |
BufferToTextureTargetMap buffer_to_texture_target_map_; |
+ // Keep track of whether deleted resources should be batched up or returned |
+ // immediately. |
+ bool batch_return_resources_ = false; |
+ // Maps from a child id to the set of resources to be returned to it. |
+ base::SmallMap<std::map<int, ResourceIdArray>> batched_returning_resources_; |
+ |
base::ThreadChecker thread_checker_; |
// A process-unique ID used for disambiguating memory dumps from different |