summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorteravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-23 21:19:31 +0000
committerteravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-23 21:19:31 +0000
commit8dd2d2c0a249bd29ba0d8ebae82d6d4d37edd900 (patch)
tree97f4551bc483c5add251eba45ac5ac62b6040333
parente594bc73d39a8faa129918602c6db08a1515e58c (diff)
downloadchromium_src-8dd2d2c0a249bd29ba0d8ebae82d6d4d37edd900.zip
chromium_src-8dd2d2c0a249bd29ba0d8ebae82d6d4d37edd900.tar.gz
chromium_src-8dd2d2c0a249bd29ba0d8ebae82d6d4d37edd900.tar.bz2
Pepper: Add routing ID information to Connection.
To support in-process plugins, ResourceCall messages from the renderer to the browser will need to provide routing ID information for receiving a reply. We add a boolean for "in_process" as well so the plugin need only send the extra information when the plugin is running in-process. BUG= Review URL: https://chromiumcodereview.appspot.com/19704009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@213223 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/renderer/pepper/pepper_in_process_resource_creation.cc18
-rw-r--r--content/renderer/pepper/pepper_in_process_router.cc11
-rw-r--r--content/renderer/pepper/pepper_in_process_router.h3
-rw-r--r--content/renderer/pepper/pepper_plugin_delegate_impl.cc2
-rw-r--r--ppapi/proxy/connection.h22
5 files changed, 41 insertions, 15 deletions
diff --git a/content/renderer/pepper/pepper_in_process_resource_creation.cc b/content/renderer/pepper/pepper_in_process_resource_creation.cc
index d5c7030..bcb7eb5 100644
--- a/content/renderer/pepper/pepper_in_process_resource_creation.cc
+++ b/content/renderer/pepper/pepper_in_process_resource_creation.cc
@@ -59,7 +59,7 @@ PP_Resource PepperInProcessResourceCreation::CreateBrowserFont(
ppapi::Preferences prefs(
host_impl_->GetRenderViewForInstance(instance)->GetWebkitPreferences());
return (new ppapi::proxy::BrowserFontResource_Trusted(
- host_impl_->in_process_router()->GetPluginConnection(),
+ host_impl_->in_process_router()->GetPluginConnection(instance),
instance,
*description,
prefs))->GetReference();
@@ -73,7 +73,7 @@ PP_Resource PepperInProcessResourceCreation::CreateFileChooser(
ppapi::StringVar::FromPPVar(accept_types);
std::string str = string_var.get() ? string_var->value() : std::string();
return (new ppapi::proxy::FileChooserResource(
- host_impl_->in_process_router()->GetPluginConnection(),
+ host_impl_->in_process_router()->GetPluginConnection(instance),
instance,
mode,
str.c_str()))->GetReference();
@@ -82,7 +82,7 @@ PP_Resource PepperInProcessResourceCreation::CreateFileChooser(
PP_Resource PepperInProcessResourceCreation::CreateFileIO(
PP_Instance instance) {
return (new ppapi::proxy::FileIOResource(
- host_impl_->in_process_router()->GetPluginConnection(),
+ host_impl_->in_process_router()->GetPluginConnection(instance),
instance))->GetReference();
}
@@ -90,7 +90,7 @@ PP_Resource PepperInProcessResourceCreation::CreateFileSystem(
PP_Instance instance,
PP_FileSystemType type) {
return (new ppapi::proxy::FileSystemResource(
- host_impl_->in_process_router()->GetPluginConnection(),
+ host_impl_->in_process_router()->GetPluginConnection(instance),
instance, type))->GetReference();
}
@@ -99,14 +99,14 @@ PP_Resource PepperInProcessResourceCreation::CreateGraphics2D(
const PP_Size* size,
PP_Bool is_always_opaque) {
return (new ppapi::proxy::Graphics2DResource(
- host_impl_->in_process_router()->GetPluginConnection(),
+ host_impl_->in_process_router()->GetPluginConnection(instance),
instance, *size, is_always_opaque))->GetReference();
}
PP_Resource PepperInProcessResourceCreation::CreatePrinting(
PP_Instance instance) {
return (new ppapi::proxy::PrintingResource(
- host_impl_->in_process_router()->GetPluginConnection(),
+ host_impl_->in_process_router()->GetPluginConnection(instance),
instance))->GetReference();
}
@@ -120,21 +120,21 @@ PP_Resource PepperInProcessResourceCreation::CreateTrueTypeFont(
PP_Resource PepperInProcessResourceCreation::CreateURLLoader(
PP_Instance instance) {
return (new ppapi::proxy::URLLoaderResource(
- host_impl_->in_process_router()->GetPluginConnection(),
+ host_impl_->in_process_router()->GetPluginConnection(instance),
instance))->GetReference();
}
PP_Resource PepperInProcessResourceCreation::CreateURLRequestInfo(
PP_Instance instance) {
return (new ppapi::proxy::URLRequestInfoResource(
- host_impl_->in_process_router()->GetPluginConnection(),
+ host_impl_->in_process_router()->GetPluginConnection(instance),
instance, ::ppapi::URLRequestInfoData()))->GetReference();
}
PP_Resource PepperInProcessResourceCreation::CreateWebSocket(
PP_Instance instance) {
return (new ppapi::proxy::WebSocketResource(
- host_impl_->in_process_router()->GetPluginConnection(),
+ host_impl_->in_process_router()->GetPluginConnection(instance),
instance))->GetReference();
}
diff --git a/content/renderer/pepper/pepper_in_process_router.cc b/content/renderer/pepper/pepper_in_process_router.cc
index e0eecaa..d3e7f55 100644
--- a/content/renderer/pepper/pepper_in_process_router.cc
+++ b/content/renderer/pepper/pepper_in_process_router.cc
@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "base/message_loop/message_loop.h"
+#include "content/public/renderer/render_view.h"
#include "content/renderer/pepper/renderer_ppapi_host_impl.h"
#include "ipc/ipc_message.h"
#include "ipc/ipc_sender.h"
@@ -58,9 +59,15 @@ IPC::Sender* PepperInProcessRouter::GetRendererToPluginSender() {
return host_to_plugin_router_.get();
}
-ppapi::proxy::Connection PepperInProcessRouter::GetPluginConnection() {
+ppapi::proxy::Connection PepperInProcessRouter::GetPluginConnection(
+ PP_Instance instance) {
+ int routing_id = 0;
+ RenderView* view = host_impl_->GetRenderViewForInstance(instance);
+ if (view)
+ routing_id = view->GetRoutingID();
return ppapi::proxy::Connection(dummy_browser_channel_.get(),
- plugin_to_host_router_.get());
+ plugin_to_host_router_.get(),
+ routing_id);
}
bool PepperInProcessRouter::SendToHost(IPC::Message* msg) {
diff --git a/content/renderer/pepper/pepper_in_process_router.h b/content/renderer/pepper/pepper_in_process_router.h
index bc2d547..0d2993a 100644
--- a/content/renderer/pepper/pepper_in_process_router.h
+++ b/content/renderer/pepper/pepper_in_process_router.h
@@ -6,6 +6,7 @@
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
+#include "ppapi/c/pp_instance.h"
#include "ppapi/proxy/connection.h"
#include "ppapi/proxy/resource_message_params.h"
@@ -62,7 +63,7 @@ class PepperInProcessRouter {
// Returns a connection pair for use by a resource proxy. This includes
// the plugin->renderer sender as well as a dummy sender to the browser
// process. See the class comment above about the dummy sender.
- ppapi::proxy::Connection GetPluginConnection();
+ ppapi::proxy::Connection GetPluginConnection(PP_Instance instance);
private:
bool SendToHost(IPC::Message *msg);
diff --git a/content/renderer/pepper/pepper_plugin_delegate_impl.cc b/content/renderer/pepper/pepper_plugin_delegate_impl.cc
index d6a3b18..588f875 100644
--- a/content/renderer/pepper/pepper_plugin_delegate_impl.cc
+++ b/content/renderer/pepper/pepper_plugin_delegate_impl.cc
@@ -1334,7 +1334,7 @@ void PepperPluginDelegateImpl::HandleDocumentLoad(
// PPP_Instance function directly.
scoped_refptr<ppapi::proxy::URLLoaderResource> loader_resource(
new ppapi::proxy::URLLoaderResource(
- host_impl->in_process_router()->GetPluginConnection(),
+ host_impl->in_process_router()->GetPluginConnection(pp_instance),
pp_instance, pending_host_id, data));
PP_Resource loader_pp_resource = loader_resource->GetReference();
diff --git a/ppapi/proxy/connection.h b/ppapi/proxy/connection.h
index 5f99f06..13cbbc6 100644
--- a/ppapi/proxy/connection.h
+++ b/ppapi/proxy/connection.h
@@ -5,6 +5,8 @@
#ifndef PPAPI_PROXY_CONNECTION_H_
#define PPAPI_PROXY_CONNECTION_H_
+#include "ipc/ipc_message.h"
+
namespace IPC {
class Sender;
}
@@ -15,15 +17,31 @@ namespace proxy {
// This struct holds the channels that a resource uses to send message to the
// browser and renderer.
struct Connection {
- Connection() : browser_sender(0), renderer_sender(0) {
+ Connection() : browser_sender(0),
+ renderer_sender(0),
+ in_process(false),
+ browser_sender_routing_id(MSG_ROUTING_NONE) {
}
Connection(IPC::Sender* browser, IPC::Sender* renderer)
: browser_sender(browser),
- renderer_sender(renderer) {
+ renderer_sender(renderer),
+ in_process(false),
+ browser_sender_routing_id(MSG_ROUTING_NONE) {
+ }
+ Connection(IPC::Sender* browser, IPC::Sender* renderer, int routing_id)
+ : browser_sender(browser),
+ renderer_sender(renderer),
+ in_process(true),
+ browser_sender_routing_id(routing_id) {
}
IPC::Sender* browser_sender;
IPC::Sender* renderer_sender;
+ bool in_process;
+ // We need to use a routing ID when a plugin is in-process, and messages are
+ // sent back from the browser to the renderer. This is so that messages are
+ // routed to the proper RenderViewImpl.
+ int browser_sender_routing_id;
};
} // namespace proxy