summaryrefslogtreecommitdiffstats
path: root/ppapi/proxy/plugin_var_tracker.cc
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-19 23:22:40 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-19 23:22:40 +0000
commit5b2d3853536a12823855589d9876089c0f3affbd (patch)
tree6c9eccff180d110bafff0a875a5f61cd0d5210ff /ppapi/proxy/plugin_var_tracker.cc
parent30307700ac157552793f3370b9dd53373015ac55 (diff)
downloadchromium_src-5b2d3853536a12823855589d9876089c0f3affbd.zip
chromium_src-5b2d3853536a12823855589d9876089c0f3affbd.tar.gz
chromium_src-5b2d3853536a12823855589d9876089c0f3affbd.tar.bz2
Make AddRefObject a sync message to avoid a race condition between (1)
returning to the browser from a sync function that passes a var, and (2) the AddRef if the plugin wants to take a reference to it while handling the sync function. TEST=none BUG=79813 Review URL: http://codereview.chromium.org/6882027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82187 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy/plugin_var_tracker.cc')
-rw-r--r--ppapi/proxy/plugin_var_tracker.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/ppapi/proxy/plugin_var_tracker.cc b/ppapi/proxy/plugin_var_tracker.cc
index ef29dd4..151fd2b 100644
--- a/ppapi/proxy/plugin_var_tracker.cc
+++ b/ppapi/proxy/plugin_var_tracker.cc
@@ -120,6 +120,9 @@ void PluginVarTracker::AddRef(const PP_Var& var) {
// Got an AddRef for an object we have no existing reference for.
// We need to tell the browser we've taken a ref. This comes up when the
// browser passes an object as an input param and holds a ref for us.
+ // This must be a sync message since otherwise the "addref" will actually
+ // occur after the return to the browser of the sync function that
+ // presumably sent the object.
SendAddRefObjectMsg(info.host_var);
}
info.ref_count++;
@@ -280,8 +283,9 @@ int PluginVarTracker::GetTrackedWithNoReferenceCountForObject(
}
void PluginVarTracker::SendAddRefObjectMsg(const HostVar& host_var) {
+ int unused;
host_var.dispatcher->Send(new PpapiHostMsg_PPBVar_AddRefObject(
- INTERFACE_ID_PPB_VAR_DEPRECATED, host_var.host_object_id));
+ INTERFACE_ID_PPB_VAR_DEPRECATED, host_var.host_object_id, &unused));
}
void PluginVarTracker::SendReleaseObjectMsg(const HostVar& host_var) {