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

Unified Diff: third_party/WebKit/Source/platform/plugins/PluginData.cpp

Issue 2156803002: [HBD] Remove PluginCache and reload plugin list when origin changes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Set m_refresh to false after plugin list is retrieved Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/plugins/PluginData.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/plugins/PluginData.cpp
diff --git a/third_party/WebKit/Source/platform/plugins/PluginData.cpp b/third_party/WebKit/Source/platform/plugins/PluginData.cpp
index 4897488b842de7a845c17c668d7a12426384c840..8e6369a2323e5eca8926b8d45bc6b63646db6013 100644
--- a/third_party/WebKit/Source/platform/plugins/PluginData.cpp
+++ b/third_party/WebKit/Source/platform/plugins/PluginData.cpp
@@ -27,42 +27,6 @@
#include "public/platform/Platform.h"
namespace blink {
-
-class PluginCache {
-public:
- PluginCache() : m_loaded(false), m_refresh(false) { }
- ~PluginCache() { reset(false); }
-
- void reset(bool refresh)
- {
- m_plugins.clear();
- m_loaded = false;
- m_refresh = refresh;
- }
-
- const Vector<PluginInfo>& plugins()
- {
- if (!m_loaded) {
- PluginListBuilder builder(&m_plugins);
- Platform::current()->getPluginList(m_refresh, &builder);
- m_loaded = true;
- m_refresh = false;
- }
- return m_plugins;
- }
-
-private:
- Vector<PluginInfo> m_plugins;
- bool m_loaded;
- bool m_refresh;
-};
-
-static PluginCache& pluginCache()
-{
- DEFINE_STATIC_LOCAL(PluginCache, cache, ());
- return cache;
-}
-
PluginData::PluginData(const Page* page)
{
initPlugins(page);
@@ -105,20 +69,22 @@ String PluginData::pluginNameForMimeType(const String& mimeType) const
void PluginData::initPlugins(const Page*)
{
- const Vector<PluginInfo>& plugins = pluginCache().plugins();
- for (size_t i = 0; i < plugins.size(); ++i)
- m_plugins.append(plugins[i]);
+ PluginListBuilder builder(&m_plugins);
+ Platform::current()->getPluginList(m_refresh, &builder);
+ m_refresh = false;
}
void PluginData::refresh()
{
- pluginCache().reset(true);
- pluginCache().plugins(); // Force the plugins to be reloaded now.
+ m_refresh = true;
}
String getPluginMimeTypeFromExtension(const String& extension)
{
- const Vector<PluginInfo>& plugins = pluginCache().plugins();
+ Vector<PluginInfo> plugins;
tommycli 2016/07/18 19:29:04 I think we can do something like: if (m_refresh)
trizzofo 2016/07/29 22:19:09 Unfortunately we can't do that because getPluginMi
+ PluginListBuilder builder(&plugins);
+ Platform::current()->getPluginList(PluginData::m_refresh, &builder);
+ PluginData::m_refresh = false;
for (size_t i = 0; i < plugins.size(); ++i) {
for (size_t j = 0; j < plugins[i].mimes.size(); ++j) {
const MimeClassInfo& mime = plugins[i].mimes[j];
@@ -132,4 +98,6 @@ String getPluginMimeTypeFromExtension(const String& extension)
return String();
}
+bool PluginData::m_refresh = false;
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/platform/plugins/PluginData.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698