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

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

Issue 6628019: Ensure that PP_Instance values are unique within a plugin process in addition... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 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 | « chrome/common/DEPS ('k') | chrome/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
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_COMMON_PEPPER_PLUGIN_REGISTRY_H_ 5 #ifndef CHROME_COMMON_PEPPER_PLUGIN_REGISTRY_H_
6 #define CHROME_COMMON_PEPPER_PLUGIN_REGISTRY_H_ 6 #define CHROME_COMMON_PEPPER_PLUGIN_REGISTRY_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/file_path.h" 13 #include "base/file_path.h"
14 #include "ppapi/proxy/dispatcher.h"
14 #include "webkit/plugins/npapi/webplugininfo.h" 15 #include "webkit/plugins/npapi/webplugininfo.h"
15 #include "webkit/plugins/ppapi/plugin_delegate.h" 16 #include "webkit/plugins/ppapi/plugin_delegate.h"
16 #include "webkit/plugins/ppapi/plugin_module.h" 17 #include "webkit/plugins/ppapi/plugin_module.h"
17 18
18 struct PepperPluginInfo { 19 struct PepperPluginInfo {
19 PepperPluginInfo(); 20 PepperPluginInfo();
20 ~PepperPluginInfo(); 21 ~PepperPluginInfo();
21 22
22 // Indicates internal plugins for which there's not actually a library. 23 // Indicates internal plugins for which there's not actually a library.
23 // These plugins are implemented in the Chrome binary using a separate set 24 // These plugins are implemented in the Chrome binary using a separate set
(...skipping 14 matching lines...) Expand all
38 // entry points for the internal plugins. 39 // entry points for the internal plugins.
39 webkit::ppapi::PluginModule::EntryPoints internal_entry_points; 40 webkit::ppapi::PluginModule::EntryPoints internal_entry_points;
40 }; 41 };
41 42
42 // This class holds references to all of the known pepper plugin modules. 43 // This class holds references to all of the known pepper plugin modules.
43 // 44 //
44 // It keeps two lists. One list of preloaded in-process modules, and one list 45 // It keeps two lists. One list of preloaded in-process modules, and one list
45 // is a list of all live modules (some of which may be out-of-process and hence 46 // is a list of all live modules (some of which may be out-of-process and hence
46 // not preloaded). 47 // not preloaded).
47 class PepperPluginRegistry 48 class PepperPluginRegistry
48 : public webkit::ppapi::PluginDelegate::ModuleLifetime { 49 : public webkit::ppapi::PluginDelegate::ModuleLifetime,
50 public pp::proxy::Dispatcher::Delegate {
49 public: 51 public:
50 ~PepperPluginRegistry(); 52 ~PepperPluginRegistry();
51 53
52 static const char* kPDFPluginName; 54 static const char* kPDFPluginName;
53 55
54 static PepperPluginRegistry* GetInstance(); 56 static PepperPluginRegistry* GetInstance();
55 57
56 // Computes the list of known pepper plugins. 58 // Computes the list of known pepper plugins.
57 // 59 //
58 // This method is static so that it can be used by the browser process, which 60 // This method is static so that it can be used by the browser process, which
(...skipping 24 matching lines...) Expand all
83 // the module is available to be returned by GetModule(). The module will 85 // the module is available to be returned by GetModule(). The module will
84 // automatically unregister itself by calling PluginModuleDestroyed(). 86 // automatically unregister itself by calling PluginModuleDestroyed().
85 void AddLiveModule(const FilePath& path, webkit::ppapi::PluginModule* module); 87 void AddLiveModule(const FilePath& path, webkit::ppapi::PluginModule* module);
86 88
87 // ModuleLifetime implementation. 89 // ModuleLifetime implementation.
88 virtual void PluginModuleDead(webkit::ppapi::PluginModule* dead_module); 90 virtual void PluginModuleDead(webkit::ppapi::PluginModule* dead_module);
89 91
90 private: 92 private:
91 PepperPluginRegistry(); 93 PepperPluginRegistry();
92 94
95 // Dispatcher::Delegate implementation.
96 virtual MessageLoop* GetIPCMessageLoop();
97 virtual base::WaitableEvent* GetShutdownEvent();
98 virtual std::set<PP_Instance>* GetGloballySeenInstanceIDSet();
99
93 // All known pepper plugins. 100 // All known pepper plugins.
94 std::vector<PepperPluginInfo> plugin_list_; 101 std::vector<PepperPluginInfo> plugin_list_;
95 102
96 // Plugins that have been preloaded so they can be executed in-process in 103 // Plugins that have been preloaded so they can be executed in-process in
97 // the renderer (the sandbox prevents on-demand loading). 104 // the renderer (the sandbox prevents on-demand loading).
98 typedef std::map<FilePath, scoped_refptr<webkit::ppapi::PluginModule> > 105 typedef std::map<FilePath, scoped_refptr<webkit::ppapi::PluginModule> >
99 OwningModuleMap; 106 OwningModuleMap;
100 OwningModuleMap preloaded_modules_; 107 OwningModuleMap preloaded_modules_;
101 108
102 // A list of non-owning pointers to all currently-live plugin modules. This 109 // A list of non-owning pointers to all currently-live plugin modules. This
103 // includes both preloaded ones in preloaded_modules_, and out-of-process 110 // includes both preloaded ones in preloaded_modules_, and out-of-process
104 // modules whose lifetime is managed externally. This will contain only 111 // modules whose lifetime is managed externally. This will contain only
105 // non-crashed modules. If an out-of-process module crashes, it may 112 // non-crashed modules. If an out-of-process module crashes, it may
106 // continue as long as there are WebKit references to it, but it will not 113 // continue as long as there are WebKit references to it, but it will not
107 // appear in this list. 114 // appear in this list.
108 typedef std::map<FilePath, webkit::ppapi::PluginModule*> NonOwningModuleMap; 115 typedef std::map<FilePath, webkit::ppapi::PluginModule*> NonOwningModuleMap;
109 NonOwningModuleMap live_modules_; 116 NonOwningModuleMap live_modules_;
110 }; 117 };
111 118
112 #endif // CHROME_COMMON_PEPPER_PLUGIN_REGISTRY_H_ 119 #endif // CHROME_COMMON_PEPPER_PLUGIN_REGISTRY_H_
OLDNEW
« no previous file with comments | « chrome/common/DEPS ('k') | chrome/common/pepper_plugin_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698