summaryrefslogtreecommitdiffstats
path: root/webkit/plugins/ppapi/plugin_module.h
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-04 22:31:21 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-04 22:31:21 +0000
commitece8f0bfe21498928a4a352e7c318efcdae06b18 (patch)
treed5cca4f46344bb9e82782bcf2109ef67d11ce7ce /webkit/plugins/ppapi/plugin_module.h
parent9a861cc490008122943d4e3df06ddda1f9c5dab1 (diff)
downloadchromium_src-ece8f0bfe21498928a4a352e7c318efcdae06b18.zip
chromium_src-ece8f0bfe21498928a4a352e7c318efcdae06b18.tar.gz
chromium_src-ece8f0bfe21498928a4a352e7c318efcdae06b18.tar.bz2
Re-use existing out-of-process plugins if one is already loaded. Otherwise
sites with multiple plugins will load that many child processes, which is bad. This works by having creators of out-of-process plugins add it to a list in the PepperPluginRegistry. The items are deleted from this list by a new delegate implementation for the module to tell the registry that it's being destroyed. It's a little awkward since the PluginModule can't know about the PepperPluginRegistry, and all other pepper "delegates" are associated with the Instance/RenderView, so by definition can't be used when the module is being torn down since there are no instances. It might have been nice to have an Add function on the lifetime delegate so that the module will add itself to the list. But the plugin path name is currently not available in all code paths, and it seemed messy to add. TEST=manual BUG=none Review URL: http://codereview.chromium.org/6085007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70457 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/plugins/ppapi/plugin_module.h')
-rw-r--r--webkit/plugins/ppapi/plugin_module.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/webkit/plugins/ppapi/plugin_module.h b/webkit/plugins/ppapi/plugin_module.h
index d4096c61..913b003 100644
--- a/webkit/plugins/ppapi/plugin_module.h
+++ b/webkit/plugins/ppapi/plugin_module.h
@@ -68,9 +68,13 @@ class PluginModule : public base::RefCounted<PluginModule>,
PPP_ShutdownModuleFunc shutdown_module; // Optional, may be NULL.
};
- // You must call one of the Init functions to create a module of the type
- // you desire.
- PluginModule();
+ // You must call one of the Init functions after the constructor to create a
+ // module of the type you desire.
+ //
+ // The module lifetime delegate is a non-owning pointer that must outlive
+ // all plugin modules. In practice it will be a global singleton that
+ // tracks which modules are alive.
+ PluginModule(PluginDelegate::ModuleLifetime* lifetime_delegate);
~PluginModule();
@@ -142,6 +146,8 @@ class PluginModule : public base::RefCounted<PluginModule>,
// entrypoints in that case).
bool InitializeModule();
+ PluginDelegate::ModuleLifetime* lifetime_delegate_;
+
// Tracker for completion callbacks, used mainly to ensure that all callbacks
// are properly aborted on module shutdown.
scoped_refptr<CallbackTracker> callback_tracker_;