| Index: cc/resource_provider.cc
|
| diff --git a/cc/resource_provider.cc b/cc/resource_provider.cc
|
| index eb17f188fef9edb5cc7465dd94ab1e451a96192d..9f22193ee242d060185765b79475ba5b2545dd3a 100644
|
| --- a/cc/resource_provider.cc
|
| +++ b/cc/resource_provider.cc
|
| @@ -14,7 +14,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"
|
| @@ -138,13 +137,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;
|
| @@ -167,7 +166,7 @@ ResourceProvider::ResourceId ResourceProvider::createResource(int pool, const gf
|
|
|
| ResourceProvider::ResourceId ResourceProvider::createGLTexture(int pool, const gfx::Size& size, GLenum format, TextureUsageHint hint)
|
| {
|
| - DCHECK(Proxy::isImplThread());
|
| + DCHECK(m_threadChecker.CalledOnValidThread());
|
| unsigned textureId = 0;
|
| WebGraphicsContext3D* context3d = m_context->context3D();
|
| DCHECK(context3d);
|
| @@ -193,7 +192,7 @@ ResourceProvider::ResourceId ResourceProvider::createGLTexture(int pool, const g
|
|
|
| ResourceProvider::ResourceId ResourceProvider::createBitmap(int pool, const gfx::Size& size)
|
| {
|
| - DCHECK(Proxy::isImplThread());
|
| + DCHECK(m_threadChecker.CalledOnValidThread());
|
|
|
| uint8_t* pixels = new uint8_t[size.width() * size.height() * 4];
|
|
|
| @@ -205,7 +204,7 @@ ResourceProvider::ResourceId ResourceProvider::createBitmap(int pool, const gfx:
|
|
|
| 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, gfx::Size(), 0);
|
| @@ -216,7 +215,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;
|
| @@ -248,7 +247,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)
|
| @@ -268,7 +267,7 @@ ResourceProvider::ResourceType ResourceProvider::resourceType(ResourceId id)
|
|
|
| void ResourceProvider::setPixels(ResourceId id, const uint8_t* image, const gfx::Rect& imageRect, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset)
|
| {
|
| - DCHECK(Proxy::isImplThread());
|
| + DCHECK(m_threadChecker.CalledOnValidThread());
|
| ResourceMap::iterator it = m_resources.find(id);
|
| CHECK(it != m_resources.end());
|
| Resource* resource = &it->second;
|
| @@ -331,7 +330,7 @@ double ResourceProvider::estimatedUploadsPerSecond()
|
|
|
| void ResourceProvider::flush()
|
| {
|
| - DCHECK(Proxy::isImplThread());
|
| + DCHECK(m_threadChecker.CalledOnValidThread());
|
| WebGraphicsContext3D* context3d = m_context->context3D();
|
| if (context3d)
|
| context3d->flush();
|
| @@ -339,7 +338,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;
|
| @@ -350,7 +349,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()) {
|
| @@ -378,7 +377,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;
|
| @@ -389,7 +388,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;
|
| @@ -403,7 +402,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;
|
| @@ -486,7 +485,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;
|
| @@ -522,7 +521,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++;
|
| @@ -532,7 +531,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);
|
| @@ -542,7 +541,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;
|
| @@ -550,7 +549,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();
|
| @@ -572,7 +571,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();
|
| @@ -599,7 +598,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.
|
| @@ -631,7 +630,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.
|
| @@ -655,7 +654,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;
|
|
|