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

Unified Diff: content/browser/renderer_host/render_message_filter.cc

Issue 7497030: PluginList cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix crash Created 9 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 | « content/browser/renderer_host/buffered_resource_handler.cc ('k') | webkit/plugins/npapi/plugin_list.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_message_filter.cc
diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc
index de6d1290d54fe3f7f8e4cc0059b796f34a17be77..0e076ca6174b3641e10fbb750be9f14e85f64aac 100644
--- a/content/browser/renderer_host/render_message_filter.cc
+++ b/content/browser/renderer_host/render_message_filter.cc
@@ -522,16 +522,22 @@ void RenderMessageFilter::OnGetPlugins(
// is accumulated by doing multiple reads from disk. This effect is
// multiplied when we have several pages requesting this operation.
if (refresh) {
- const base::TimeDelta threshold = base::TimeDelta::FromSeconds(
- kPluginsRefreshThresholdInSeconds);
- const base::TimeTicks now = base::TimeTicks::Now();
- if (now - last_plugin_refresh_time_ < threshold)
- refresh = false; // Ignore refresh request; threshold not exceeded yet.
- else
- last_plugin_refresh_time_ = now;
+ const base::TimeDelta threshold = base::TimeDelta::FromSeconds(
+ kPluginsRefreshThresholdInSeconds);
+ const base::TimeTicks now = base::TimeTicks::Now();
+ if (now - last_plugin_refresh_time_ >= threshold) {
+ // Only refresh if the threshold hasn't been exceeded yet.
+ webkit::npapi::PluginList::Singleton()->RefreshPlugins();
+ last_plugin_refresh_time_ = now;
+ }
}
- webkit::npapi::PluginList::Singleton()->GetEnabledPlugins(refresh, plugins);
+ std::vector<webkit::npapi::WebPluginInfo> all_plugins;
+ webkit::npapi::PluginList::Singleton()->GetPlugins(&all_plugins);
+ for (size_t i = 0; i < all_plugins.size(); ++i) {
+ if (webkit::npapi::IsPluginEnabled(all_plugins[i]))
+ plugins->push_back(all_plugins[i]);
+ }
}
void RenderMessageFilter::OnGetPluginInfo(
« no previous file with comments | « content/browser/renderer_host/buffered_resource_handler.cc ('k') | webkit/plugins/npapi/plugin_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698