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

Unified Diff: ppapi/proxy/host_var_serialization_rules.cc

Issue 9316123: Remove special handling for strings in var serialization. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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
Index: ppapi/proxy/host_var_serialization_rules.cc
diff --git a/ppapi/proxy/host_var_serialization_rules.cc b/ppapi/proxy/host_var_serialization_rules.cc
index 45eaf4026382a2bc39d95643da32c80e27018214..52b2cbcc6b3a1696fbba658337d296577f104e9e 100644
--- a/ppapi/proxy/host_var_serialization_rules.cc
+++ b/ppapi/proxy/host_var_serialization_rules.cc
@@ -24,56 +24,33 @@ HostVarSerializationRules::HostVarSerializationRules(PP_Module pp_module)
HostVarSerializationRules::~HostVarSerializationRules() {
}
-PP_Var HostVarSerializationRules::SendCallerOwned(
- const PP_Var& var,
- const std::string** str_ptr_out) {
- if (var.type == PP_VARTYPE_STRING)
- VarToStringPtr(var, str_ptr_out);
+PP_Var HostVarSerializationRules::SendCallerOwned(const PP_Var& var) {
return var;
}
PP_Var HostVarSerializationRules::BeginReceiveCallerOwned(
const PP_Var& var,
- scoped_ptr<std::string> str,
Dispatcher* /* dispatcher */) {
- if (var.type == PP_VARTYPE_STRING) {
- // Put the string in to the VarTracker (transferring ownership, since we
- // would otherwise just delete the one we received from IPC). This allows
- // us to avoid unnecessary copying of the string.
- return StringVar::StringToPPVar(str.Pass());
- }
return var;
}
void HostVarSerializationRules::EndReceiveCallerOwned(const PP_Var& var) {
if (var.type == PP_VARTYPE_STRING) {
- // Destroy the string BeginReceiveCallerOwned created above.
+ // Destroy the string.
PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(var);
}
}
PP_Var HostVarSerializationRules::ReceivePassRef(
const PP_Var& var,
- scoped_ptr<std::string> str,
Dispatcher* /* dispatcher */) {
- if (var.type == PP_VARTYPE_STRING) {
- // Put the string in to the tracker, transferring ownership.
- return StringVar::StringToPPVar(str.Pass());
- }
-
// See PluginVarSerialization::BeginSendPassRef for an example.
if (var.type == PP_VARTYPE_OBJECT)
PpapiGlobals::Get()->GetVarTracker()->AddRefVar(var);
return var;
}
-PP_Var HostVarSerializationRules::BeginSendPassRef(
- const PP_Var& var,
- const std::string** str_ptr_out) {
- // See PluginVarSerialization::ReceivePassRef for an example. We don't need
- // to do anything here other than convert the string.
- if (var.type == PP_VARTYPE_STRING)
- VarToStringPtr(var, str_ptr_out);
+PP_Var HostVarSerializationRules::BeginSendPassRef(const PP_Var& var) {
return var;
}
@@ -83,16 +60,6 @@ void HostVarSerializationRules::EndSendPassRef(const PP_Var& /* var */,
// to do anything here.
}
-void HostVarSerializationRules::VarToStringPtr(
- const PP_Var& var,
- const std::string** str_ptr_out) {
- DCHECK(var.type == PP_VARTYPE_STRING);
- *str_ptr_out = NULL;
- StringVar* string_var = StringVar::FromPPVar(var);
- if (string_var)
- *str_ptr_out = string_var->ptr();
-}
-
void HostVarSerializationRules::ReleaseObjectRef(const PP_Var& var) {
PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(var);
}

Powered by Google App Engine
This is Rietveld 408576698