diff options
author | karen@chromium.org <karen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-13 00:33:24 +0000 |
---|---|---|
committer | karen@chromium.org <karen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-13 00:33:24 +0000 |
commit | b465d46a69b7d5138571043e40a803de0f99ce32 (patch) | |
tree | 8a94ed08604a85c8c85dd9c9d54f66624d09aa14 /ppapi/shared_impl/resource_tracker.cc | |
parent | 4e8ee2c45974f220f1f46fbe4ca6c72aac518555 (diff) | |
download | chromium_src-b465d46a69b7d5138571043e40a803de0f99ce32.zip chromium_src-b465d46a69b7d5138571043e40a803de0f99ce32.tar.gz chromium_src-b465d46a69b7d5138571043e40a803de0f99ce32.tar.bz2 |
Revert 187427 "PPAPI: Remove threading options; it's always on"
> PPAPI: Remove threading options; it's always on
>
> This also re-enables thread checking for the host side resource and var trackers. Before, checking was disabled everywhere.
>
> BUG=159240,92909
>
>
> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=186925
> Reverted: https://src.chromium.org/viewvc/chrome?view=rev&revision=186939 due to build errors
>
> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=187340
>
> Review URL: https://chromiumcodereview.appspot.com/12378050
TBR=dmichael@chromium.org
Review URL: https://codereview.chromium.org/12457021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@187716 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/shared_impl/resource_tracker.cc')
-rw-r--r-- | ppapi/shared_impl/resource_tracker.cc | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/ppapi/shared_impl/resource_tracker.cc b/ppapi/shared_impl/resource_tracker.cc index a46c823..a448ce4 100644 --- a/ppapi/shared_impl/resource_tracker.cc +++ b/ppapi/shared_impl/resource_tracker.cc @@ -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 @@ Resource* ResourceTracker::GetResource(PP_Resource res) const { } 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::AddRefResource(PP_Resource res) { } 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::ReleaseResourceSoon(PP_Resource res) { } 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::DidCreateInstance(PP_Instance instance) { } 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 @@ void ResourceTracker::DidDeleteInstance(PP_Instance instance) { } 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 @@ int ResourceTracker::GetLiveObjectsForInstance(PP_Instance instance) const { } 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 @@ PP_Resource ResourceTracker::AddResource(Resource* object) { } 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()) |