summaryrefslogtreecommitdiffstats
path: root/cc/resource_provider.cc
diff options
context:
space:
mode:
authorccameron@chromium.org <ccameron@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-24 20:13:32 +0000
committerccameron@chromium.org <ccameron@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-24 20:13:32 +0000
commit179530896ee4dae629702ebf402d867782247bb4 (patch)
tree1a58d4a663fdf1b77c18450e49fe12115993558c /cc/resource_provider.cc
parentf10467372b7cc985a8f824c7b0298492e2c24c73 (diff)
downloadchromium_src-179530896ee4dae629702ebf402d867782247bb4.zip
chromium_src-179530896ee4dae629702ebf402d867782247bb4.tar.gz
chromium_src-179530896ee4dae629702ebf402d867782247bb4.tar.bz2
Re-introduce crash instrumentation for invalid resources.
A bug that could cause this crash was fixed, but we're still seeing crash reports. BUG=151428 Review URL: https://chromiumcodereview.appspot.com/11238073 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163889 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/resource_provider.cc')
-rw-r--r--cc/resource_provider.cc38
1 files changed, 37 insertions, 1 deletions
diff --git a/cc/resource_provider.cc b/cc/resource_provider.cc
index 0013126..4949a6b 100644
--- a/cc/resource_provider.cc
+++ b/cc/resource_provider.cc
@@ -24,6 +24,15 @@
using WebKit::WebGraphicsContext3D;
+namespace {
+ // Temporary variables for debugging crashes in issue 151428 in canary.
+ // Do not use these!
+ const int g_debugMaxResourcesTracked = 64;
+ unsigned int g_debugZone = 0;
+ int64 g_debugResDestroyedCount = 0;
+ cc::ResourceProvider::ResourceId g_debugResDestroyed[g_debugMaxResourcesTracked] = { 0 };
+}
+
namespace cc {
static GLenum textureToStorageFormat(GLenum textureFormat)
@@ -232,6 +241,7 @@ void ResourceProvider::deleteResourceInternal(ResourceMap::iterator it)
if (resource->pixels)
delete resource->pixels;
+ g_debugResDestroyed[g_debugResDestroyedCount % g_debugMaxResourcesTracked] = (*it).first | g_debugZone;
m_resources.erase(it);
}
@@ -341,7 +351,22 @@ const ResourceProvider::Resource* ResourceProvider::lockForRead(ResourceId id)
{
DCHECK(Proxy::isImplThread());
ResourceMap::iterator it = m_resources.find(id);
- CHECK(it != m_resources.end());
+
+ if (it == m_resources.end()) {
+ int resourceCount = m_resources.size();
+ int64 resDestroyedCount = g_debugResDestroyedCount;
+ ResourceId resDestroyed[g_debugMaxResourcesTracked];
+ for (int64 i = 0; i < g_debugMaxResourcesTracked; ++i)
+ resDestroyed[i] = g_debugResDestroyed[i];
+ ResourceId resToDestroy = id;
+
+ base::debug::Alias(&resourceCount);
+ base::debug::Alias(&resDestroyedCount);
+ for (int64 i = 0; i < g_debugMaxResourcesTracked; ++i)
+ base::debug::Alias(&resDestroyed[i]);
+ base::debug::Alias(&resToDestroy);
+ CHECK(it != m_resources.end());
+ }
Resource* resource = &it->second;
DCHECK(!resource->lockedForWrite);
@@ -678,4 +703,15 @@ void ResourceProvider::trimMailboxDeque()
m_mailboxes.pop_front();
}
+void ResourceProvider::debugNotifyEnterZone(unsigned int zone)
+{
+ g_debugZone = zone;
+}
+
+void ResourceProvider::debugNotifyLeaveZone()
+{
+ g_debugZone = 0;
+}
+
+
}