| Index: cc/resource_provider.cc
|
| ===================================================================
|
| --- cc/resource_provider.cc (revision 165906)
|
| +++ cc/resource_provider.cc (working copy)
|
| @@ -14,6 +14,7 @@
|
| #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 "cc/transferable_resource.h"
|
| #include "third_party/khronos/GLES2/gl2.h"
|
| @@ -130,13 +131,13 @@
|
|
|
| WebGraphicsContext3D* ResourceProvider::graphicsContext3D()
|
| {
|
| - DCHECK(m_threadChecker.CalledOnValidThread());
|
| + DCHECK(Proxy::isImplThread());
|
| return m_context->context3D();
|
| }
|
|
|
| bool ResourceProvider::inUseByConsumer(ResourceId id)
|
| {
|
| - DCHECK(m_threadChecker.CalledOnValidThread());
|
| + DCHECK(Proxy::isImplThread());
|
| ResourceMap::iterator it = m_resources.find(id);
|
| CHECK(it != m_resources.end());
|
| Resource* resource = &it->second;
|
| @@ -159,7 +160,7 @@
|
|
|
| ResourceProvider::ResourceId ResourceProvider::createGLTexture(int pool, const gfx::Size& size, GLenum format, TextureUsageHint hint)
|
| {
|
| - DCHECK(m_threadChecker.CalledOnValidThread());
|
| + DCHECK(Proxy::isImplThread());
|
| unsigned textureId = 0;
|
| WebGraphicsContext3D* context3d = m_context->context3D();
|
| DCHECK(context3d);
|
| @@ -185,7 +186,7 @@
|
|
|
| ResourceProvider::ResourceId ResourceProvider::createBitmap(int pool, const gfx::Size& size)
|
| {
|
| - DCHECK(m_threadChecker.CalledOnValidThread());
|
| + DCHECK(Proxy::isImplThread());
|
|
|
| uint8_t* pixels = new uint8_t[size.width() * size.height() * 4];
|
|
|
| @@ -197,7 +198,7 @@
|
|
|
| ResourceProvider::ResourceId ResourceProvider::createResourceFromExternalTexture(unsigned textureId)
|
| {
|
| - DCHECK(m_threadChecker.CalledOnValidThread());
|
| + DCHECK(Proxy::isImplThread());
|
| DCHECK(m_context->context3D());
|
| ResourceId id = m_nextId++;
|
| Resource resource(textureId, 0, gfx::Size(), 0);
|
| @@ -208,7 +209,7 @@
|
|
|
| void ResourceProvider::deleteResource(ResourceId id)
|
| {
|
| - DCHECK(m_threadChecker.CalledOnValidThread());
|
| + DCHECK(Proxy::isImplThread());
|
| ResourceMap::iterator it = m_resources.find(id);
|
| CHECK(it != m_resources.end());
|
| Resource* resource = &it->second;
|
| @@ -240,7 +241,7 @@
|
|
|
| void ResourceProvider::deleteOwnedResources(int pool)
|
| {
|
| - DCHECK(m_threadChecker.CalledOnValidThread());
|
| + DCHECK(Proxy::isImplThread());
|
| 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)
|
| @@ -260,7 +261,7 @@
|
|
|
| void ResourceProvider::setPixels(ResourceId id, const uint8_t* image, const gfx::Rect& imageRect, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset)
|
| {
|
| - DCHECK(m_threadChecker.CalledOnValidThread());
|
| + DCHECK(Proxy::isImplThread());
|
| ResourceMap::iterator it = m_resources.find(id);
|
| CHECK(it != m_resources.end());
|
| Resource* resource = &it->second;
|
| @@ -331,7 +332,7 @@
|
|
|
| void ResourceProvider::flush()
|
| {
|
| - DCHECK(m_threadChecker.CalledOnValidThread());
|
| + DCHECK(Proxy::isImplThread());
|
| WebGraphicsContext3D* context3d = m_context->context3D();
|
| if (context3d)
|
| context3d->flush();
|
| @@ -339,7 +340,7 @@
|
|
|
| bool ResourceProvider::shallowFlushIfSupported()
|
| {
|
| - DCHECK(m_threadChecker.CalledOnValidThread());
|
| + DCHECK(Proxy::isImplThread());
|
| WebGraphicsContext3D* context3d = m_context->context3D();
|
| if (!context3d || !m_useShallowFlush)
|
| return false;
|
| @@ -350,7 +351,7 @@
|
|
|
| const ResourceProvider::Resource* ResourceProvider::lockForRead(ResourceId id)
|
| {
|
| - DCHECK(m_threadChecker.CalledOnValidThread());
|
| + DCHECK(Proxy::isImplThread());
|
| ResourceMap::iterator it = m_resources.find(id);
|
|
|
| if (it == m_resources.end()) {
|
| @@ -378,7 +379,7 @@
|
|
|
| void ResourceProvider::unlockForRead(ResourceId id)
|
| {
|
| - DCHECK(m_threadChecker.CalledOnValidThread());
|
| + DCHECK(Proxy::isImplThread());
|
| ResourceMap::iterator it = m_resources.find(id);
|
| CHECK(it != m_resources.end());
|
| Resource* resource = &it->second;
|
| @@ -389,7 +390,7 @@
|
|
|
| const ResourceProvider::Resource* ResourceProvider::lockForWrite(ResourceId id)
|
| {
|
| - DCHECK(m_threadChecker.CalledOnValidThread());
|
| + DCHECK(Proxy::isImplThread());
|
| ResourceMap::iterator it = m_resources.find(id);
|
| CHECK(it != m_resources.end());
|
| Resource* resource = &it->second;
|
| @@ -403,7 +404,7 @@
|
|
|
| void ResourceProvider::unlockForWrite(ResourceId id)
|
| {
|
| - DCHECK(m_threadChecker.CalledOnValidThread());
|
| + DCHECK(Proxy::isImplThread());
|
| ResourceMap::iterator it = m_resources.find(id);
|
| CHECK(it != m_resources.end());
|
| Resource* resource = &it->second;
|
| @@ -486,7 +487,7 @@
|
|
|
| bool ResourceProvider::initialize()
|
| {
|
| - DCHECK(m_threadChecker.CalledOnValidThread());
|
| + DCHECK(Proxy::isImplThread());
|
| WebGraphicsContext3D* context3d = m_context->context3D();
|
| if (!context3d) {
|
| m_maxTextureSize = INT_MAX / 2;
|
| @@ -522,7 +523,7 @@
|
|
|
| int ResourceProvider::createChild(int pool)
|
| {
|
| - DCHECK(m_threadChecker.CalledOnValidThread());
|
| + DCHECK(Proxy::isImplThread());
|
| Child childInfo;
|
| childInfo.pool = pool;
|
| int child = m_nextChild++;
|
| @@ -532,7 +533,7 @@
|
|
|
| void ResourceProvider::destroyChild(int child)
|
| {
|
| - DCHECK(m_threadChecker.CalledOnValidThread());
|
| + DCHECK(Proxy::isImplThread());
|
| ChildMap::iterator it = m_children.find(child);
|
| DCHECK(it != m_children.end());
|
| deleteOwnedResources(it->second.pool);
|
| @@ -542,7 +543,7 @@
|
|
|
| const ResourceProvider::ResourceIdMap& ResourceProvider::getChildToParentMap(int child) const
|
| {
|
| - DCHECK(m_threadChecker.CalledOnValidThread());
|
| + DCHECK(Proxy::isImplThread());
|
| ChildMap::const_iterator it = m_children.find(child);
|
| DCHECK(it != m_children.end());
|
| return it->second.childToParentMap;
|
| @@ -550,7 +551,7 @@
|
|
|
| void ResourceProvider::prepareSendToParent(const ResourceIdArray& resources, TransferableResourceList* list)
|
| {
|
| - DCHECK(m_threadChecker.CalledOnValidThread());
|
| + DCHECK(Proxy::isImplThread());
|
| list->sync_point = 0;
|
| list->resources.clear();
|
| WebGraphicsContext3D* context3d = m_context->context3D();
|
| @@ -571,7 +572,7 @@
|
|
|
| void ResourceProvider::prepareSendToChild(int child, const ResourceIdArray& resources, TransferableResourceList* list)
|
| {
|
| - DCHECK(m_threadChecker.CalledOnValidThread());
|
| + DCHECK(Proxy::isImplThread());
|
| list->sync_point = 0;
|
| list->resources.clear();
|
| WebGraphicsContext3D* context3d = m_context->context3D();
|
| @@ -597,7 +598,7 @@
|
|
|
| void ResourceProvider::receiveFromChild(int child, const TransferableResourceList& resources)
|
| {
|
| - DCHECK(m_threadChecker.CalledOnValidThread());
|
| + DCHECK(Proxy::isImplThread());
|
| WebGraphicsContext3D* context3d = m_context->context3D();
|
| if (!context3d || !context3d->makeContextCurrent()) {
|
| // FIXME: Implement this path for software compositing.
|
| @@ -629,7 +630,7 @@
|
|
|
| void ResourceProvider::receiveFromParent(const TransferableResourceList& resources)
|
| {
|
| - DCHECK(m_threadChecker.CalledOnValidThread());
|
| + DCHECK(Proxy::isImplThread());
|
| WebGraphicsContext3D* context3d = m_context->context3D();
|
| if (!context3d || !context3d->makeContextCurrent()) {
|
| // FIXME: Implement this path for software compositing.
|
| @@ -653,7 +654,7 @@
|
|
|
| bool ResourceProvider::transferResource(WebGraphicsContext3D* context, ResourceId id, TransferableResource* resource)
|
| {
|
| - DCHECK(m_threadChecker.CalledOnValidThread());
|
| + DCHECK(Proxy::isImplThread());
|
| ResourceMap::const_iterator it = m_resources.find(id);
|
| CHECK(it != m_resources.end());
|
| const Resource* source = &it->second;
|
|
|