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

Unified Diff: cc/resources/resource_provider.h

Issue 1989453003: cc: Add ScopedReadLockGpuMemoryBuffer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix aura typo Created 4 years, 7 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 | « no previous file | cc/resources/resource_provider.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/resource_provider.h
diff --git a/cc/resources/resource_provider.h b/cc/resources/resource_provider.h
index 56c3a625a097e6c93539dc8dc8bf188d785233a5..740fe7f00c7468efb5d5ddb8619b4119d892c59e 100644
--- a/cc/resources/resource_provider.h
+++ b/cc/resources/resource_provider.h
@@ -165,7 +165,8 @@ class CC_EXPORT ResourceProvider
void GenerateSyncTokenForResources(const ResourceIdArray& resource_ids);
// Creates accounting for a child. Returns a child ID.
- int CreateChild(const ReturnCallback& return_callback);
+ int CreateChild(const ReturnCallback& return_callback,
+ int gpu_memory_buffer_client_id);
// Destroys accounting for the child, deleting all accounted resources.
void DestroyChild(int child);
@@ -332,6 +333,28 @@ class CC_EXPORT ResourceProvider
DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGpuMemoryBuffer);
};
+ class CC_EXPORT ScopedReadLockGpuMemoryBuffer {
+ public:
+ ScopedReadLockGpuMemoryBuffer(ResourceProvider* resource_provider,
+ ResourceId resource_id);
+ ~ScopedReadLockGpuMemoryBuffer();
+
+ // This may return nullptr.
+ gfx::GpuMemoryBuffer* GetGpuMemoryBuffer() const;
+
+ // This returns the GL texture that is backed by a GL image bound to the
+ // resource's GpuMemoryBuffer.
+ unsigned GetTextureId() const;
+
+ private:
+ ResourceProvider* resource_provider_;
+ ResourceId resource_id_;
+ const ResourceProvider::Resource* resource_;
+ base::ThreadChecker thread_checker_;
+
+ DISALLOW_COPY_AND_ASSIGN(ScopedReadLockGpuMemoryBuffer);
+ };
+
class CC_EXPORT ScopedWriteLockGr {
public:
ScopedWriteLockGr(ResourceProvider* resource_provider,
@@ -589,6 +612,7 @@ class CC_EXPORT ResourceProvider
ResourceIdMap child_to_parent_map;
ResourceIdMap parent_to_child_map;
ReturnCallback return_callback;
+ int gpu_memory_buffer_client_id;
bool marked_for_deletion;
bool needs_sync_tokens;
};
@@ -606,7 +630,7 @@ class CC_EXPORT ResourceProvider
ResourceId CreateBitmap(const gfx::Size& size);
Resource* InsertResource(ResourceId id, Resource resource);
Resource* GetResource(ResourceId id);
- const Resource* LockForRead(ResourceId id);
+ const Resource* LockForRead(ResourceId id, bool create_gpu_memory_buffer);
void UnlockForRead(ResourceId id);
Resource* LockForWrite(ResourceId id);
void UnlockForWrite(Resource* resource);
« no previous file with comments | « no previous file | cc/resources/resource_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698