| Index: cc/resource_provider.h
|
| diff --git a/cc/resource_provider.h b/cc/resource_provider.h
|
| index c4776c21f9f6a89b0023abcaf1fd582786f87cb2..ead62a375e82b647bd79ba792e5150463bfeed3a 100644
|
| --- a/cc/resource_provider.h
|
| +++ b/cc/resource_provider.h
|
| @@ -221,6 +221,14 @@ public:
|
| DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockSoftware);
|
| };
|
|
|
| + class Fence : public base::RefCounted<Fence> {
|
| + public:
|
| + virtual bool hasPassed() = 0;
|
| + protected:
|
| + friend class base::RefCounted<Fence>;
|
| + virtual ~Fence() {}
|
| + };
|
| +
|
| // Acquire pixel buffer for resource. The pixel buffer can be used to
|
| // set resource pixels without performing unnecessary copying.
|
| void acquirePixelBuffer(ResourceId id);
|
| @@ -241,6 +249,18 @@ public:
|
| // Use setPixels or lockForWrite to allocate implicitly.
|
| void allocateForTesting(ResourceId id);
|
|
|
| + // Sets the current read fence. If a resource is locked for read
|
| + // and has read fences enabled, the resource will not allow writes
|
| + // until this fence has passed.
|
| + void setReadLockFence(scoped_refptr<Fence> fence) { m_currentReadLockFence = fence; }
|
| + Fence* getReadLockFence() { return m_currentReadLockFence; }
|
| +
|
| + // Enable read lock fences for a specific resource.
|
| + void enableReadLockFences(ResourceProvider::ResourceId, bool enable);
|
| +
|
| + // Indicates if we can currently lock this resource for write.
|
| + bool canLockForWrite(ResourceId);
|
| +
|
| private:
|
| struct Resource {
|
| Resource();
|
| @@ -263,6 +283,8 @@ private:
|
| bool markedForDeletion;
|
| bool pendingSetPixels;
|
| bool allocated;
|
| + bool enableReadLockFences;
|
| + scoped_refptr<Fence> readLockFence;
|
| gfx::Size size;
|
| GLenum format;
|
| // TODO(skyostil): Use a separate sampler object for filter state.
|
| @@ -279,6 +301,9 @@ private:
|
| };
|
| typedef base::hash_map<int, Child> ChildMap;
|
|
|
| + bool readLockFenceHasPassed(Resource* resource) { return !resource->readLockFence ||
|
| + resource->readLockFence->hasPassed(); }
|
| +
|
| explicit ResourceProvider(OutputSurface*);
|
| bool initialize();
|
|
|
| @@ -309,6 +334,8 @@ private:
|
|
|
| base::ThreadChecker m_threadChecker;
|
|
|
| + scoped_refptr<Fence> m_currentReadLockFence;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(ResourceProvider);
|
| };
|
|
|
|
|