Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1879)

Unified Diff: cc/resources/resource_pool.h

Issue 2110083004: Partial raster for GPU (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@partialuma2
Patch Set: Add missing resource cleanup to unit tests. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/raster/zero_copy_raster_buffer_provider.cc ('k') | cc/resources/resource_pool.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/resource_pool.h
diff --git a/cc/resources/resource_pool.h b/cc/resources/resource_pool.h
index 74262dedcf90fe0025b369a507b7cd6d511cdcae..ab13feebdac43ec72802f8d4be886a738e35b499 100644
--- a/cc/resources/resource_pool.h
+++ b/cc/resources/resource_pool.h
@@ -42,8 +42,20 @@ class CC_EXPORT ResourcePool : public base::trace_event::MemoryDumpProvider {
~ResourcePool() override;
Resource* AcquireResource(const gfx::Size& size, ResourceFormat format);
- Resource* TryAcquireResourceWithContentId(uint64_t content_id);
- void ReleaseResource(Resource* resource, uint64_t content_id);
+
+ // Tries to acquire the resource with |previous_content_id| for us in partial
+ // raster. If successful, this function will retun the invalidated rect which
+ // must be re-rastered in |total_invalidated_rect|.
+ Resource* TryAcquireResourceForPartialRaster(
+ uint64_t new_content_id,
+ const gfx::Rect& new_invalidated_rect,
+ uint64_t previous_content_id,
+ gfx::Rect* total_invalidated_rect);
+
+ // Called when a resource's content has been fully replaced (and is completely
+ // valid). Updates the resource's content ID to its new value.
+ void OnContentReplaced(ResourceId resource_id, uint64_t content_id);
+ void ReleaseResource(Resource* resource);
void SetResourceUsageLimits(size_t max_memory_usage_bytes,
size_t max_resource_count);
@@ -95,11 +107,17 @@ class CC_EXPORT ResourcePool : public base::trace_event::MemoryDumpProvider {
base::TimeTicks last_usage() const { return last_usage_; }
void set_last_usage(base::TimeTicks time) { last_usage_ = time; }
+ gfx::Rect invalidated_rect() const { return invalidated_rect_; }
+ void set_invalidated_rect(const gfx::Rect& invalidated_rect) {
+ invalidated_rect_ = invalidated_rect;
+ }
+
private:
explicit PoolResource(ResourceProvider* resource_provider)
: ScopedResource(resource_provider), content_id_(0) {}
uint64_t content_id_;
base::TimeTicks last_usage_;
+ gfx::Rect invalidated_rect_;
};
void DidFinishUsingResource(std::unique_ptr<PoolResource> resource);
@@ -125,7 +143,8 @@ class CC_EXPORT ResourcePool : public base::trace_event::MemoryDumpProvider {
ResourceDeque unused_resources_;
ResourceDeque busy_resources_;
- std::map<ResourceId, std::unique_ptr<PoolResource>> in_use_resources_;
+ using InUseResourceMap = std::map<ResourceId, std::unique_ptr<PoolResource>>;
+ InUseResourceMap in_use_resources_;
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
bool evict_expired_resources_pending_;
« no previous file with comments | « cc/raster/zero_copy_raster_buffer_provider.cc ('k') | cc/resources/resource_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698