Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(997)

Side by Side Diff: content/common/pepper_plugin_registry.h

Issue 20172004: Split PepperPluginRegistry into the pieces that are needed in each process. content/common only nee… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/common/pepper_plugin_list.cc ('k') | content/common/pepper_plugin_registry.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_COMMON_PEPPER_PLUGIN_REGISTRY_H_
6 #define CONTENT_COMMON_PEPPER_PLUGIN_REGISTRY_H_
7
8 #include <list>
9 #include <map>
10
11 #include "content/public/common/pepper_plugin_info.h"
12
13 // TODO(jam): refactor
14 #include "content/renderer/pepper/plugin_module.h"
15
16 namespace content {
17
18 // Constructs a PepperPluginInfo from a WebPluginInfo. Returns false if
19 // the operation is not possible, in particular the WebPluginInfo::type
20 // must be one of the pepper types.
21 bool MakePepperPluginInfo(const WebPluginInfo& webplugin_info,
22 PepperPluginInfo* pepper_info);
23
24 // This class holds references to all of the known pepper plugin modules.
25 //
26 // It keeps two lists. One list of preloaded in-process modules, and one list
27 // is a list of all live modules (some of which may be out-of-process and hence
28 // not preloaded).
29 class PepperPluginRegistry {
30 public:
31 ~PepperPluginRegistry();
32
33 static PepperPluginRegistry* GetInstance();
34
35 // Computes the list of known pepper plugins.
36 //
37 // This method is static so that it can be used by the browser process, which
38 // has no need to load the pepper plugin modules. It will re-compute the
39 // plugin list every time it is called. Generally, code in the registry should
40 // be using the cached plugin_list_ instead.
41 CONTENT_EXPORT static void ComputeList(
42 std::vector<PepperPluginInfo>* plugins);
43
44 // Loads the (native) libraries but does not initialize them (i.e., does not
45 // call PPP_InitializeModule). This is needed by the zygote on Linux to get
46 // access to the plugins before entering the sandbox.
47 static void PreloadModules();
48
49 // Retrieves the information associated with the given plugin info. The
50 // return value will be NULL if there is no such plugin.
51 //
52 // The returned pointer is owned by the PluginRegistry.
53 const PepperPluginInfo* GetInfoForPlugin(const WebPluginInfo& info);
54
55 // Returns an existing loaded module for the given path. It will search for
56 // both preloaded in-process or currently active (non crashed) out-of-process
57 // plugins matching the given name. Returns NULL if the plugin hasn't been
58 // loaded.
59 webkit::ppapi::PluginModule* GetLiveModule(const base::FilePath& path);
60
61 // Notifies the registry that a new non-preloaded module has been created.
62 // This is normally called for out-of-process plugins. Once this is called,
63 // the module is available to be returned by GetModule(). The module will
64 // automatically unregister itself by calling PluginModuleDestroyed().
65 void AddLiveModule(const base::FilePath& path,
66 webkit::ppapi::PluginModule* module);
67
68 void PluginModuleDead(webkit::ppapi::PluginModule* dead_module);
69
70 private:
71 PepperPluginRegistry();
72
73 // All known pepper plugins.
74 std::vector<PepperPluginInfo> plugin_list_;
75
76 // Plugins that have been preloaded so they can be executed in-process in
77 // the renderer (the sandbox prevents on-demand loading).
78 typedef std::map<base::FilePath,
79 scoped_refptr<webkit::ppapi::PluginModule> >
80 OwningModuleMap;
81 OwningModuleMap preloaded_modules_;
82
83 // A list of non-owning pointers to all currently-live plugin modules. This
84 // includes both preloaded ones in preloaded_modules_, and out-of-process
85 // modules whose lifetime is managed externally. This will contain only
86 // non-crashed modules. If an out-of-process module crashes, it may
87 // continue as long as there are WebKit references to it, but it will not
88 // appear in this list.
89 typedef std::map<base::FilePath, webkit::ppapi::PluginModule*>
90 NonOwningModuleMap;
91 NonOwningModuleMap live_modules_;
92
93 DISALLOW_COPY_AND_ASSIGN(PepperPluginRegistry);
94 };
95
96 } // namespace content
97
98 #endif // CONTENT_COMMON_PEPPER_PLUGIN_REGISTRY_H_
OLDNEW
« no previous file with comments | « content/common/pepper_plugin_list.cc ('k') | content/common/pepper_plugin_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698