diff options
author | dmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-16 19:39:22 +0000 |
---|---|---|
committer | dmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-16 19:39:22 +0000 |
commit | 10305deb1ed8a625a34629c372c7aae171e07cac (patch) | |
tree | ad8b7d5e3ea63b6848fa05a6cc298df7743a21d9 /ppapi/proxy | |
parent | c98ea3f52244b1a083e48ba760fb184fff664cd7 (diff) | |
download | chromium_src-10305deb1ed8a625a34629c372c7aae171e07cac.zip chromium_src-10305deb1ed8a625a34629c372c7aae171e07cac.tar.gz chromium_src-10305deb1ed8a625a34629c372c7aae171e07cac.tar.bz2 |
PPAPI: Proxy VarArrayBuffer for out-of-process.
BUG=103435
TEST=
Review URL: https://chromiumcodereview.appspot.com/9373032
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@122340 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy')
-rw-r--r-- | ppapi/proxy/host_var_serialization_rules.cc | 4 | ||||
-rw-r--r-- | ppapi/proxy/interface_list.cc | 3 | ||||
-rw-r--r-- | ppapi/proxy/plugin_var_serialization_rules.cc | 10 | ||||
-rw-r--r-- | ppapi/proxy/ppb_instance_proxy.cc | 5 | ||||
-rw-r--r-- | ppapi/proxy/serialized_var.cc | 32 |
5 files changed, 42 insertions, 12 deletions
diff --git a/ppapi/proxy/host_var_serialization_rules.cc b/ppapi/proxy/host_var_serialization_rules.cc index 52b2cbc..d6b5677 100644 --- a/ppapi/proxy/host_var_serialization_rules.cc +++ b/ppapi/proxy/host_var_serialization_rules.cc @@ -35,8 +35,8 @@ PP_Var HostVarSerializationRules::BeginReceiveCallerOwned( } void HostVarSerializationRules::EndReceiveCallerOwned(const PP_Var& var) { - if (var.type == PP_VARTYPE_STRING) { - // Destroy the string. + if (var.type != PP_VARTYPE_OBJECT && var.type >= PP_VARTYPE_STRING) { + // Release our reference to the local Var. PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(var); } } diff --git a/ppapi/proxy/interface_list.cc b/ppapi/proxy/interface_list.cc index c37da44..ce456ddc 100644 --- a/ppapi/proxy/interface_list.cc +++ b/ppapi/proxy/interface_list.cc @@ -42,6 +42,7 @@ #include "ppapi/c/ppb_url_request_info.h" #include "ppapi/c/ppb_url_response_info.h" #include "ppapi/c/ppb_var.h" +#include "ppapi/c/ppb_var_array_buffer.h" #include "ppapi/c/ppb_view.h" #include "ppapi/c/pp_errors.h" #include "ppapi/c/ppp_instance.h" @@ -178,6 +179,8 @@ InterfaceList::InterfaceList() { PPB_MessageLoop_Proxy::GetInterface()); AddPPB(PPB_OPENGLES2_INTERFACE_1_0, API_ID_NONE, PPB_OpenGLES2_Shared::GetInterface()); + AddPPB(PPB_VAR_ARRAY_BUFFER_INTERFACE_1_0, API_ID_NONE, + PPB_Var_Shared::GetVarArrayBufferInterface1_0()); AddPPB(PPB_VAR_INTERFACE_1_1, API_ID_NONE, PPB_Var_Shared::GetVarInterface1_1()); AddPPB(PPB_VAR_INTERFACE_1_0, API_ID_NONE, diff --git a/ppapi/proxy/plugin_var_serialization_rules.cc b/ppapi/proxy/plugin_var_serialization_rules.cc index 0456637..461676f 100644 --- a/ppapi/proxy/plugin_var_serialization_rules.cc +++ b/ppapi/proxy/plugin_var_serialization_rules.cc @@ -41,11 +41,11 @@ PP_Var PluginVarSerializationRules::BeginReceiveCallerOwned( } void PluginVarSerializationRules::EndReceiveCallerOwned(const PP_Var& var) { - if (var.type == PP_VARTYPE_STRING) { - // Destroy the string. - var_tracker_->ReleaseVar(var); - } else if (var.type == PP_VARTYPE_OBJECT) { + if (var.type == PP_VARTYPE_OBJECT) { var_tracker_->StopTrackingObjectWithNoReference(var); + } else if (var.type >= PP_VARTYPE_STRING) { + // Release our reference to the local Var. + var_tracker_->ReleaseVar(var); } } @@ -108,7 +108,7 @@ void PluginVarSerializationRules::EndSendPassRef(const PP_Var& var, if (var.type == PP_VARTYPE_OBJECT) { var_tracker_->ReleaseHostObject( static_cast<PluginDispatcher*>(dispatcher), var); - } else if (var.type == PP_VARTYPE_STRING) { + } else if (var.type >= PP_VARTYPE_STRING) { var_tracker_->ReleaseVar(var); } } diff --git a/ppapi/proxy/ppb_instance_proxy.cc b/ppapi/proxy/ppb_instance_proxy.cc index 62335c2..7cc33f0 100644 --- a/ppapi/proxy/ppb_instance_proxy.cc +++ b/ppapi/proxy/ppb_instance_proxy.cc @@ -491,8 +491,9 @@ void PPB_Instance_Proxy::OnHostMsgClearInputEvents(PP_Instance instance, enter.functions()->ClearInputEventRequest(instance, event_classes); } -void PPB_Instance_Proxy::OnHostMsgPostMessage(PP_Instance instance, - SerializedVarReceiveInput message) { +void PPB_Instance_Proxy::OnHostMsgPostMessage( + PP_Instance instance, + SerializedVarReceiveInput message) { EnterInstanceNoLock enter(instance, false); if (enter.succeeded()) enter.functions()->PostMessage(instance, message.Get(dispatcher())); diff --git a/ppapi/proxy/serialized_var.cc b/ppapi/proxy/serialized_var.cc index 7153c0c..eb20333 100644 --- a/ppapi/proxy/serialized_var.cc +++ b/ppapi/proxy/serialized_var.cc @@ -5,11 +5,13 @@ #include "ppapi/proxy/serialized_var.h" #include "base/logging.h" +#include "base/memory/ref_counted.h" #include "ipc/ipc_message_utils.h" #include "ppapi/proxy/dispatcher.h" #include "ppapi/proxy/interface_proxy.h" #include "ppapi/proxy/ppapi_param_traits.h" #include "ppapi/proxy/var_serialization_rules.h" +#include "ppapi/shared_impl/ppapi_globals.h" #include "ppapi/shared_impl/var.h" namespace ppapi { @@ -116,10 +118,24 @@ void SerializedVar::Inner::WriteToMessage(IPC::Message* m) const { m->WriteString(string_var ? *string_var->ptr() : std::string()); break; } - case PP_VARTYPE_ARRAY_BUFFER: - // TODO(dmichael): Proxy ArrayBuffer. - NOTIMPLEMENTED(); + case PP_VARTYPE_ARRAY_BUFFER: { + // TODO(dmichael) in the case of an invalid var ID, it would be nice + // to send something to the other side such that a 0 ID would be + // generated there. Then the function implementing the interface can + // handle the invalid string as if it was in process rather than seeing + // what looks like a valid empty ArraryBuffer. + ArrayBufferVar* buffer_var = ArrayBufferVar::FromPPVar(var_); + if (buffer_var) { + // TODO(dmichael): If it wasn't already Mapped, Unmap it. (Though once + // we use shared memory, this will probably be + // completely different anyway). + m->WriteData(static_cast<const char*>(buffer_var->Map()), + buffer_var->ByteLength()); + } else { + m->WriteData(NULL, 0); + } break; + } case PP_VARTYPE_OBJECT: m->WriteInt64(var_.value.as_id); break; @@ -176,6 +192,16 @@ bool SerializedVar::Inner::ReadFromMessage(const IPC::Message* m, void** iter) { var_ = StringVar::SwapValidatedUTF8StringIntoPPVar(&string_from_ipc); break; } + case PP_VARTYPE_ARRAY_BUFFER: { + int length = 0; + const char* message_bytes = NULL; + success = m->ReadData(iter, &message_bytes, &length); + if (success) { + var_ = PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar( + length, message_bytes); + } + break; + } case PP_VARTYPE_OBJECT: success = m->ReadInt64(iter, &var_.value.as_id); break; |