Commit 8adc4917 authored by Jeremy Roman's avatar Jeremy Roman Committed by Commit Bot

Simplify plugin list refresh logic.

blink::ResetPluginCache, called by content/, currently tries to refresh
the browser plugin cache as well, but content/ also blocks this from
happening. We can simplify by simply not making this call in that case.

Change-Id: Ib61db31ab03a481ea9b7c485df03af384e177637
Bug: 846722
Reviewed-on: https://chromium-review.googlesource.com/1072499
Commit-Queue: Jeremy Roman <jbroman@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#561871}
parent 13ececd7
......@@ -2318,13 +2318,7 @@ void RenderThreadImpl::OnSystemColorsChanged(
void RenderThreadImpl::PurgePluginListCache(bool reload_pages) {
#if BUILDFLAG(ENABLE_PLUGINS)
// The call below will cause a GetPlugins call with refresh=true, but at this
// point we already know that the browser has refreshed its list, so disable
// refresh temporarily to prevent each renderer process causing the list to be
// regenerated.
blink_platform_impl_->set_plugin_refresh_allowed(false);
blink::ResetPluginCache(reload_pages);
blink_platform_impl_->set_plugin_refresh_allowed(true);
for (auto& observer : observers_)
observer.PluginListChanged();
......
......@@ -267,7 +267,6 @@ RendererBlinkPlatformImpl::RendererBlinkPlatformImpl(
compositor_thread_(nullptr),
main_thread_(main_thread_scheduler->CreateMainThread()),
sudden_termination_disables_(0),
plugin_refresh_allowed_(true),
default_task_runner_(main_thread_scheduler->DefaultTaskRunner()),
web_scrollbar_behavior_(new WebScrollbarBehaviorImpl),
main_thread_scheduler_(main_thread_scheduler) {
......@@ -780,8 +779,6 @@ void RendererBlinkPlatformImpl::GetPluginList(
blink::WebPluginListBuilder* builder) {
#if BUILDFLAG(ENABLE_PLUGINS)
std::vector<WebPluginInfo> plugins;
if (!plugin_refresh_allowed_)
refresh = false;
RenderThread::Get()->Send(
new FrameHostMsg_GetPlugins(refresh, mainFrameOrigin, &plugins));
for (const WebPluginInfo& plugin : plugins) {
......
......@@ -74,9 +74,6 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl {
// Shutdown must be called just prior to shutting down blink.
void Shutdown();
void set_plugin_refresh_allowed(bool plugin_refresh_allowed) {
plugin_refresh_allowed_ = plugin_refresh_allowed;
}
// Platform methods:
blink::WebSandboxSupport* GetSandboxSupport() override;
blink::WebCookieJar* CookieJar() override;
......@@ -299,9 +296,6 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl {
// we tell the browser to enable fast termination.
int sudden_termination_disables_;
// If true, then a GetPlugins call is allowed to rescan the disk.
bool plugin_refresh_allowed_;
std::unique_ptr<blink::WebIDBFactory> web_idb_factory_;
std::unique_ptr<blink::WebBlobRegistry> blob_registry_;
......
......@@ -75,8 +75,9 @@ namespace blink {
// Wrapper function defined in WebKit.h
void ResetPluginCache(bool reload_pages) {
// At this point we already know that the browser has refreshed its list, so
// it is not necessary to force it to be regenerated.
DCHECK(!reload_pages);
Page::RefreshPlugins();
Page::ResetPluginData();
}
......@@ -318,10 +319,6 @@ void Page::InitialStyleChanged() {
}
}
void Page::RefreshPlugins() {
PluginData::RefreshBrowserSidePluginCache();
}
PluginData* Page::GetPluginData(const SecurityOrigin* main_frame_origin) {
if (!plugin_data_)
plugin_data_ = PluginData::Create();
......
......@@ -139,9 +139,6 @@ class CORE_EXPORT Page final : public GarbageCollectedFinalized<Page>,
// Returns the plugin data associated with |main_frame_origin|.
PluginData* GetPluginData(const SecurityOrigin* main_frame_origin);
// Refreshes the browser-side plugin cache.
static void RefreshPlugins();
// Resets the plugin data for all pages in the renderer process and notifies
// PluginsChangedObservers.
static void ResetPluginData();
......
......@@ -98,7 +98,7 @@ void DOMPluginArray::refresh(bool reload) {
if (!GetFrame())
return;
Page::RefreshPlugins();
PluginData::RefreshBrowserSidePluginCache();
if (PluginData* data = GetPluginData())
data->ResetPluginData();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment