Index: cc/resources/resource_provider.h |
diff --git a/cc/resources/resource_provider.h b/cc/resources/resource_provider.h |
index 5c69b0c2621329f40c233c62e1f8c311bb1ae8db..40103f6b3e336c64f48b523d342d365ae7913168 100644 |
--- a/cc/resources/resource_provider.h |
+++ b/cc/resources/resource_provider.h |
@@ -304,6 +304,7 @@ class CC_EXPORT ResourceProvider { |
ResourceProvider::Resource* resource_; |
SkBitmap sk_bitmap_; |
scoped_ptr<SkCanvas> sk_canvas_; |
+ base::ThreadChecker thread_checker_; |
DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockSoftware); |
}; |
@@ -323,6 +324,7 @@ class CC_EXPORT ResourceProvider { |
gfx::GpuMemoryBuffer* gpu_memory_buffer_; |
gfx::Size size_; |
ResourceFormat format_; |
+ base::ThreadChecker thread_checker_; |
DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGpuMemoryBuffer); |
}; |
@@ -338,6 +340,7 @@ class CC_EXPORT ResourceProvider { |
private: |
ResourceProvider* resource_provider_; |
ResourceProvider::Resource* resource_; |
+ base::ThreadChecker thread_checker_; |
DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGr); |
}; |
@@ -348,6 +351,7 @@ class CC_EXPORT ResourceProvider { |
virtual void Set() = 0; |
virtual bool HasPassed() = 0; |
+ virtual void Wait() = 0; |
protected: |
friend class base::RefCounted<Fence>; |
@@ -357,6 +361,29 @@ class CC_EXPORT ResourceProvider { |
DISALLOW_COPY_AND_ASSIGN(Fence); |
}; |
+ class SynchronousFence : public ResourceProvider::Fence { |
+ public: |
+ explicit SynchronousFence(gpu::gles2::GLES2Interface* gl); |
+ |
+ // Overridden from Fence: |
+ void Set() override; |
+ bool HasPassed() override; |
+ void Wait() override; |
+ |
+ // Returns true if fence has been set but not yet synchornized. |
+ bool has_synchronized() const { return has_synchronized_; } |
+ |
+ private: |
+ ~SynchronousFence() override; |
+ |
+ void Synchronize(); |
+ |
+ gpu::gles2::GLES2Interface* gl_; |
+ bool has_synchronized_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(SynchronousFence); |
+ }; |
+ |
// Acquire pixel buffer for resource. The pixel buffer can be used to |
// set resource pixels without performing unnecessary copying. |
void AcquirePixelBuffer(ResourceId resource); |
@@ -391,6 +418,8 @@ class CC_EXPORT ResourceProvider { |
void WaitSyncPointIfNeeded(ResourceId id); |
+ void WaitReadLockIfNeeded(ResourceId id); |
+ |
static GLint GetActiveTextureUnit(gpu::gles2::GLES2Interface* gl); |
private: |
@@ -560,6 +589,8 @@ class CC_EXPORT ResourceProvider { |
scoped_ptr<IdAllocator> buffer_id_allocator_; |
bool use_sync_query_; |
+ // Fence used for CopyResource if CHROMIUM_sync_query is not supported. |
+ scoped_refptr<SynchronousFence> synchronous_fence_; |
DISALLOW_COPY_AND_ASSIGN(ResourceProvider); |
}; |