Changeset 85978 in webkit
- Timestamp:
- May 6, 2011 2:17:42 PM (13 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r85962 r85978 1 2011-05-06 Anders Carlsson <andersca@apple.com> 2 3 Reviewed by Dan Bernstein. 4 5 Make more PluginInfoStore member functions static 6 https://bugs.webkit.org/show_bug.cgi?id=60401 7 8 This is a first step towards making PluginInfoStore thread safe. 9 10 * UIProcess/Plugins/PluginInfoStore.cpp: 11 (WebKit::PluginInfoStore::loadPluginsIfNecessary): 12 (WebKit::PluginInfoStore::loadPlugin): 13 * UIProcess/Plugins/PluginInfoStore.h: 14 * UIProcess/Plugins/mac/PluginInfoStoreMac.mm: 15 (WebKit::PluginInfoStore::shouldUsePlugin): 16 * UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp: 17 (WebKit::PluginInfoStore::shouldUsePlugin): 18 * UIProcess/Plugins/win/PluginInfoStoreWin.cpp: 19 (WebKit::PluginInfoStore::shouldUsePlugin): 20 1 21 2011-05-06 Adam Roben <aroben@apple.com> 2 22 -
trunk/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp
r78676 r85978 71 71 return; 72 72 73 m_plugins.clear();74 75 73 PathHashSet uniquePluginPaths; 76 74 … … 87 85 addFromVector(uniquePluginPaths, individualPluginPaths()); 88 86 87 Vector<Plugin> plugins; 88 89 89 PathHashSet::const_iterator end = uniquePluginPaths.end(); 90 90 for (PathHashSet::const_iterator it = uniquePluginPaths.begin(); it != end; ++it) 91 loadPlugin(*it); 92 91 loadPlugin(plugins, *it); 92 93 m_plugins.swap(plugins); 93 94 m_pluginListIsUpToDate = true; 94 95 } 95 96 96 void PluginInfoStore::loadPlugin( const String& pluginPath)97 void PluginInfoStore::loadPlugin(Vector<Plugin>& plugins, const String& pluginPath) 97 98 { 98 99 Plugin plugin; … … 101 102 return; 102 103 103 if (!shouldUsePlugin(plugin ))104 if (!shouldUsePlugin(plugins, plugin)) 104 105 return; 105 106 106 // Add the plug-in. 107 m_plugins.append(plugin); 107 plugins.append(plugin); 108 108 } 109 109 -
trunk/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.h
r84177 r85978 76 76 77 77 void loadPluginsIfNecessary(); 78 void loadPlugin(const String& pluginPath);78 static void loadPlugin(Vector<Plugin>& plugins, const String& pluginPath); 79 79 80 // Platform-specific member functions 80 // Platform-specific member functions: 81 81 82 82 // Returns paths to directories that should be searched for plug-ins (via pluginPathsInDirectory). 83 83 static Vector<String> pluginsDirectories(); 84 84 85 // Returns paths to all plug-ins in the specified directory. 85 86 static Vector<String> pluginPathsInDirectory(const String& directory); 87 86 88 // Returns paths to individual plug-ins that won't be found via pluginsDirectories/pluginPathsInDirectory. 87 89 static Vector<String> individualPluginPaths(); 90 91 // Load plug-in info for the plug-in with the specified path. 88 92 static bool getPluginInfo(const String& pluginPath, Plugin& plugin); 89 bool shouldUsePlugin(const Plugin& plugin); 93 94 // Return whether this plug-in should be used (added to the list of plug-ins) or not. 95 static bool shouldUsePlugin(Vector<Plugin>& alreadyLoadedPlugins, const Plugin&); 96 97 // Get the MIME type for the given extension. 90 98 static String getMIMETypeForExtension(const String& extension); 91 99 -
trunk/Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm
r76991 r85978 77 77 } 78 78 79 bool PluginInfoStore::shouldUsePlugin( const Plugin& plugin)79 bool PluginInfoStore::shouldUsePlugin(Vector<Plugin>& alreadyLoadedPlugins, const Plugin& plugin) 80 80 { 81 for (size_t i = 0; i < m_plugins.size(); ++i) {82 const Plugin& loadedPlugin = m_plugins[i];81 for (size_t i = 0; i < alreadyLoadedPlugins.size(); ++i) { 82 const Plugin& loadedPlugin = alreadyLoadedPlugins[i]; 83 83 84 84 // If a plug-in with the same bundle identifier already exists, we don't want to load it. -
trunk/Source/WebKit2/UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp
r85951 r85978 65 65 } 66 66 67 bool PluginInfoStore::shouldUsePlugin( const Plugin& plugin)67 bool PluginInfoStore::shouldUsePlugin(Vector<Plugin>& alreadyLoadedPlugins, const Plugin& plugin) 68 68 { 69 69 // We do not do any black-listing presently. -
trunk/Source/WebKit2/UIProcess/Plugins/win/PluginInfoStoreWin.cpp
r83772 r85978 339 339 } 340 340 341 bool PluginInfoStore::shouldUsePlugin(const Plugin& plugin)341 bool PluginInfoStore::shouldUsePlugin(const Vector<Plugin>& alreadyLoadedPlugins, const Plugin& plugin) 342 342 { 343 343 if (plugin.info.name == "Citrix ICA Client") { … … 374 374 // Don't load the old Windows Media Player plugin if we've already loaded the new Windows 375 375 // Media Player plugin. 376 for (size_t i = 0; i < m_plugins.size(); ++i) {377 if (!isNewWindowsMediaPlayerPlugin( m_plugins[i]))376 for (size_t i = 0; i < alreadyLoadedPlugins.size(); ++i) { 377 if (!isNewWindowsMediaPlayerPlugin(alreadyLoadedPlugins[i])) 378 378 continue; 379 379 return false; … … 383 383 384 384 if (isNewWindowsMediaPlayerPlugin(plugin)) { 385 // Unload the old Windows Media Player plugin if we've already loaded it.385 // Remove the old Windows Media Player plugin if we've already added it. 386 386 for (size_t i = 0; i < m_plugins.size(); ++i) { 387 387 if (!isOldWindowsMediaPlayerPlugin(m_plugins[i])) 388 388 continue; 389 m_plugins.remove(i);389 alreadyLoadedPlugins.remove(i); 390 390 } 391 391 return true; … … 395 395 // only the first. <http://webkit.org/b/58469> 396 396 String pluginFileName = pathGetFileName(plugin.path); 397 for (size_t i = 0; i < m_plugins.size(); ++i) {398 Plugin& loadedPlugin = m_plugins[i];397 for (size_t i = 0; i < alreadyLoadedPlugins.size(); ++i) { 398 const Plugin& loadedPlugin = alreadyLoadedPlugins[i]; 399 399 400 400 // If a plug-in with the same filename already exists, we don't want to load it.
Note: See TracChangeset
for help on using the changeset viewer.