summaryrefslogtreecommitdiffstats
path: root/ppapi/proxy
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-03 20:04:38 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-03 20:04:38 +0000
commit1e175e42df94efb3fc94fe31aa125ae97b54e86d (patch)
tree4e091e01affce561697e389e10f2e8d19e8e139a /ppapi/proxy
parent661f6fa16eabdbc9bcf7eabb6e3190a483e33b7f (diff)
downloadchromium_src-1e175e42df94efb3fc94fe31aa125ae97b54e86d.zip
chromium_src-1e175e42df94efb3fc94fe31aa125ae97b54e86d.tar.gz
chromium_src-1e175e42df94efb3fc94fe31aa125ae97b54e86d.tar.bz2
Add proxies for Var deprecated and some additional tracking information. These
don't build by themselves, this is part of a larger patch. You can see most of the serialization mechanics already checked in to the same directory. TEST=none BUG=none Review URL: http://codereview.chromium.org/4369001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64955 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy')
-rw-r--r--ppapi/proxy/plugin_var_tracker.cc128
-rw-r--r--ppapi/proxy/plugin_var_tracker.h71
-rw-r--r--ppapi/proxy/ppb_var_deprecated_proxy.cc385
-rw-r--r--ppapi/proxy/ppb_var_deprecated_proxy.h95
4 files changed, 679 insertions, 0 deletions
diff --git a/ppapi/proxy/plugin_var_tracker.cc b/ppapi/proxy/plugin_var_tracker.cc
new file mode 100644
index 0000000..49f7d3f
--- /dev/null
+++ b/ppapi/proxy/plugin_var_tracker.cc
@@ -0,0 +1,128 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/proxy/plugin_var_tracker.h"
+
+#include "base/ref_counted.h"
+#include "ppapi/c/ppb_var.h"
+#include "ppapi/proxy/plugin_dispatcher.h"
+#include "ppapi/proxy/ppapi_messages.h"
+
+namespace pp {
+namespace proxy {
+
+namespace {
+
+class RefCountedString : public base::RefCounted<RefCountedString> {
+ public:
+ RefCountedString() {
+ }
+ RefCountedString(const std::string& str) : value_(str) {
+ }
+ RefCountedString(const char* data, size_t len)
+ : value_(data, len) {
+ }
+
+ const std::string& value() const { return value_; }
+
+ private:
+ std::string value_;
+};
+
+// When running in the plugin, this will convert the string ID to the object
+// using casting. No validity checking is done.
+RefCountedString* PluginStringFromID(int64 id) {
+ return reinterpret_cast<RefCountedString*>(static_cast<intptr_t>(id));
+}
+
+} // namespace
+
+PluginVarTracker::PluginVarTracker(PluginDispatcher* dispatcher)
+ : dispatcher_(dispatcher) {
+}
+
+int64 PluginVarTracker::MakeString(const std::string& str) {
+ RefCountedString* out = new RefCountedString(str);
+ out->AddRef();
+ return static_cast<int64>(reinterpret_cast<intptr_t>(out));
+}
+
+std::string PluginVarTracker::GetString(const PP_Var& var) const {
+ return PluginStringFromID(var.value.as_id)->value();
+}
+
+const std::string* PluginVarTracker::GetExistingString(
+ const PP_Var& var) const {
+ if (var.type != PP_VARTYPE_STRING)
+ return NULL;
+ RefCountedString* str = PluginStringFromID(var.value.as_id);
+ return &str->value();
+}
+
+void PluginVarTracker::AddRef(const PP_Var& var) {
+ if (var.type == PP_VARTYPE_STRING) {
+ PluginStringFromID(var.value.as_id)->AddRef();
+ } else if (var.type == PP_VARTYPE_OBJECT && var.value.as_id != 0) {
+ int& ref_count = object_ref_count_[var.value.as_id];
+ ref_count++;
+ if (ref_count == 1) {
+ // We must handle the case where we got requested to AddRef an object
+ // that we've never seen before. This should tell the browser we've
+ // taken a ref. This comes up when the browser passes an object as an
+ // input param and holds a ref for us. We may not have seen that object
+ // and the plugin handler may want to AddRef and release it internally.
+ SendAddRefObjectMsg(var.value.as_id);
+ }
+ }
+}
+
+void PluginVarTracker::Release(const PP_Var& var) {
+ if (var.type == PP_VARTYPE_STRING) {
+ PluginStringFromID(var.value.as_id)->Release();
+ } else if (var.type == PP_VARTYPE_OBJECT) {
+ ObjectRefCount::iterator found = object_ref_count_.find(var.value.as_id);
+ if (found == object_ref_count_.end())
+ return; // Invalid object.
+ found->second--;
+
+ if (found->second == 0) {
+ // Plugin has released all of its refs, tell the browser.
+ object_ref_count_.erase(found);
+ SendReleaseObjectMsg(var.value.as_id);
+ }
+ }
+}
+
+void PluginVarTracker::ReceiveObjectPassRef(const PP_Var& var) {
+ // We're the plugin and the renderer just sent us a ref. The renderer has
+ // addrefed the var in its tracker for us since it's returning it.
+ //
+ // - If We don't have a reference to this already, then we just add it to
+ // our tracker and use that one ref.
+ //
+ // - If we do already have a reference to it, that means the renderer now
+ // has two references on our behalf. We want to transfer that extra
+ // reference to our list. This means we addref in the plugin, and release
+ // the extra one in the renderer.
+ ObjectRefCount::iterator found = object_ref_count_.find(var.value.as_id);
+ if (found == object_ref_count_.end()) {
+ object_ref_count_[var.value.as_id] = 1;
+ } else {
+ SendReleaseObjectMsg(var.value.as_id);
+ found->second++;
+ }
+}
+
+void PluginVarTracker::SendAddRefObjectMsg(int64_t id) {
+ dispatcher_->Send(new PpapiHostMsg_PPBVar_AddRefObject(
+ INTERFACE_ID_PPB_VAR_DEPRECATED, id));
+}
+
+void PluginVarTracker::SendReleaseObjectMsg(int64_t id) {
+ dispatcher_->Send(new PpapiHostMsg_PPBVar_ReleaseObject(
+ INTERFACE_ID_PPB_VAR_DEPRECATED, id));
+}
+
+} // namesace proxy
+} // namespace pp
diff --git a/ppapi/proxy/plugin_var_tracker.h b/ppapi/proxy/plugin_var_tracker.h
new file mode 100644
index 0000000..1ae5b24
--- /dev/null
+++ b/ppapi/proxy/plugin_var_tracker.h
@@ -0,0 +1,71 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_PROXY_PLUGIN_VAR_TRACKER_H_
+#define PPAPI_PROXY_PLUGIN_VAR_TRACKER_H_
+
+#include <map>
+#include <string>
+
+#include "ppapi/c/pp_stdint.h"
+#include "ppapi/c/pp_var.h"
+
+struct PPB_Var;
+
+namespace pp {
+namespace proxy {
+
+class PluginDispatcher;
+
+// Tracks live strings and objects in the plugin process. We maintain our own
+// reference count for these objects. In the case of JS objects, we maintain
+// a single ref in the renderer process whenever we have a nonzero refcount
+// in the plugin process. This allows AddRef and Release to not initiate too
+// much IPC chat.
+class PluginVarTracker {
+ public:
+ // You must call Init() after creation to set up the correct interfaces. We
+ // do this to avoid having to depend on the dispatcher in the constructor,
+ // which is probably just being created from our constructor.
+ PluginVarTracker(PluginDispatcher* dispatcher);
+
+ // Must be called after construction.
+ void Init();
+
+ // Allocates a string and returns the ID of it. The refcount will be 1.
+ int64_t MakeString(const std::string& str);
+
+ // Returns the string associated with the given string var. The var must be
+ // of type string and must be valid or this function will crash.
+ std::string GetString(const PP_Var& var) const;
+
+ // Returns a pointer to the given string if it exists, or NULL if the var
+ // isn't a string var.
+ const std::string* GetExistingString(const PP_Var& var) const;
+
+ void AddRef(const PP_Var& var);
+ void Release(const PP_Var& var);
+
+ // Manages tracking for receiving a VARTYPE_OBJECT from the remote side
+ // (either the plugin or the renderer) that has already had its reference
+ // count incremented on behalf of the caller.
+ void ReceiveObjectPassRef(const PP_Var& var);
+
+ private:
+ // Sends an addref or release message to the browser for the given object ID.
+ void SendAddRefObjectMsg(int64_t id);
+ void SendReleaseObjectMsg(int64_t id);
+
+ PluginDispatcher* dispatcher_;
+
+ // Tracks object references to the reference count of that object on the
+ // plugin side.
+ typedef std::map<int64_t, int> ObjectRefCount;
+ ObjectRefCount object_ref_count_;
+};
+
+} // namespace proxy
+} // namespace pp
+
+#endif // PPAPI_PROXY_PLUGIN_VAR_TRACKER_H_
diff --git a/ppapi/proxy/ppb_var_deprecated_proxy.cc b/ppapi/proxy/ppb_var_deprecated_proxy.cc
new file mode 100644
index 0000000..8b5aff3
--- /dev/null
+++ b/ppapi/proxy/ppb_var_deprecated_proxy.cc
@@ -0,0 +1,385 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/proxy/ppb_var_deprecated_proxy.h"
+
+#include <stdlib.h> // For malloc
+
+#include "base/logging.h"
+#include "ppapi/c/dev/ppb_var_deprecated.h"
+#include "ppapi/c/pp_var.h"
+#include "ppapi/c/ppb_core.h"
+#include "ppapi/proxy/plugin_dispatcher.h"
+#include "ppapi/proxy/ppapi_message_helpers.h"
+#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/proxy/ppp_class_proxy.h"
+#include "ppapi/proxy/serialized_var.h"
+
+namespace pp {
+namespace proxy {
+
+namespace {
+
+// PPP_Var_Deprecated plugin ---------------------------------------------------
+
+void AddRefVar(PP_Var var) {
+ PluginDispatcher::Get()->plugin_var_tracker()->AddRef(var);
+}
+
+void ReleaseVar(PP_Var var) {
+ PluginDispatcher::Get()->plugin_var_tracker()->Release(var);
+}
+
+PP_Var VarFromUtf8(PP_Module module_id, const char* data, uint32_t len) {
+ PP_Var ret;
+ ret.type = PP_VARTYPE_STRING;
+ // TODO(brettw) avoid this extra copy.
+ ret.value.as_id = PluginDispatcher::Get()->plugin_var_tracker()->MakeString(
+ std::string(data, len));
+ return ret;
+}
+
+const char* VarToUtf8(PP_Var var, uint32_t* len) {
+ const std::string* str =
+ PluginDispatcher::Get()->plugin_var_tracker()->GetExistingString(var);
+ if (str) {
+ *len = static_cast<uint32_t>(str->size());
+ return str->c_str();
+ } else {
+ *len = 0;
+ return NULL;
+ }
+}
+
+bool HasProperty(PP_Var var,
+ PP_Var name,
+ PP_Var* exception) {
+ Dispatcher* dispatcher = PluginDispatcher::Get();
+ ReceiveSerializedException se(dispatcher, exception);
+ bool result = false;
+ if (!se.IsThrown()) {
+ dispatcher->Send(new PpapiHostMsg_PPBVar_HasProperty(
+ INTERFACE_ID_PPB_VAR_DEPRECATED,
+ SerializedVarSendInput(dispatcher, var),
+ SerializedVarSendInput(dispatcher, name), &se, &result));
+ }
+ return result;
+}
+
+bool HasMethod(PP_Var var,
+ PP_Var name,
+ PP_Var* exception) {
+ Dispatcher* dispatcher = PluginDispatcher::Get();
+ ReceiveSerializedException se(dispatcher, exception);
+ bool result = false;
+ if (!se.IsThrown()) {
+ dispatcher->Send(new PpapiHostMsg_PPBVar_HasMethodDeprecated(
+ INTERFACE_ID_PPB_VAR_DEPRECATED,
+ SerializedVarSendInput(dispatcher, var),
+ SerializedVarSendInput(dispatcher, name), &se, &result));
+ }
+ return result;
+}
+
+PP_Var GetProperty(PP_Var var,
+ PP_Var name,
+ PP_Var* exception) {
+ Dispatcher* dispatcher = PluginDispatcher::Get();
+ ReceiveSerializedException se(dispatcher, exception);
+ ReceiveSerializedVarReturnValue result;
+ if (!se.IsThrown()) {
+ dispatcher->Send(new PpapiHostMsg_PPBVar_GetProperty(
+ INTERFACE_ID_PPB_VAR_DEPRECATED,
+ SerializedVarSendInput(dispatcher, var),
+ SerializedVarSendInput(dispatcher, name), &se, &result));
+ }
+ return result.Return(dispatcher);
+}
+
+void EnumerateProperties(PP_Var var,
+ uint32_t* property_count,
+ PP_Var** properties,
+ PP_Var* exception) {
+ Dispatcher* dispatcher = PluginDispatcher::Get();
+
+ ReceiveSerializedVarVectorOutParam out_vector(dispatcher,
+ property_count, properties);
+ ReceiveSerializedException se(dispatcher, exception);
+ if (!se.IsThrown()) {
+ dispatcher->Send(new PpapiHostMsg_PPBVar_EnumerateProperties(
+ INTERFACE_ID_PPB_VAR_DEPRECATED,
+ SerializedVarSendInput(dispatcher, var),
+ out_vector.OutParam(), &se));
+ }
+}
+
+void SetProperty(PP_Var var,
+ PP_Var name,
+ PP_Var value,
+ PP_Var* exception) {
+ Dispatcher* dispatcher = PluginDispatcher::Get();
+ ReceiveSerializedException se(dispatcher, exception);
+ if (!se.IsThrown()) {
+ dispatcher->Send(new PpapiHostMsg_PPBVar_SetPropertyDeprecated(
+ INTERFACE_ID_PPB_VAR_DEPRECATED,
+ SerializedVarSendInput(dispatcher, var),
+ SerializedVarSendInput(dispatcher, name),
+ SerializedVarSendInput(dispatcher, value), &se));
+ }
+}
+
+void RemoveProperty(PP_Var var,
+ PP_Var name,
+ PP_Var* exception) {
+ Dispatcher* dispatcher = PluginDispatcher::Get();
+ ReceiveSerializedException se(dispatcher, exception);
+ bool result = false;
+ if (!se.IsThrown()) {
+ dispatcher->Send(new PpapiHostMsg_PPBVar_DeleteProperty(
+ INTERFACE_ID_PPB_VAR_DEPRECATED,
+ SerializedVarSendInput(dispatcher, var),
+ SerializedVarSendInput(dispatcher, name), &se, &result));
+ }
+}
+
+PP_Var Call(PP_Var object,
+ PP_Var method_name,
+ uint32_t argc,
+ PP_Var* argv,
+ PP_Var* exception) {
+ Dispatcher* dispatcher = PluginDispatcher::Get();
+ ReceiveSerializedVarReturnValue result;
+ ReceiveSerializedException se(dispatcher, exception);
+ if (!se.IsThrown()) {
+ std::vector<SerializedVar> argv_vect;
+ SerializedVarSendInput::ConvertVector(dispatcher, argv, argc, &argv_vect);
+
+ dispatcher->Send(new PpapiHostMsg_PPBVar_CallDeprecated(
+ INTERFACE_ID_PPB_VAR_DEPRECATED,
+ SerializedVarSendInput(dispatcher, object),
+ SerializedVarSendInput(dispatcher, method_name), argv_vect,
+ &se, &result));
+ }
+ return result.Return(dispatcher);
+}
+
+PP_Var Construct(PP_Var object,
+ uint32_t argc,
+ PP_Var* argv,
+ PP_Var* exception) {
+ Dispatcher* dispatcher = PluginDispatcher::Get();
+ ReceiveSerializedVarReturnValue result;
+ ReceiveSerializedException se(dispatcher, exception);
+ if (!se.IsThrown()) {
+ std::vector<SerializedVar> argv_vect;
+ SerializedVarSendInput::ConvertVector(dispatcher, argv, argc, &argv_vect);
+
+ dispatcher->Send(new PpapiHostMsg_PPBVar_Construct(
+ INTERFACE_ID_PPB_VAR_DEPRECATED,
+ SerializedVarSendInput(dispatcher, object),
+ argv_vect, &se, &result));
+ }
+ return result.Return(dispatcher);
+}
+
+bool IsInstanceOf(PP_Var var,
+ const PPP_Class_Deprecated* ppp_class,
+ void** ppp_class_data) {
+ bool result = false;
+ Dispatcher* dispatcher = PluginDispatcher::Get();
+ int64 class_int = static_cast<int64>(reinterpret_cast<intptr_t>(ppp_class));
+ int64 class_data_int = 0;
+ dispatcher->Send(new PpapiHostMsg_PPBVar_IsInstanceOfDeprecated(
+ INTERFACE_ID_PPB_VAR_DEPRECATED, SerializedVarSendInput(dispatcher, var),
+ class_int, &class_data_int, &result));
+ *ppp_class_data =
+ reinterpret_cast<void*>(static_cast<intptr_t>(class_data_int));
+ return result;
+}
+
+PP_Var CreateObject(PP_Module module_id,
+ const PPP_Class_Deprecated* ppp_class,
+ void* ppp_class_data) {
+ Dispatcher* dispatcher = PluginDispatcher::Get();
+ ReceiveSerializedVarReturnValue result;
+ int64 class_int = static_cast<int64>(reinterpret_cast<intptr_t>(ppp_class));
+ int64 data_int =
+ static_cast<int64>(reinterpret_cast<intptr_t>(ppp_class_data));
+ dispatcher->Send(new PpapiHostMsg_PPBVar_CreateObjectDeprecated(
+ INTERFACE_ID_PPB_VAR_DEPRECATED, module_id, class_int, data_int,
+ &result));
+ return result.Return(dispatcher);
+}
+
+const PPB_Var_Deprecated var_deprecated_interface = {
+ &AddRefVar,
+ &ReleaseVar,
+ &VarFromUtf8,
+ &VarToUtf8,
+ &HasProperty,
+ &HasMethod,
+ &GetProperty,
+ &EnumerateProperties,
+ &SetProperty,
+ &RemoveProperty,
+ &Call,
+ &Construct,
+ &IsInstanceOf,
+ &CreateObject
+};
+
+} // namespace
+
+PPB_Var_Deprecated_Proxy::PPB_Var_Deprecated_Proxy(
+ Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface) {
+}
+
+PPB_Var_Deprecated_Proxy::~PPB_Var_Deprecated_Proxy() {
+}
+
+const void* PPB_Var_Deprecated_Proxy::GetSourceInterface() const {
+ return &var_deprecated_interface;
+}
+
+InterfaceID PPB_Var_Deprecated_Proxy::GetInterfaceId() const {
+ return INTERFACE_ID_PPB_VAR_DEPRECATED;
+}
+
+void PPB_Var_Deprecated_Proxy::OnMessageReceived(const IPC::Message& msg) {
+ IPC_BEGIN_MESSAGE_MAP(PPB_Var_Deprecated_Proxy, msg)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVar_HasProperty,
+ OnMsgHasProperty)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVar_HasMethodDeprecated,
+ OnMsgHasMethodDeprecated)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVar_GetProperty,
+ OnMsgGetProperty)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVar_DeleteProperty,
+ OnMsgDeleteProperty)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVar_EnumerateProperties,
+ OnMsgEnumerateProperties)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVar_SetPropertyDeprecated,
+ OnMsgSetPropertyDeprecated)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVar_CallDeprecated,
+ OnMsgCallDeprecated)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVar_Construct,
+ OnMsgConstruct)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVar_IsInstanceOfDeprecated,
+ OnMsgIsInstanceOfDeprecated)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVar_CreateObjectDeprecated,
+ OnMsgCreateObjectDeprecated)
+ IPC_END_MESSAGE_MAP()
+ // TODO(brettw) handle bad messages!
+}
+
+void PPB_Var_Deprecated_Proxy::OnMsgHasProperty(
+ SerializedVarReceiveInput var,
+ SerializedVarReceiveInput name,
+ SerializedVarOutParam exception,
+ bool* result) {
+ *result = ppb_var_target()->HasProperty(var.Get(dispatcher()),
+ name.Get(dispatcher()),
+ exception.OutParam(dispatcher()));
+}
+
+void PPB_Var_Deprecated_Proxy::OnMsgHasMethodDeprecated(
+ SerializedVarReceiveInput var,
+ SerializedVarReceiveInput name,
+ SerializedVarOutParam exception,
+ bool* result) {
+ *result = ppb_var_target()->HasMethod(var.Get(dispatcher()),
+ name.Get(dispatcher()),
+ exception.OutParam(dispatcher()));
+}
+
+void PPB_Var_Deprecated_Proxy::OnMsgGetProperty(
+ SerializedVarReceiveInput var,
+ SerializedVarReceiveInput name,
+ SerializedVarOutParam exception,
+ SerializedVarReturnValue result) {
+ result.Return(dispatcher(), ppb_var_target()->GetProperty(
+ var.Get(dispatcher()), name.Get(dispatcher()),
+ exception.OutParam(dispatcher())));
+}
+
+void PPB_Var_Deprecated_Proxy::OnMsgEnumerateProperties(
+ SerializedVarReceiveInput var,
+ SerializedVarVectorOutParam props,
+ SerializedVarOutParam exception) {
+ ppb_var_target()->GetAllPropertyNames(var.Get(dispatcher()),
+ props.CountOutParam(), props.ArrayOutParam(dispatcher()),
+ exception.OutParam(dispatcher()));
+}
+
+void PPB_Var_Deprecated_Proxy::OnMsgSetPropertyDeprecated(
+ SerializedVarReceiveInput var,
+ SerializedVarReceiveInput name,
+ SerializedVarReceiveInput value,
+ SerializedVarOutParam exception) {
+ ppb_var_target()->SetProperty(var.Get(dispatcher()),
+ name.Get(dispatcher()),
+ value.Get(dispatcher()),
+ exception.OutParam(dispatcher()));
+}
+
+void PPB_Var_Deprecated_Proxy::OnMsgDeleteProperty(
+ SerializedVarReceiveInput var,
+ SerializedVarReceiveInput name,
+ SerializedVarOutParam exception,
+ bool* result) {
+ ppb_var_target()->RemoveProperty(var.Get(dispatcher()),
+ name.Get(dispatcher()),
+ exception.OutParam(dispatcher()));
+ // This deprecated function doesn't actually return a value, but we re-use
+ // the message from the non-deprecated interface with the return value.
+ *result = true;
+}
+
+void PPB_Var_Deprecated_Proxy::OnMsgCallDeprecated(
+ SerializedVarReceiveInput object,
+ SerializedVarReceiveInput method_name,
+ SerializedVarVectorReceiveInput arg_vector,
+ SerializedVarOutParam exception,
+ SerializedVarReturnValue result) {
+ uint32_t arg_count = 0;
+ PP_Var* args = arg_vector.Get(dispatcher(), &arg_count);
+ result.Return(dispatcher(), ppb_var_target()->Call(
+ object.Get(dispatcher()),
+ method_name.Get(dispatcher()),
+ arg_count, args,
+ exception.OutParam(dispatcher())));
+}
+
+void PPB_Var_Deprecated_Proxy::OnMsgConstruct(
+ SerializedVarReceiveInput var,
+ SerializedVarVectorReceiveInput arg_vector,
+ SerializedVarOutParam exception,
+ SerializedVarReturnValue result) {
+ uint32_t arg_count = 0;
+ PP_Var* args = arg_vector.Get(dispatcher(), &arg_count);
+ result.Return(dispatcher(), ppb_var_target()->Construct(
+ var.Get(dispatcher()), arg_count, args,
+ exception.OutParam(dispatcher())));
+}
+
+void PPB_Var_Deprecated_Proxy::OnMsgIsInstanceOfDeprecated(
+ pp::proxy::SerializedVarReceiveInput var,
+ int64 ppp_class,
+ int64* ppp_class_data,
+ bool* result) {
+ // TODO(brettw) write this.
+}
+
+void PPB_Var_Deprecated_Proxy::OnMsgCreateObjectDeprecated(
+ PP_Module module_id,
+ int64 ppp_class,
+ int64 class_data,
+ SerializedVarReturnValue result) {
+ result.Return(dispatcher(), PPP_Class_Proxy::CreateProxiedObject(
+ ppb_var_target(), dispatcher(), module_id, ppp_class, class_data));
+}
+
+} // namespace proxy
+} // namespace pp
diff --git a/ppapi/proxy/ppb_var_deprecated_proxy.h b/ppapi/proxy/ppb_var_deprecated_proxy.h
new file mode 100644
index 0000000..9fe123a
--- /dev/null
+++ b/ppapi/proxy/ppb_var_deprecated_proxy.h
@@ -0,0 +1,95 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_PPB_VAR_PROXY_H_
+#define PPAPI_PPB_VAR_PROXY_H_
+
+#include <vector>
+
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_module.h"
+#include "ppapi/proxy/interface_proxy.h"
+
+struct PPB_Var_Deprecated;
+
+namespace pp {
+namespace proxy {
+
+class SerializedVar;
+class SerializedVarReceiveInput;
+class SerializedVarVectorOutParam;
+class SerializedVarVectorReceiveInput;
+class SerializedVarOutParam;
+class SerializedVarReturnValue;
+
+class PPB_Var_Deprecated_Proxy : public InterfaceProxy {
+ public:
+ PPB_Var_Deprecated_Proxy(Dispatcher* dispatcher,
+ const void* target_interface);
+ virtual ~PPB_Var_Deprecated_Proxy();
+
+ const PPB_Var_Deprecated* ppb_var_target() const {
+ return reinterpret_cast<const PPB_Var_Deprecated*>(target_interface());
+ }
+
+ // InterfaceProxy implementation.
+ virtual const void* GetSourceInterface() const;
+ virtual InterfaceID GetInterfaceId() const;
+ virtual void OnMessageReceived(const IPC::Message& msg);
+
+ private:
+ // Message handlers.
+ void OnMsgHasProperty(SerializedVarReceiveInput var,
+ SerializedVarReceiveInput name,
+ SerializedVarOutParam exception,
+ bool* result);
+ void OnMsgHasMethodDeprecated(SerializedVarReceiveInput var,
+ SerializedVarReceiveInput name,
+ SerializedVarOutParam exception,
+ bool* result);
+ void OnMsgGetProperty(SerializedVarReceiveInput var,
+ SerializedVarReceiveInput name,
+ SerializedVarOutParam exception,
+ SerializedVarReturnValue result);
+ void OnMsgEnumerateProperties(
+ SerializedVarReceiveInput var,
+ SerializedVarVectorOutParam props,
+ SerializedVarOutParam exception);
+ void OnMsgSetPropertyDeprecated(SerializedVarReceiveInput var,
+ SerializedVarReceiveInput name,
+ SerializedVarReceiveInput value,
+ SerializedVarOutParam exception);
+ void OnMsgDeleteProperty(SerializedVarReceiveInput var,
+ SerializedVarReceiveInput name,
+ SerializedVarOutParam exception,
+ bool* result);
+ void OnMsgCall(SerializedVarReceiveInput object,
+ SerializedVarReceiveInput this_object,
+ SerializedVarReceiveInput method_name,
+ SerializedVarVectorReceiveInput arg_vector,
+ SerializedVarOutParam exception,
+ SerializedVarReturnValue result);
+ void OnMsgCallDeprecated(SerializedVarReceiveInput object,
+ SerializedVarReceiveInput method_name,
+ SerializedVarVectorReceiveInput arg_vector,
+ SerializedVarOutParam exception,
+ SerializedVarReturnValue result);
+ void OnMsgConstruct(SerializedVarReceiveInput var,
+ SerializedVarVectorReceiveInput arg_vector,
+ SerializedVarOutParam exception,
+ SerializedVarReturnValue result);
+ void OnMsgIsInstanceOfDeprecated(pp::proxy::SerializedVarReceiveInput var,
+ int64 ppp_class,
+ int64* ppp_class_data,
+ bool* result);
+ void OnMsgCreateObjectDeprecated(PP_Module module_id,
+ int64 ppp_class,
+ int64 ppp_class_data,
+ SerializedVarReturnValue result);
+};
+
+} // namespace proxy
+} // namespace pp
+
+#endif // PPAPI_PPB_VAR_PROXY_H_