Index: ppapi/shared_impl/resource_tracker.cc |
diff --git a/ppapi/shared_impl/resource_tracker.cc b/ppapi/shared_impl/resource_tracker.cc |
index 8cfcfb52c35c387cc5fe758535b6afaf528fcd6d..da897743528490ac49949cf66dc357762a4630f8 100644 |
--- a/ppapi/shared_impl/resource_tracker.cc |
+++ b/ppapi/shared_impl/resource_tracker.cc |
@@ -23,6 +23,7 @@ ResourceTracker::~ResourceTracker() { |
} |
Resource* ResourceTracker::GetResource(PP_Resource res) const { |
+ CHECK(thread_checker_.CalledOnValidThread()); |
ResourceMap::const_iterator i = live_resources_.find(res); |
if (i == live_resources_.end()) |
return NULL; |
@@ -30,6 +31,7 @@ Resource* ResourceTracker::GetResource(PP_Resource res) const { |
} |
void ResourceTracker::AddRefResource(PP_Resource res) { |
+ CHECK(thread_checker_.CalledOnValidThread()); |
DLOG_IF(ERROR, !CheckIdType(res, PP_ID_TYPE_RESOURCE)) |
<< res << " is not a PP_Resource."; |
ResourceMap::iterator i = live_resources_.find(res); |
@@ -51,6 +53,7 @@ void ResourceTracker::AddRefResource(PP_Resource res) { |
} |
void ResourceTracker::ReleaseResource(PP_Resource res) { |
+ CHECK(thread_checker_.CalledOnValidThread()); |
DLOG_IF(ERROR, !CheckIdType(res, PP_ID_TYPE_RESOURCE)) |
<< res << " is not a PP_Resource."; |
ResourceMap::iterator i = live_resources_.find(res); |
@@ -81,6 +84,7 @@ void ResourceTracker::ReleaseResourceSoon(PP_Resource res) { |
} |
void ResourceTracker::DidCreateInstance(PP_Instance instance) { |
+ CHECK(thread_checker_.CalledOnValidThread()); |
// Due to the infrastructure of some tests, the instance is registered |
// twice in a few cases. It would be nice not to do that and assert here |
// instead. |
@@ -90,6 +94,7 @@ void ResourceTracker::DidCreateInstance(PP_Instance instance) { |
} |
void ResourceTracker::DidDeleteInstance(PP_Instance instance) { |
+ CHECK(thread_checker_.CalledOnValidThread()); |
InstanceMap::iterator found_instance = instance_map_.find(instance); |
// Due to the infrastructure of some tests, the instance is unregistered |
@@ -144,6 +149,7 @@ void ResourceTracker::DidDeleteInstance(PP_Instance instance) { |
} |
int ResourceTracker::GetLiveObjectsForInstance(PP_Instance instance) const { |
+ CHECK(thread_checker_.CalledOnValidThread()); |
InstanceMap::const_iterator found = instance_map_.find(instance); |
if (found == instance_map_.end()) |
return 0; |
@@ -151,6 +157,7 @@ int ResourceTracker::GetLiveObjectsForInstance(PP_Instance instance) const { |
} |
PP_Resource ResourceTracker::AddResource(Resource* object) { |
+ CHECK(thread_checker_.CalledOnValidThread()); |
// If the plugin manages to create too many resources, don't do crazy stuff. |
if (last_resource_value_ == kMaxPPId) |
return 0; |
@@ -182,6 +189,7 @@ PP_Resource ResourceTracker::AddResource(Resource* object) { |
} |
void ResourceTracker::RemoveResource(Resource* object) { |
+ CHECK(thread_checker_.CalledOnValidThread()); |
PP_Resource pp_resource = object->pp_resource(); |
InstanceMap::iterator found = instance_map_.find(object->pp_instance()); |
if (found != instance_map_.end()) |