summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-10 21:16:34 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-10 21:16:34 +0000
commit2cc0622486b85be1e098ecd2af563c0fa9743b26 (patch)
treeeb32a99ee1dddb5699ee5208bd2b153501020fb3 /chrome/common
parent82388663bfbeb4dc2fc58e86f83505e67b483d31 (diff)
downloadchromium_src-2cc0622486b85be1e098ecd2af563c0fa9743b26.zip
chromium_src-2cc0622486b85be1e098ecd2af563c0fa9743b26.tar.gz
chromium_src-2cc0622486b85be1e098ecd2af563c0fa9743b26.tar.bz2
Ensure that PP_Instance values are unique within a plugin process in addition
to within the renderer. This works by having the renderer check with the plugin that a PP_Instance is available before using it. If it's already seen, the renderer will generate a new PP_Instance and retry. For performance, this message is handled on the I/O thread of the plugin so it will not be blocked by the actual plugin code. This requires an unfortunate amount of plumbing. Since the renderer can't depend directly on the proxy, we have a new PPB_Proxy function to set the verification function used to perform this check. There is also a new plugin dispatcher delegate where I moved some of the global state to that used to go into the init function. Adding yet another parameter there seemed unfortunate. TEST=manual BUG=74961 Review URL: http://codereview.chromium.org/6628019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77693 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/DEPS1
-rw-r--r--chrome/common/pepper_plugin_registry.cc17
-rw-r--r--chrome/common/pepper_plugin_registry.h9
3 files changed, 26 insertions, 1 deletions
diff --git a/chrome/common/DEPS b/chrome/common/DEPS
index cd9bd3f..e6f68bb 100644
--- a/chrome/common/DEPS
+++ b/chrome/common/DEPS
@@ -6,6 +6,7 @@ include_rules = [
"+media/audio",
"+media/base",
"+ppapi/c", # For various types.
+ "+ppapi/proxy",
"+remoting/client/plugin",
"+sandbox/src",
"+skia",
diff --git a/chrome/common/pepper_plugin_registry.cc b/chrome/common/pepper_plugin_registry.cc
index 2b315fb..ff312a2 100644
--- a/chrome/common/pepper_plugin_registry.cc
+++ b/chrome/common/pepper_plugin_registry.cc
@@ -13,6 +13,7 @@
#include "base/utf_string_conversions.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
+#include "content/common/child_process.h"
#include "content/common/content_switches.h"
#include "remoting/client/plugin/pepper_entrypoints.h"
@@ -326,3 +327,19 @@ PepperPluginRegistry::PepperPluginRegistry() {
preloaded_modules_[current.path] = module;
}
}
+
+MessageLoop* PepperPluginRegistry::GetIPCMessageLoop() {
+ // This is called only in the renderer so we know we have a child process.
+ DCHECK(ChildProcess::current()) << "Must be in the renderer.";
+ return ChildProcess::current()->io_message_loop();
+}
+
+base::WaitableEvent* PepperPluginRegistry::GetShutdownEvent() {
+ DCHECK(ChildProcess::current()) << "Must be in the renderer.";
+ return ChildProcess::current()->GetShutDownEvent();
+}
+
+std::set<PP_Instance>* PepperPluginRegistry::GetGloballySeenInstanceIDSet() {
+ // This function is not needed on the host side of the proxy.
+ return NULL;
+}
diff --git a/chrome/common/pepper_plugin_registry.h b/chrome/common/pepper_plugin_registry.h
index beb808c3..1852954 100644
--- a/chrome/common/pepper_plugin_registry.h
+++ b/chrome/common/pepper_plugin_registry.h
@@ -11,6 +11,7 @@
#include <vector>
#include "base/file_path.h"
+#include "ppapi/proxy/dispatcher.h"
#include "webkit/plugins/npapi/webplugininfo.h"
#include "webkit/plugins/ppapi/plugin_delegate.h"
#include "webkit/plugins/ppapi/plugin_module.h"
@@ -45,7 +46,8 @@ struct PepperPluginInfo {
// is a list of all live modules (some of which may be out-of-process and hence
// not preloaded).
class PepperPluginRegistry
- : public webkit::ppapi::PluginDelegate::ModuleLifetime {
+ : public webkit::ppapi::PluginDelegate::ModuleLifetime,
+ public pp::proxy::Dispatcher::Delegate {
public:
~PepperPluginRegistry();
@@ -90,6 +92,11 @@ class PepperPluginRegistry
private:
PepperPluginRegistry();
+ // Dispatcher::Delegate implementation.
+ virtual MessageLoop* GetIPCMessageLoop();
+ virtual base::WaitableEvent* GetShutdownEvent();
+ virtual std::set<PP_Instance>* GetGloballySeenInstanceIDSet();
+
// All known pepper plugins.
std::vector<PepperPluginInfo> plugin_list_;