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 |