diff options
author | mgiuca@chromium.org <mgiuca@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-26 07:38:33 +0000 |
---|---|---|
committer | mgiuca@chromium.org <mgiuca@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-26 07:38:33 +0000 |
commit | 29b8f2312c189bd8394ea13e5063acfe9c395507 (patch) | |
tree | 57fffd40ef4a0286d15dabc93f81bb86c8ffcd95 /ppapi | |
parent | 8b5cd4ec8654fc5db76765ff1ffb6f4d9ee23e7e (diff) | |
download | chromium_src-29b8f2312c189bd8394ea13e5063acfe9c395507.zip chromium_src-29b8f2312c189bd8394ea13e5063acfe9c395507.tar.gz chromium_src-29b8f2312c189bd8394ea13e5063acfe9c395507.tar.bz2 |
[PPAPI] ResourceVar now holds a pending renderer and browser host ID.
It is likely that resources will be backed by a host in the renderer or
browser, or both. Therefore, HostResourceVar should provide a consistent
way to tell the plugin the pending host IDs.
BUG=177017
Review URL: https://codereview.chromium.org/24196005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@225380 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r-- | ppapi/proxy/raw_var_data.cc | 14 | ||||
-rw-r--r-- | ppapi/proxy/raw_var_data.h | 6 | ||||
-rw-r--r-- | ppapi/shared_impl/resource_var.cc | 8 | ||||
-rw-r--r-- | ppapi/shared_impl/resource_var.h | 6 |
4 files changed, 32 insertions, 2 deletions
diff --git a/ppapi/proxy/raw_var_data.cc b/ppapi/proxy/raw_var_data.cc index 337eaae..91bcfbfd 100644 --- a/ppapi/proxy/raw_var_data.cc +++ b/ppapi/proxy/raw_var_data.cc @@ -665,8 +665,10 @@ bool DictionaryRawVarData::Read(PP_VarType type, } // ResourceRawVarData ---------------------------------------------------------- -ResourceRawVarData::ResourceRawVarData() { -} +ResourceRawVarData::ResourceRawVarData() + : pp_resource_(0), + pending_renderer_host_id_(0), + pending_browser_host_id_(0) {} ResourceRawVarData::~ResourceRawVarData() { } @@ -686,6 +688,8 @@ bool ResourceRawVarData::Init(const PP_Var& var, PP_Instance /*instance*/) { creation_message_.reset(new IPC::Message(*message)); else creation_message_.reset(); + pending_renderer_host_id_ = resource_var->GetPendingRendererHostId(); + pending_browser_host_id_ = resource_var->GetPendingBrowserHostId(); initialized_ = true; return true; } @@ -708,6 +712,8 @@ void ResourceRawVarData::PopulatePPVar(const PP_Var& var, void ResourceRawVarData::Write(IPC::Message* m, const HandleWriter& handle_writer) { m->WriteInt(static_cast<int>(pp_resource_)); + m->WriteInt(pending_renderer_host_id_); + m->WriteInt(pending_browser_host_id_); m->WriteBool(creation_message_); if (creation_message_) IPC::ParamTraits<IPC::Message>::Write(m, *creation_message_); @@ -720,6 +726,10 @@ bool ResourceRawVarData::Read(PP_VarType type, if (!m->ReadInt(iter, &value)) return false; pp_resource_ = static_cast<PP_Resource>(value); + if (!m->ReadInt(iter, &pending_renderer_host_id_)) + return false; + if (!m->ReadInt(iter, &pending_browser_host_id_)) + return false; bool has_creation_message; if (!m->ReadBool(iter, &has_creation_message)) return false; diff --git a/ppapi/proxy/raw_var_data.h b/ppapi/proxy/raw_var_data.h index 201da2c..d45ea53 100644 --- a/ppapi/proxy/raw_var_data.h +++ b/ppapi/proxy/raw_var_data.h @@ -283,6 +283,12 @@ class ResourceRawVarData : public RawVarData { // This is a borrowed reference; the resource's refcount is not incremented. PP_Resource pp_resource_; + // Pending resource host ID in the renderer. + int pending_renderer_host_id_; + + // Pending resource host ID in the browser. + int pending_browser_host_id_; + // A message containing information about how to create a plugin-side // resource. The message type will vary based on the resource type, and will // usually contain a pending resource host ID, and other required information. diff --git a/ppapi/shared_impl/resource_var.cc b/ppapi/shared_impl/resource_var.cc index 3e34c38..1260843 100644 --- a/ppapi/shared_impl/resource_var.cc +++ b/ppapi/shared_impl/resource_var.cc @@ -9,6 +9,14 @@ namespace ppapi { +int ResourceVar::GetPendingRendererHostId() const { + return 0; +} + +int ResourceVar::GetPendingBrowserHostId() const { + return 0; +} + const IPC::Message* ResourceVar::GetCreationMessage() const { return NULL; } diff --git a/ppapi/shared_impl/resource_var.h b/ppapi/shared_impl/resource_var.h index 0b8bab2..96d2403 100644 --- a/ppapi/shared_impl/resource_var.h +++ b/ppapi/shared_impl/resource_var.h @@ -25,6 +25,12 @@ class PPAPI_SHARED_EXPORT ResourceVar : public Var { // plugin side. It should be AddRef'd if the resource is passed to the user. virtual PP_Resource GetPPResource() const = 0; + // Gets the pending resource host ID in the renderer. + virtual int GetPendingRendererHostId() const; + + // Gets the pending resource host ID in the browser. + virtual int GetPendingBrowserHostId() const; + // Gets the message for creating a plugin-side resource. Returns NULL if the // message is empty (which is always true on the plugin side). virtual const IPC::Message* GetCreationMessage() const; |