diff options
author | bauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-29 17:38:44 +0000 |
---|---|---|
committer | bauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-29 17:38:44 +0000 |
commit | 480c7ccfaea656537cab2d7277d6b2368bc6ae33 (patch) | |
tree | d6db3186fc44b6561ae86039c51bfcc10b9bcbeb | |
parent | 3f5d4a172849a480b253f3beac4c2dc241da443b (diff) | |
download | chromium_src-480c7ccfaea656537cab2d7277d6b2368bc6ae33.zip chromium_src-480c7ccfaea656537cab2d7277d6b2368bc6ae33.tar.gz chromium_src-480c7ccfaea656537cab2d7277d6b2368bc6ae33.tar.bz2 |
Change PluginList::GetPluginsIfNoRefreshNeeded() to GetPluginsNoRefresh().
This fixes a race condition in PluginServiceImpl, where we would get an empty plug-in list if it was stale (instead of simply using the stale version).
BUG=124780
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10700032
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144925 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | content/browser/plugin_service_impl.cc | 4 | ||||
-rw-r--r-- | webkit/plugins/npapi/mock_plugin_list.cc | 4 | ||||
-rw-r--r-- | webkit/plugins/npapi/mock_plugin_list.h | 4 | ||||
-rw-r--r-- | webkit/plugins/npapi/plugin_list.cc | 7 | ||||
-rw-r--r-- | webkit/plugins/npapi/plugin_list.h | 6 |
5 files changed, 11 insertions, 14 deletions
diff --git a/content/browser/plugin_service_impl.cc b/content/browser/plugin_service_impl.cc index 9523b33..5a35037 100644 --- a/content/browser/plugin_service_impl.cc +++ b/content/browser/plugin_service_impl.cc @@ -486,7 +486,7 @@ bool PluginServiceImpl::GetPluginInfo(int render_process_id, bool PluginServiceImpl::GetPluginInfoByPath(const FilePath& plugin_path, webkit::WebPluginInfo* info) { std::vector<webkit::WebPluginInfo> plugins; - plugin_list_->GetPluginsIfNoRefreshNeeded(&plugins); + plugin_list_->GetPluginsNoRefresh(&plugins); for (std::vector<webkit::WebPluginInfo>::iterator it = plugins.begin(); it != plugins.end(); @@ -530,7 +530,7 @@ void PluginServiceImpl::GetPlugins(const GetPluginsCallback& callback) { base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); #elif defined(OS_POSIX) std::vector<webkit::WebPluginInfo> cached_plugins; - if (plugin_list_->GetPluginsIfNoRefreshNeeded(&cached_plugins)) { + if (plugin_list_->GetPluginsNoRefresh(&cached_plugins)) { // Can't assume the caller is reentrant. target_loop->PostTask(FROM_HERE, base::Bind(callback, cached_plugins)); diff --git a/webkit/plugins/npapi/mock_plugin_list.cc b/webkit/plugins/npapi/mock_plugin_list.cc index 1411ef5..4601101 100644 --- a/webkit/plugins/npapi/mock_plugin_list.cc +++ b/webkit/plugins/npapi/mock_plugin_list.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -23,7 +23,7 @@ void MockPluginList::ClearPluginsToLoad() { plugins_to_load_.clear(); } -bool MockPluginList::GetPluginsIfNoRefreshNeeded( +bool MockPluginList::GetPluginsNoRefresh( std::vector<webkit::WebPluginInfo>* plugins) { GetPlugins(plugins); return true; diff --git a/webkit/plugins/npapi/mock_plugin_list.h b/webkit/plugins/npapi/mock_plugin_list.h index 4ef5c3d..302bc92 100644 --- a/webkit/plugins/npapi/mock_plugin_list.h +++ b/webkit/plugins/npapi/mock_plugin_list.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -22,7 +22,7 @@ class MockPluginList : public PluginList { void ClearPluginsToLoad(); // PluginList: - virtual bool GetPluginsIfNoRefreshNeeded( + virtual bool GetPluginsNoRefresh( std::vector<webkit::WebPluginInfo>* plugins) OVERRIDE; private: diff --git a/webkit/plugins/npapi/plugin_list.cc b/webkit/plugins/npapi/plugin_list.cc index 474bc14..83b3f62 100644 --- a/webkit/plugins/npapi/plugin_list.cc +++ b/webkit/plugins/npapi/plugin_list.cc @@ -445,18 +445,15 @@ void PluginList::GetPlugins(std::vector<WebPluginInfo>* plugins) { } } -bool PluginList::GetPluginsIfNoRefreshNeeded( +bool PluginList::GetPluginsNoRefresh( std::vector<webkit::WebPluginInfo>* plugins) { base::AutoLock lock(lock_); - if (loading_state_ != LOADING_STATE_UP_TO_DATE) - return false; - for (size_t i = 0; i < plugin_groups_.size(); ++i) { const std::vector<webkit::WebPluginInfo>& gr_plugins = plugin_groups_[i]->web_plugin_infos(); plugins->insert(plugins->end(), gr_plugins.begin(), gr_plugins.end()); } - return true; + return loading_state_ == LOADING_STATE_UP_TO_DATE; } void PluginList::GetPluginInfoArray( diff --git a/webkit/plugins/npapi/plugin_list.h b/webkit/plugins/npapi/plugin_list.h index a948782..ebd93d6 100644 --- a/webkit/plugins/npapi/plugin_list.h +++ b/webkit/plugins/npapi/plugin_list.h @@ -124,9 +124,9 @@ class WEBKIT_PLUGINS_EXPORT PluginList { // Get all the plugins synchronously, loading them if necessary. void GetPlugins(std::vector<webkit::WebPluginInfo>* plugins); - // Returns true if the list of plugins is cached and is copied into the out - // pointer; returns false if the plugin list needs to be refreshed. - virtual bool GetPluginsIfNoRefreshNeeded( + // Copies the list of plug-ins into |plugins| without loading them. + // Returns true if the list of plugins is up-to-date. + virtual bool GetPluginsNoRefresh( std::vector<webkit::WebPluginInfo>* plugins); // Returns a list in |info| containing plugins that are found for |