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

Unified Diff: ppapi/proxy/plugin_var_serialization_rules.cc

Issue 6995083: Proxy PPB_Var, fix o-o-p string var id tracking. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updated copyright header Created 9 years, 6 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/proxy/dispatcher.cc ('k') | ppapi/proxy/plugin_var_tracker.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/plugin_var_serialization_rules.cc
diff --git a/ppapi/proxy/plugin_var_serialization_rules.cc b/ppapi/proxy/plugin_var_serialization_rules.cc
index a3d82312de6de19fd02b099827e8a308133c6d55..8ba557462869b5aad7c3306c2683bd06d405824e 100644
--- a/ppapi/proxy/plugin_var_serialization_rules.cc
+++ b/ppapi/proxy/plugin_var_serialization_rules.cc
@@ -24,10 +24,14 @@ PP_Var PluginVarSerializationRules::SendCallerOwned(const PP_Var& var,
if (var.type == PP_VARTYPE_OBJECT)
return var_tracker_->GetHostObject(var);
- // Nothing to do since we manage the refcount, other than retrieve the string
- // to use for IPC.
- if (var.type == PP_VARTYPE_STRING)
- *str_val = var_tracker_->GetString(var);
+ // Retrieve the string to use for IPC.
+ if (var.type == PP_VARTYPE_STRING) {
+ const std::string* var_string = var_tracker_->GetExistingString(var);
+ if (var_string)
+ *str_val = *var_string;
+ else
+ NOTREACHED() << "Trying to send unknown string over IPC.";
+ }
return var;
}
@@ -119,8 +123,13 @@ PP_Var PluginVarSerializationRules::BeginSendPassRef(const PP_Var& var,
if (var.type == PP_VARTYPE_OBJECT)
return var_tracker_->GetHostObject(var);
- if (var.type == PP_VARTYPE_STRING)
- *str_val = var_tracker_->GetString(var);
+ if (var.type == PP_VARTYPE_STRING) {
+ const std::string* var_string = var_tracker_->GetExistingString(var);
+ if (var_string)
+ *str_val = *var_string;
+ else
+ NOTREACHED() << "Trying to send unknown string over IPC.";
+ }
return var;
}
« no previous file with comments | « ppapi/proxy/dispatcher.cc ('k') | ppapi/proxy/plugin_var_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698