Index: webkit/plugins/ppapi/ppapi_plugin_list.h |
=================================================================== |
--- webkit/plugins/ppapi/ppapi_plugin_list.h (revision 0) |
+++ webkit/plugins/ppapi/ppapi_plugin_list.h (revision 0) |
@@ -0,0 +1,90 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_LIST_H_ |
+#define WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_LIST_H_ |
+ |
+#include <map> |
+#include <vector> |
+ |
+#include "webkit/plugins/ppapi/ppapi_plugin_info.h" |
+ |
+namespace webkit { |
+namespace ppapi { |
+ |
+// This class holds references to all of the known pepper plugin modules. |
+// |
+// It keeps two lists. One list of preloaded in-process modules, and one list |
+// is a list of all live modules (some of which may be out-of-process and hence |
+// not preloaded). |
+class PluginList { |
+ public: |
+ PluginList(); |
+ ~PluginList(); |
+ |
+ // The following functions add plugins modules to the list. |
+ // They must be called before calling Load/PreloadModules. |
+ |
+ // Returns the list of all known plugins. |
+ const std::vector<PluginInfo>& plugin_list() const { return plugin_list_; } |
+ |
+ void RegisterAll(); |
+ |
+ // Loads and initializes all known plugins. |
+ void LoadModules(); |
+ |
+ // Loads the external libraries but does not initialize them (i.e., does not |
+ // call PPP_InitializeModule). This is needed by the zygote on Linux to get |
+ // access to the plugins before entering the sandbox. |
+ void PreloadModules(); |
+ |
+ // Retrieves the information associated with the given plugin info. The |
+ // return value will be NULL if there is no such plugin. |
+ // |
+ // The returned pointer is owned by PluginList. |
+ const PluginInfo* GetInfoForPlugin(const FilePath& plugin_path); |
+ |
+ // Returns an existing loaded module for the given path. It will search for |
+ // both preloaded in-process or currently active (non crashed) out-of-process |
+ // plugins matching the given name. Returns NULL if the plugin hasn't been |
+ // loaded. |
+ PluginModule* GetLiveModule(const FilePath& path); |
+ |
+ // Notifies the registry that a new non-preloaded module has been created. |
+ // This is normally called for out-of-process plugins. Once this is called, |
+ // the module is available to be returned by GetModule(). The module will |
+ // automatically unregister itself by calling PluginModuleDestroyed(). |
+ void AddLiveModule(const FilePath& path, PluginModule* module); |
+ |
+ // PluginDelegate::ModuleLifetime implementation. |
+ virtual void PluginModuleDead(PluginModule* dead_module); |
+ |
+ private: |
+ // Adds plugins specified in the command line. |
+ void AddFromCommandLine(); |
+ |
+ // All known pepper plugins. |
+ std::vector<PluginInfo> plugin_list_; |
+ |
+ // Plugins that have been preloaded so they can be executed in-process in |
+ // the renderer (the sandbox prevents on-demand loading). |
+ typedef std::map<FilePath, scoped_refptr<PluginModule> > OwningModuleMap; |
+ OwningModuleMap preloaded_modules_; |
+ |
+ // A list of non-owning pointers to all currently-live plugin modules. This |
+ // includes both preloaded ones in preloaded_modules_, and out-of-process |
+ // modules whose lifetime is managed externally. This will contain only |
+ // non-crashed modules. If an out-of-process module crashes, it may |
+ // continue as long as there are WebKit references to it, but it will not |
+ // appear in this list. |
+ typedef std::map<FilePath, PluginModule*> NonOwningModuleMap; |
+ NonOwningModuleMap live_modules_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(PluginList); |
+}; |
+ |
+} // namespace ppapi |
+} // namespace webkit |
+ |
+#endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_LIST_H_ |
Property changes on: webkit\plugins\ppapi\ppapi_plugin_list.h |
___________________________________________________________________ |
Added: svn:eol-style |
+ LF |