Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(339)

Unified Diff: ppapi/shared_impl/resource_tracker.cc

Issue 10912086: Add CHECKs to ensure that PPAPI resources are created on the right thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/shared_impl/resource_tracker.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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())
« no previous file with comments | « ppapi/shared_impl/resource_tracker.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698