| Index: ppapi/proxy/plugin_var_tracker.cc
|
| diff --git a/ppapi/proxy/plugin_var_tracker.cc b/ppapi/proxy/plugin_var_tracker.cc
|
| index 0788b99923d44b5f4392d69374dbdb6e202c1c2e..a9cbd9c7a62bd2e6fdefc9b4b7f4d2c552ed8ba6 100644
|
| --- a/ppapi/proxy/plugin_var_tracker.cc
|
| +++ b/ppapi/proxy/plugin_var_tracker.cc
|
| @@ -6,10 +6,13 @@
|
|
|
| #include "base/memory/ref_counted.h"
|
| #include "base/memory/singleton.h"
|
| +#include "ipc/ipc_message.h"
|
| #include "ppapi/c/dev/ppp_class_deprecated.h"
|
| #include "ppapi/c/ppb_var.h"
|
| +#include "ppapi/proxy/file_system_resource.h"
|
| #include "ppapi/proxy/plugin_array_buffer_var.h"
|
| #include "ppapi/proxy/plugin_dispatcher.h"
|
| +#include "ppapi/proxy/plugin_globals.h"
|
| #include "ppapi/proxy/plugin_resource_var.h"
|
| #include "ppapi/proxy/ppapi_messages.h"
|
| #include "ppapi/proxy/proxy_object_var.h"
|
| @@ -22,6 +25,16 @@
|
| namespace ppapi {
|
| namespace proxy {
|
|
|
| +namespace {
|
| +
|
| +Connection GetConnectionForInstance(PP_Instance instance) {
|
| + PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
|
| + DCHECK(dispatcher);
|
| + return Connection(PluginGlobals::Get()->GetBrowserSender(), dispatcher);
|
| +}
|
| +
|
| +} // namespace
|
| +
|
| PluginVarTracker::HostVar::HostVar(PluginDispatcher* d, int32 i)
|
| : dispatcher(d),
|
| host_object_id(i) {
|
| @@ -154,6 +167,41 @@ void PluginVarTracker::ReleaseHostObject(PluginDispatcher* dispatcher,
|
| ReleaseVar(found->second);
|
| }
|
|
|
| +PP_Var PluginVarTracker::MakeResourcePPVarFromMessage(
|
| + PP_Instance instance,
|
| + const IPC::Message& creation_message,
|
| + int pending_renderer_id,
|
| + int pending_browser_id) {
|
| + DCHECK(pending_renderer_id);
|
| + DCHECK(pending_browser_id);
|
| + switch (creation_message.type()) {
|
| + case PpapiPluginMsg_FileSystem_CreateFromPendingHost::ID: {
|
| + PP_FileSystemType file_system_type;
|
| + if (!UnpackMessage<PpapiPluginMsg_FileSystem_CreateFromPendingHost>(
|
| + creation_message, &file_system_type)) {
|
| + NOTREACHED() << "Invalid message of type "
|
| + "PpapiPluginMsg_FileSystem_CreateFromPendingHost";
|
| + return PP_MakeNull();
|
| + }
|
| + // Create a plugin-side resource and attach it to the host resource.
|
| + // Note: This only makes sense when the plugin is out of process (which
|
| + // should always be true when passing resource vars).
|
| + PP_Resource pp_resource =
|
| + (new FileSystemResource(GetConnectionForInstance(instance),
|
| + instance,
|
| + pending_renderer_id,
|
| + pending_browser_id,
|
| + file_system_type))->GetReference();
|
| + return MakeResourcePPVar(pp_resource);
|
| + }
|
| + default: {
|
| + NOTREACHED() << "Creation message has unexpected type "
|
| + << creation_message.type();
|
| + return PP_MakeNull();
|
| + }
|
| + }
|
| +}
|
| +
|
| ResourceVar* PluginVarTracker::MakeResourceVar(PP_Resource pp_resource) {
|
| // The resource 0 returns a null resource var.
|
| if (!pp_resource)
|
|
|