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

Unified Diff: trunk/src/ppapi/shared_impl/var_tracker.cc

Issue 12920003: Revert 189518 "PPAPI: Remove threading options; it's always on" (Closed) Base URL: svn://svn.chromium.org/chrome/
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 | « trunk/src/ppapi/shared_impl/var_tracker.h ('k') | trunk/src/ppapi/tests/test_case.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/ppapi/shared_impl/var_tracker.cc
===================================================================
--- trunk/src/ppapi/shared_impl/var_tracker.cc (revision 189681)
+++ trunk/src/ppapi/shared_impl/var_tracker.cc (working copy)
@@ -29,27 +29,22 @@
track_with_no_reference_count(0) {
}
-VarTracker::VarTracker(ThreadMode thread_mode) : last_var_id_(0) {
- if (thread_mode == SINGLE_THREADED)
- thread_checker_.reset(new base::ThreadChecker);
+VarTracker::VarTracker() : last_var_id_(0) {
}
VarTracker::~VarTracker() {
}
-void VarTracker::CheckThreadingPreconditions() const {
- DCHECK(!thread_checker_ || thread_checker_->CalledOnValidThread());
+int32 VarTracker::AddVar(Var* var) {
+ DCHECK(CalledOnValidThread());
ProxyLock::AssertAcquired();
-}
-int32 VarTracker::AddVar(Var* var) {
- CheckThreadingPreconditions();
-
return AddVarInternal(var, ADD_VAR_TAKE_ONE_REFERENCE);
}
Var* VarTracker::GetVar(int32 var_id) const {
- CheckThreadingPreconditions();
+ DCHECK(CalledOnValidThread());
+ ProxyLock::AssertAcquired();
VarMap::const_iterator result = live_vars_.find(var_id);
if (result == live_vars_.end())
@@ -58,7 +53,8 @@
}
Var* VarTracker::GetVar(const PP_Var& var) const {
- CheckThreadingPreconditions();
+ DCHECK(CalledOnValidThread());
+ ProxyLock::AssertAcquired();
if (!IsVarTypeRefcounted(var.type))
return NULL;
@@ -66,7 +62,8 @@
}
bool VarTracker::AddRefVar(int32 var_id) {
- CheckThreadingPreconditions();
+ DCHECK(CalledOnValidThread());
+ ProxyLock::AssertAcquired();
DLOG_IF(ERROR, !CheckIdType(var_id, PP_ID_TYPE_VAR))
<< var_id << " is not a PP_Var ID.";
@@ -91,7 +88,8 @@
}
bool VarTracker::AddRefVar(const PP_Var& var) {
- CheckThreadingPreconditions();
+ DCHECK(CalledOnValidThread());
+ ProxyLock::AssertAcquired();
if (!IsVarTypeRefcounted(var.type))
return true;
@@ -99,7 +97,8 @@
}
bool VarTracker::ReleaseVar(int32 var_id) {
- CheckThreadingPreconditions();
+ DCHECK(CalledOnValidThread());
+ ProxyLock::AssertAcquired();
DLOG_IF(ERROR, !CheckIdType(var_id, PP_ID_TYPE_VAR))
<< var_id << " is not a PP_Var ID.";
@@ -130,7 +129,8 @@
}
bool VarTracker::ReleaseVar(const PP_Var& var) {
- CheckThreadingPreconditions();
+ DCHECK(CalledOnValidThread());
+ ProxyLock::AssertAcquired();
if (!IsVarTypeRefcounted(var.type))
return false;
@@ -154,7 +154,8 @@
}
int VarTracker::GetRefCountForObject(const PP_Var& plugin_object) {
- CheckThreadingPreconditions();
+ DCHECK(CalledOnValidThread());
+ ProxyLock::AssertAcquired();
VarMap::iterator found = GetLiveVar(plugin_object);
if (found == live_vars_.end())
@@ -164,7 +165,8 @@
int VarTracker::GetTrackedWithNoReferenceCountForObject(
const PP_Var& plugin_object) {
- CheckThreadingPreconditions();
+ DCHECK(CalledOnValidThread());
+ ProxyLock::AssertAcquired();
VarMap::iterator found = GetLiveVar(plugin_object);
if (found == live_vars_.end())
@@ -186,7 +188,8 @@
}
PP_Var VarTracker::MakeArrayBufferPPVar(uint32 size_in_bytes) {
- CheckThreadingPreconditions();
+ DCHECK(CalledOnValidThread());
+ ProxyLock::AssertAcquired();
scoped_refptr<ArrayBufferVar> array_buffer(CreateArrayBuffer(size_in_bytes));
if (!array_buffer)
@@ -196,7 +199,8 @@
PP_Var VarTracker::MakeArrayBufferPPVar(uint32 size_in_bytes,
const void* data) {
- CheckThreadingPreconditions();
+ DCHECK(CalledOnValidThread());
+ ProxyLock::AssertAcquired();
ArrayBufferVar* array_buffer = MakeArrayBufferVar(size_in_bytes, data);
return array_buffer ? array_buffer->GetPPVar() : PP_MakeNull();
@@ -204,7 +208,8 @@
ArrayBufferVar* VarTracker::MakeArrayBufferVar(uint32 size_in_bytes,
const void* data) {
- CheckThreadingPreconditions();
+ DCHECK(CalledOnValidThread());
+ ProxyLock::AssertAcquired();
ArrayBufferVar* array_buffer(CreateArrayBuffer(size_in_bytes));
if (!array_buffer)
@@ -215,7 +220,7 @@
PP_Var VarTracker::MakeArrayBufferPPVar(uint32 size_in_bytes,
base::SharedMemoryHandle handle) {
- CheckThreadingPreconditions();
+ DCHECK(CalledOnValidThread());
scoped_refptr<ArrayBufferVar> array_buffer(
CreateShmArrayBuffer(size_in_bytes, handle));
@@ -225,7 +230,8 @@
}
std::vector<PP_Var> VarTracker::GetLiveVars() {
- CheckThreadingPreconditions();
+ DCHECK(CalledOnValidThread());
+ ProxyLock::AssertAcquired();
std::vector<PP_Var> var_vector;
var_vector.reserve(live_vars_.size());
« no previous file with comments | « trunk/src/ppapi/shared_impl/var_tracker.h ('k') | trunk/src/ppapi/tests/test_case.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698