First pass at making the proxy handle multiple renderers. This associates the
instance with resources and has most callers retrieve the dispatcher
according to the appropriate instance. This isn't hooked up to anything yet.

This changes some PPB_Flash interface methods to use PP_Bool.

The most challenging part of the change is in the plugin_var_tracker which
now needs to track which dispatcher each var object came from, and remap var
IDs since each renderer will be generating var IDs in its own space, which
will likely overlap. A similar system will need to be done for resources
which is not implemented yet.

I added some null checks in audio_impl because audio_ can be NULL in some
cases when using the trusted API. I discovered this when testing NaCl for
this patch.
Review URL: http://codereview.chromium.org/6282007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72053 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/ppapi/proxy/host_var_serialization_rules.cc b/ppapi/proxy/host_var_serialization_rules.cc
index 9ca6a151..f6f00f7 100644
--- a/ppapi/proxy/host_var_serialization_rules.cc
+++ b/ppapi/proxy/host_var_serialization_rules.cc
@@ -20,15 +20,17 @@
 HostVarSerializationRules::~HostVarSerializationRules() {
 }
 
-void HostVarSerializationRules::SendCallerOwned(const PP_Var& var,
-                                                std::string* str_val) {
+PP_Var HostVarSerializationRules::SendCallerOwned(const PP_Var& var,
+                                                  std::string* str_val) {
   if (var.type == PP_VARTYPE_STRING)
     VarToString(var, str_val);
+  return var;
 }
 
 PP_Var HostVarSerializationRules::BeginReceiveCallerOwned(
     const PP_Var& var,
-    const std::string* str_val) {
+    const std::string* str_val,
+    Dispatcher* /* dispatcher */) {
   if (var.type == PP_VARTYPE_STRING) {
     // Convert the string to the context of the current process.
     return var_interface_->VarFromUtf8(pp_module_, str_val->c_str(),
@@ -45,7 +47,8 @@
 }
 
 PP_Var HostVarSerializationRules::ReceivePassRef(const PP_Var& var,
-                                                 const std::string& str_val) {
+                                                 const std::string& str_val,
+                                                 Dispatcher* /* dispatcher */) {
   if (var.type == PP_VARTYPE_STRING) {
     // Convert the string to the context of the current process.
     return var_interface_->VarFromUtf8(pp_module_, str_val.c_str(),
@@ -58,12 +61,13 @@
   return var;
 }
 
-void HostVarSerializationRules::BeginSendPassRef(const PP_Var& var,
+PP_Var HostVarSerializationRules::BeginSendPassRef(const PP_Var& var,
                                                  std::string* str_val) {
   // 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)
     VarToString(var, str_val);
+  return var;
 }
 
 void HostVarSerializationRules::EndSendPassRef(const PP_Var& var) {