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

Unified Diff: ppapi/proxy/plugin_var_tracker.cc

Issue 9786001: Avoid accessing VarTracker from multiple threads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | « no previous file | ppapi/proxy/serialized_var.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/plugin_var_tracker.cc
diff --git a/ppapi/proxy/plugin_var_tracker.cc b/ppapi/proxy/plugin_var_tracker.cc
index 525b1a36a77d96e3feda6172a19c1ebcfb769a0a..74cd55795e7211d0788e1a2211b72e0089b3dd86 100644
--- a/ppapi/proxy/plugin_var_tracker.cc
+++ b/ppapi/proxy/plugin_var_tracker.cc
@@ -38,6 +38,7 @@ PluginVarTracker::~PluginVarTracker() {
PP_Var PluginVarTracker::ReceiveObjectPassRef(const PP_Var& host_var,
PluginDispatcher* dispatcher) {
+ DCHECK(CalledOnValidThread());
DCHECK(host_var.type == PP_VARTYPE_OBJECT);
// Get the object.
@@ -63,6 +64,7 @@ PP_Var PluginVarTracker::ReceiveObjectPassRef(const PP_Var& host_var,
PP_Var PluginVarTracker::TrackObjectWithNoReference(
const PP_Var& host_var,
PluginDispatcher* dispatcher) {
+ DCHECK(CalledOnValidThread());
DCHECK(host_var.type == PP_VARTYPE_OBJECT);
// Get the object.
@@ -80,7 +82,9 @@ PP_Var PluginVarTracker::TrackObjectWithNoReference(
void PluginVarTracker::StopTrackingObjectWithNoReference(
const PP_Var& plugin_var) {
+ DCHECK(CalledOnValidThread());
DCHECK(plugin_var.type == PP_VARTYPE_OBJECT);
+
VarMap::iterator found = GetLiveVar(plugin_var);
if (found == live_vars_.end()) {
NOTREACHED();
@@ -93,6 +97,8 @@ void PluginVarTracker::StopTrackingObjectWithNoReference(
}
PP_Var PluginVarTracker::GetHostObject(const PP_Var& plugin_object) const {
+ DCHECK(CalledOnValidThread());
+
if (plugin_object.type != PP_VARTYPE_OBJECT) {
NOTREACHED();
return PP_MakeUndefined();
@@ -113,6 +119,8 @@ PP_Var PluginVarTracker::GetHostObject(const PP_Var& plugin_object) const {
PluginDispatcher* PluginVarTracker::DispatcherForPluginObject(
const PP_Var& plugin_object) const {
+ DCHECK(CalledOnValidThread());
+
if (plugin_object.type != PP_VARTYPE_OBJECT)
return NULL;
@@ -128,8 +136,10 @@ PluginDispatcher* PluginVarTracker::DispatcherForPluginObject(
void PluginVarTracker::ReleaseHostObject(PluginDispatcher* dispatcher,
const PP_Var& host_object) {
- // Convert the host object to a normal var valid in the plugin.
+ DCHECK(CalledOnValidThread());
DCHECK(host_object.type == PP_VARTYPE_OBJECT);
+
+ // Convert the host object to a normal var valid in the plugin.
HostVarToPluginVarMap::iterator found = host_var_to_plugin_var_.find(
HostVar(dispatcher, static_cast<int32>(host_object.value.as_id)));
if (found == host_var_to_plugin_var_.end()) {
« no previous file with comments | « no previous file | ppapi/proxy/serialized_var.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698