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

Unified Diff: ppapi/proxy/plugin_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/plugin_var_serialization_rules.cc
diff --git a/ppapi/proxy/plugin_var_serialization_rules.cc b/ppapi/proxy/plugin_var_serialization_rules.cc
index 87a3cc2a8ff89cc4cbd77dc3f9d1ebda1c8997e5..045663784e85cf846f050647630a778c1af300ff 100644
--- a/ppapi/proxy/plugin_var_serialization_rules.cc
+++ b/ppapi/proxy/plugin_var_serialization_rules.cc
@@ -22,44 +22,27 @@ PluginVarSerializationRules::PluginVarSerializationRules()
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 @@ void PluginVarSerializationRules::EndReceiveCallerOwned(const PP_Var& var) {
}
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 @@ PP_Var PluginVarSerializationRules::ReceivePassRef(const PP_Var& var,
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 @@ PP_Var PluginVarSerializationRules::BeginSendPassRef(
// 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;
}

Powered by Google App Engine
This is Rietveld 408576698