Remove special handling for strings in var serialization.
Previously we had to have a lot of weird string handling because strings needed a PP_Module to be constructed, and because they had different methods for being created in the host and the plugin processes. We've removed all of these limitations, so now we can just delete the whole mess.
Review URL: https://chromiumcodereview.appspot.com/9316123
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@120724 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/ppapi/proxy/plugin_var_serialization_rules.cc b/ppapi/proxy/plugin_var_serialization_rules.cc
index 87a3cc2..0456637 100644
--- a/ppapi/proxy/plugin_var_serialization_rules.cc
+++ b/ppapi/proxy/plugin_var_serialization_rules.cc
@@ -22,44 +22,27 @@
PluginVarSerializationRules::~PluginVarSerializationRules() {
}
-PP_Var PluginVarSerializationRules::SendCallerOwned(
- const PP_Var& var,
- const std::string** str_ptr_out) {
+PP_Var PluginVarSerializationRules::SendCallerOwned(const PP_Var& var) {
// Objects need special translations to get the IDs valid in the host.
if (var.type == PP_VARTYPE_OBJECT)
return var_tracker_->GetHostObject(var);
-
- // Retrieve the pointer to the string in the tracker in order to send the
- // string over IPC without unnecessary copies.
- if (var.type == PP_VARTYPE_STRING) {
- StringVar* string_var = StringVar::FromPPVar(var);
- if (string_var)
- *str_ptr_out = string_var->ptr();
- else
- NOTREACHED() << "Trying to send unknown string over IPC.";
- }
return var;
}
PP_Var PluginVarSerializationRules::BeginReceiveCallerOwned(
const PP_Var& var,
- scoped_ptr<std::string> str,
Dispatcher* dispatcher) {
- if (var.type == PP_VARTYPE_STRING)
- return StringVar::StringToPPVar(str.Pass());
-
if (var.type == PP_VARTYPE_OBJECT) {
DCHECK(dispatcher->IsPlugin());
return var_tracker_->TrackObjectWithNoReference(
var, static_cast<PluginDispatcher*>(dispatcher));
}
-
return var;
}
void PluginVarSerializationRules::EndReceiveCallerOwned(const PP_Var& var) {
if (var.type == PP_VARTYPE_STRING) {
- // Destroy the string BeginReceiveCallerOwned created above.
+ // Destroy the string.
var_tracker_->ReleaseVar(var);
} else if (var.type == PP_VARTYPE_OBJECT) {
var_tracker_->StopTrackingObjectWithNoReference(var);
@@ -67,11 +50,7 @@
}
PP_Var PluginVarSerializationRules::ReceivePassRef(const PP_Var& var,
- scoped_ptr<std::string> str,
Dispatcher* dispatcher) {
- if (var.type == PP_VARTYPE_STRING)
- return StringVar::StringToPPVar(str.Pass());
-
// Overview of sending an object with "pass ref" from the browser to the
// plugin:
// Example 1 Example 2
@@ -98,9 +77,7 @@
return var;
}
-PP_Var PluginVarSerializationRules::BeginSendPassRef(
- const PP_Var& var,
- const std::string** str_ptr_out) {
+PP_Var PluginVarSerializationRules::BeginSendPassRef(const PP_Var& var) {
// Overview of sending an object with "pass ref" from the plugin to the
// browser:
// Example 1 Example 2
@@ -119,16 +96,6 @@
// Objects need special translations to get the IDs valid in the host.
if (var.type == PP_VARTYPE_OBJECT)
return var_tracker_->GetHostObject(var);
-
- if (var.type == PP_VARTYPE_STRING) {
- // Get the pointer to the string that's in the tracker and return it, so we
- // can avoid an extra copy of the string when serializing over IPC.
- StringVar* string_var = StringVar::FromPPVar(var);
- if (string_var)
- *str_ptr_out = string_var->ptr();
- else
- NOTREACHED() << "Trying to send unknown string over IPC.";
- }
return var;
}