| Index: cc/resource_provider.cc
|
| diff --git a/cc/resource_provider.cc b/cc/resource_provider.cc
|
| index 4949a6b43ef5fa28200850b3fafdb22a2bb67bbc..5b46671c8a4771d5ee3667f32cb723ae1b01ccaf 100644
|
| --- a/cc/resource_provider.cc
|
| +++ b/cc/resource_provider.cc
|
| @@ -15,7 +15,6 @@
|
| #include "base/string_split.h"
|
| #include "base/string_util.h"
|
| #include "cc/gl_renderer.h" // For the GLC() macro.
|
| -#include "cc/proxy.h"
|
| #include "cc/texture_uploader.h"
|
| #include "third_party/khronos/GLES2/gl2.h"
|
| #include "third_party/khronos/GLES2/gl2ext.h"
|
| @@ -137,13 +136,13 @@ ResourceProvider::~ResourceProvider()
|
|
|
| WebGraphicsContext3D* ResourceProvider::graphicsContext3D()
|
| {
|
| - DCHECK(Proxy::isImplThread());
|
| + DCHECK(m_threadChecker.CalledOnValidThread());
|
| return m_context->context3D();
|
| }
|
|
|
| bool ResourceProvider::inUseByConsumer(ResourceId id)
|
| {
|
| - DCHECK(Proxy::isImplThread());
|
| + DCHECK(m_threadChecker.CalledOnValidThread());
|
| ResourceMap::iterator it = m_resources.find(id);
|
| CHECK(it != m_resources.end());
|
| Resource* resource = &it->second;
|
| @@ -166,7 +165,7 @@ ResourceProvider::ResourceId ResourceProvider::createResource(int pool, const In
|
|
|
| ResourceProvider::ResourceId ResourceProvider::createGLTexture(int pool, const IntSize& size, GLenum format, TextureUsageHint hint)
|
| {
|
| - DCHECK(Proxy::isImplThread());
|
| + DCHECK(m_threadChecker.CalledOnValidThread());
|
| unsigned textureId = 0;
|
| WebGraphicsContext3D* context3d = m_context->context3D();
|
| DCHECK(context3d);
|
| @@ -192,7 +191,7 @@ ResourceProvider::ResourceId ResourceProvider::createGLTexture(int pool, const I
|
|
|
| ResourceProvider::ResourceId ResourceProvider::createBitmap(int pool, const IntSize& size)
|
| {
|
| - DCHECK(Proxy::isImplThread());
|
| + DCHECK(m_threadChecker.CalledOnValidThread());
|
|
|
| uint8_t* pixels = new uint8_t[size.width() * size.height() * 4];
|
|
|
| @@ -204,7 +203,7 @@ ResourceProvider::ResourceId ResourceProvider::createBitmap(int pool, const IntS
|
|
|
| ResourceProvider::ResourceId ResourceProvider::createResourceFromExternalTexture(unsigned textureId)
|
| {
|
| - DCHECK(Proxy::isImplThread());
|
| + DCHECK(m_threadChecker.CalledOnValidThread());
|
| DCHECK(m_context->context3D());
|
| ResourceId id = m_nextId++;
|
| Resource resource(textureId, 0, IntSize(), 0);
|
| @@ -215,7 +214,7 @@ ResourceProvider::ResourceId ResourceProvider::createResourceFromExternalTexture
|
|
|
| void ResourceProvider::deleteResource(ResourceId id)
|
| {
|
| - DCHECK(Proxy::isImplThread());
|
| + DCHECK(m_threadChecker.CalledOnValidThread());
|
| ResourceMap::iterator it = m_resources.find(id);
|
| CHECK(it != m_resources.end());
|
| Resource* resource = &it->second;
|
| @@ -247,7 +246,7 @@ void ResourceProvider::deleteResourceInternal(ResourceMap::iterator it)
|
|
|
| void ResourceProvider::deleteOwnedResources(int pool)
|
| {
|
| - DCHECK(Proxy::isImplThread());
|
| + DCHECK(m_threadChecker.CalledOnValidThread());
|
| ResourceIdArray toDelete;
|
| for (ResourceMap::iterator it = m_resources.begin(); it != m_resources.end(); ++it) {
|
| if (it->second.pool == pool && !it->second.external && !it->second.markedForDeletion)
|
| @@ -267,7 +266,7 @@ ResourceProvider::ResourceType ResourceProvider::resourceType(ResourceId id)
|
|
|
| void ResourceProvider::upload(ResourceId id, const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntSize& destOffset)
|
| {
|
| - DCHECK(Proxy::isImplThread());
|
| + DCHECK(m_threadChecker.CalledOnValidThread());
|
| ResourceMap::iterator it = m_resources.find(id);
|
| CHECK(it != m_resources.end());
|
| Resource* resource = &it->second;
|
| @@ -330,7 +329,7 @@ double ResourceProvider::estimatedUploadsPerSecond()
|
|
|
| void ResourceProvider::flush()
|
| {
|
| - DCHECK(Proxy::isImplThread());
|
| + DCHECK(m_threadChecker.CalledOnValidThread());
|
| WebGraphicsContext3D* context3d = m_context->context3D();
|
| if (context3d)
|
| context3d->flush();
|
| @@ -338,7 +337,7 @@ void ResourceProvider::flush()
|
|
|
| bool ResourceProvider::shallowFlushIfSupported()
|
| {
|
| - DCHECK(Proxy::isImplThread());
|
| + DCHECK(m_threadChecker.CalledOnValidThread());
|
| WebGraphicsContext3D* context3d = m_context->context3D();
|
| if (!context3d || !m_useShallowFlush)
|
| return false;
|
| @@ -349,7 +348,7 @@ bool ResourceProvider::shallowFlushIfSupported()
|
|
|
| const ResourceProvider::Resource* ResourceProvider::lockForRead(ResourceId id)
|
| {
|
| - DCHECK(Proxy::isImplThread());
|
| + DCHECK(m_threadChecker.CalledOnValidThread());
|
| ResourceMap::iterator it = m_resources.find(id);
|
|
|
| if (it == m_resources.end()) {
|
| @@ -377,7 +376,7 @@ const ResourceProvider::Resource* ResourceProvider::lockForRead(ResourceId id)
|
|
|
| void ResourceProvider::unlockForRead(ResourceId id)
|
| {
|
| - DCHECK(Proxy::isImplThread());
|
| + DCHECK(m_threadChecker.CalledOnValidThread());
|
| ResourceMap::iterator it = m_resources.find(id);
|
| CHECK(it != m_resources.end());
|
| Resource* resource = &it->second;
|
| @@ -388,7 +387,7 @@ void ResourceProvider::unlockForRead(ResourceId id)
|
|
|
| const ResourceProvider::Resource* ResourceProvider::lockForWrite(ResourceId id)
|
| {
|
| - DCHECK(Proxy::isImplThread());
|
| + DCHECK(m_threadChecker.CalledOnValidThread());
|
| ResourceMap::iterator it = m_resources.find(id);
|
| CHECK(it != m_resources.end());
|
| Resource* resource = &it->second;
|
| @@ -402,7 +401,7 @@ const ResourceProvider::Resource* ResourceProvider::lockForWrite(ResourceId id)
|
|
|
| void ResourceProvider::unlockForWrite(ResourceId id)
|
| {
|
| - DCHECK(Proxy::isImplThread());
|
| + DCHECK(m_threadChecker.CalledOnValidThread());
|
| ResourceMap::iterator it = m_resources.find(id);
|
| CHECK(it != m_resources.end());
|
| Resource* resource = &it->second;
|
| @@ -485,7 +484,7 @@ ResourceProvider::ResourceProvider(GraphicsContext* context)
|
|
|
| bool ResourceProvider::initialize()
|
| {
|
| - DCHECK(Proxy::isImplThread());
|
| + DCHECK(m_threadChecker.CalledOnValidThread());
|
| WebGraphicsContext3D* context3d = m_context->context3D();
|
| if (!context3d) {
|
| m_maxTextureSize = INT_MAX / 2;
|
| @@ -521,7 +520,7 @@ bool ResourceProvider::initialize()
|
|
|
| int ResourceProvider::createChild(int pool)
|
| {
|
| - DCHECK(Proxy::isImplThread());
|
| + DCHECK(m_threadChecker.CalledOnValidThread());
|
| Child childInfo;
|
| childInfo.pool = pool;
|
| int child = m_nextChild++;
|
| @@ -531,7 +530,7 @@ int ResourceProvider::createChild(int pool)
|
|
|
| void ResourceProvider::destroyChild(int child)
|
| {
|
| - DCHECK(Proxy::isImplThread());
|
| + DCHECK(m_threadChecker.CalledOnValidThread());
|
| ChildMap::iterator it = m_children.find(child);
|
| DCHECK(it != m_children.end());
|
| deleteOwnedResources(it->second.pool);
|
| @@ -541,7 +540,7 @@ void ResourceProvider::destroyChild(int child)
|
|
|
| const ResourceProvider::ResourceIdMap& ResourceProvider::getChildToParentMap(int child) const
|
| {
|
| - DCHECK(Proxy::isImplThread());
|
| + DCHECK(m_threadChecker.CalledOnValidThread());
|
| ChildMap::const_iterator it = m_children.find(child);
|
| DCHECK(it != m_children.end());
|
| return it->second.childToParentMap;
|
| @@ -549,7 +548,7 @@ const ResourceProvider::ResourceIdMap& ResourceProvider::getChildToParentMap(int
|
|
|
| ResourceProvider::TransferableResourceList ResourceProvider::prepareSendToParent(const ResourceIdArray& resources)
|
| {
|
| - DCHECK(Proxy::isImplThread());
|
| + DCHECK(m_threadChecker.CalledOnValidThread());
|
| TransferableResourceList list;
|
| list.syncPoint = 0;
|
| WebGraphicsContext3D* context3d = m_context->context3D();
|
| @@ -571,7 +570,7 @@ ResourceProvider::TransferableResourceList ResourceProvider::prepareSendToParent
|
|
|
| ResourceProvider::TransferableResourceList ResourceProvider::prepareSendToChild(int child, const ResourceIdArray& resources)
|
| {
|
| - DCHECK(Proxy::isImplThread());
|
| + DCHECK(m_threadChecker.CalledOnValidThread());
|
| TransferableResourceList list;
|
| list.syncPoint = 0;
|
| WebGraphicsContext3D* context3d = m_context->context3D();
|
| @@ -598,7 +597,7 @@ ResourceProvider::TransferableResourceList ResourceProvider::prepareSendToChild(
|
|
|
| void ResourceProvider::receiveFromChild(int child, const TransferableResourceList& resources)
|
| {
|
| - DCHECK(Proxy::isImplThread());
|
| + DCHECK(m_threadChecker.CalledOnValidThread());
|
| WebGraphicsContext3D* context3d = m_context->context3D();
|
| if (!context3d || !context3d->makeContextCurrent()) {
|
| // FIXME: Implement this path for software compositing.
|
| @@ -630,7 +629,7 @@ void ResourceProvider::receiveFromChild(int child, const TransferableResourceLis
|
|
|
| void ResourceProvider::receiveFromParent(const TransferableResourceList& resources)
|
| {
|
| - DCHECK(Proxy::isImplThread());
|
| + DCHECK(m_threadChecker.CalledOnValidThread());
|
| WebGraphicsContext3D* context3d = m_context->context3D();
|
| if (!context3d || !context3d->makeContextCurrent()) {
|
| // FIXME: Implement this path for software compositing.
|
| @@ -654,7 +653,7 @@ void ResourceProvider::receiveFromParent(const TransferableResourceList& resourc
|
|
|
| bool ResourceProvider::transferResource(WebGraphicsContext3D* context, ResourceId id, TransferableResource* resource)
|
| {
|
| - DCHECK(Proxy::isImplThread());
|
| + DCHECK(m_threadChecker.CalledOnValidThread());
|
| ResourceMap::const_iterator it = m_resources.find(id);
|
| CHECK(it != m_resources.end());
|
| const Resource* source = &it->second;
|
|
|