summaryrefslogtreecommitdiffstats
path: root/cc/resources
diff options
context:
space:
mode:
authordanakj <danakj@chromium.org>2015-04-07 13:14:39 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-07 20:15:25 +0000
commit26bcd452dc068c3bee6f2b5b31b10cab2076137b (patch)
treec19785bdaf9e1e98cc1fb496a56ef7e89f274e6a /cc/resources
parentedd17a1c50939a325590c6061c14da17690fb71e (diff)
downloadchromium_src-26bcd452dc068c3bee6f2b5b31b10cab2076137b.zip
chromium_src-26bcd452dc068c3bee6f2b5b31b10cab2076137b.tar.gz
chromium_src-26bcd452dc068c3bee6f2b5b31b10cab2076137b.tar.bz2
cc: Add ResourceId validation checks at the time of AppendQuads.
This will help us track down how an invalid resource is ending up in the frame hopefully. R=enne, piman@chromium.org BUG=455931 Review URL: https://codereview.chromium.org/1062043003 Cr-Commit-Position: refs/heads/master@{#324103}
Diffstat (limited to 'cc/resources')
-rw-r--r--cc/resources/resource_provider.cc9
-rw-r--r--cc/resources/resource_provider.h2
2 files changed, 10 insertions, 1 deletions
diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc
index 9e95d1c..5428c94 100644
--- a/cc/resources/resource_provider.cc
+++ b/cc/resources/resource_provider.cc
@@ -870,7 +870,7 @@ base::TimeTicks ResourceProvider::EstimatedUploadCompletionTime(
ResourceProvider::Resource* ResourceProvider::GetResource(ResourceId id) {
DCHECK(thread_checker_.CalledOnValidThread());
- // Try to differentiate GetResource with a bad id vs with no id.
+ // TODO(danakj): crbug.com/455931
CHECK(id);
ResourceMap::iterator it = resources_.find(id);
CHECK(it != resources_.end());
@@ -2132,6 +2132,13 @@ GLint ResourceProvider::GetActiveTextureUnit(GLES2Interface* gl) {
return active_unit;
}
+void ResourceProvider::ValidateResource(ResourceId id) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ CHECK(id);
+ ResourceMap::iterator it = resources_.find(id);
+ CHECK(it != resources_.end());
+}
+
GLES2Interface* ResourceProvider::ContextGL() const {
ContextProvider* context_provider = output_surface_->context_provider();
return context_provider ? context_provider->ContextGL() : NULL;
diff --git a/cc/resources/resource_provider.h b/cc/resources/resource_provider.h
index aa8c761..bfd2a16 100644
--- a/cc/resources/resource_provider.h
+++ b/cc/resources/resource_provider.h
@@ -435,6 +435,8 @@ class CC_EXPORT ResourceProvider {
OutputSurface* output_surface() { return output_surface_; }
+ void ValidateResource(ResourceId id);
+
private:
struct Resource {
enum Origin { INTERNAL, EXTERNAL, DELEGATED };