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

Unified Diff: ppapi/shared_impl/resource_tracker.cc

Issue 12476028: Revert 187340 "PPAPI: Remove threading options; it's always on" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 9 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') | ppapi/shared_impl/test_globals.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/shared_impl/resource_tracker.cc
===================================================================
--- ppapi/shared_impl/resource_tracker.cc (revision 187345)
+++ ppapi/shared_impl/resource_tracker.cc (working copy)
@@ -15,23 +15,17 @@
namespace ppapi {
-ResourceTracker::ResourceTracker(ThreadMode thread_mode)
+ResourceTracker::ResourceTracker()
: last_resource_value_(0),
ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) {
- if (thread_mode == SINGLE_THREADED)
- thread_checker_.reset(new base::ThreadChecker);
}
ResourceTracker::~ResourceTracker() {
}
-void ResourceTracker::CheckThreadingPreconditions() const {
- DCHECK(!thread_checker_ || thread_checker_->CalledOnValidThread());
- ProxyLock::AssertAcquired();
-}
-
Resource* ResourceTracker::GetResource(PP_Resource res) const {
- CheckThreadingPreconditions();
+ CHECK(thread_checker_.CalledOnValidThread());
+ ProxyLock::AssertAcquired();
ResourceMap::const_iterator i = live_resources_.find(res);
if (i == live_resources_.end())
return NULL;
@@ -39,7 +33,7 @@
}
void ResourceTracker::AddRefResource(PP_Resource res) {
- CheckThreadingPreconditions();
+ 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);
@@ -61,7 +55,7 @@
}
void ResourceTracker::ReleaseResource(PP_Resource res) {
- CheckThreadingPreconditions();
+ 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);
@@ -92,7 +86,7 @@
}
void ResourceTracker::DidCreateInstance(PP_Instance instance) {
- CheckThreadingPreconditions();
+ 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.
@@ -102,7 +96,7 @@
}
void ResourceTracker::DidDeleteInstance(PP_Instance instance) {
- CheckThreadingPreconditions();
+ CHECK(thread_checker_.CalledOnValidThread());
InstanceMap::iterator found_instance = instance_map_.find(instance);
// Due to the infrastructure of some tests, the instance is unregistered
@@ -157,7 +151,7 @@
}
int ResourceTracker::GetLiveObjectsForInstance(PP_Instance instance) const {
- CheckThreadingPreconditions();
+ CHECK(thread_checker_.CalledOnValidThread());
InstanceMap::const_iterator found = instance_map_.find(instance);
if (found == instance_map_.end())
return 0;
@@ -165,7 +159,7 @@
}
PP_Resource ResourceTracker::AddResource(Resource* object) {
- CheckThreadingPreconditions();
+ 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;
@@ -197,7 +191,7 @@
}
void ResourceTracker::RemoveResource(Resource* object) {
- CheckThreadingPreconditions();
+ 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') | ppapi/shared_impl/test_globals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698