diff options
author | bauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-16 11:52:19 +0000 |
---|---|---|
committer | bauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-16 11:52:19 +0000 |
commit | a799122533f9ac9df6a5e173a5d0b75bab2b7687 (patch) | |
tree | ca72dab24a355bb31d3664e984ee6c5fed47a1eb /webkit | |
parent | 3f9de6c3b210d5f4ee0aa1324b048c9fa1ed808c (diff) | |
download | chromium_src-a799122533f9ac9df6a5e173a5d0b75bab2b7687.zip chromium_src-a799122533f9ac9df6a5e173a5d0b75bab2b7687.tar.gz chromium_src-a799122533f9ac9df6a5e173a5d0b75bab2b7687.tar.bz2 |
Revert 137396 - Sequentialize calls to PluginList::GetPlugins from PluginService.
BUG=105987
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10381087
TBR=bauerb@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10383210
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137398 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/plugins/npapi/plugin_list.cc | 25 | ||||
-rw-r--r-- | webkit/plugins/npapi/plugin_list.h | 23 |
2 files changed, 18 insertions, 30 deletions
diff --git a/webkit/plugins/npapi/plugin_list.cc b/webkit/plugins/npapi/plugin_list.cc index 6023fee..0b04b31 100644 --- a/webkit/plugins/npapi/plugin_list.cc +++ b/webkit/plugins/npapi/plugin_list.cc @@ -232,7 +232,7 @@ bool PluginList::DebugPluginLoading() { void PluginList::RefreshPlugins() { base::AutoLock lock(lock_); - loading_state_ = LOADING_STATE_NEEDS_REFRESH; + plugins_need_refresh_ = true; } void PluginList::AddExtraPluginPath(const FilePath& plugin_path) { @@ -371,7 +371,7 @@ bool PluginList::ParseMimeTypes( } PluginList::PluginList() - : loading_state_(LOADING_STATE_NEEDS_REFRESH) { + : plugins_need_refresh_(true) { PlatformInit(); AddHardcodedPluginGroups(kGroupDefinitions, ARRAYSIZE_UNSAFE(kGroupDefinitions)); @@ -379,7 +379,7 @@ PluginList::PluginList() PluginList::PluginList(const PluginGroupDefinition* definitions, size_t num_definitions) - : loading_state_(LOADING_STATE_NEEDS_REFRESH) { + : plugins_need_refresh_(true) { // Don't do platform-dependend initialization in unit tests. AddHardcodedPluginGroups(definitions, num_definitions); } @@ -398,8 +398,12 @@ void PluginList::LoadPluginsInternal(ScopedVector<PluginGroup>* plugin_groups) { base::Closure will_load_callback; { base::AutoLock lock(lock_); + // Clear the refresh bit now, because it might get set again before we + // reach the end of the method. + plugins_need_refresh_ = false; will_load_callback = will_load_plugins_callback_; } + if (!will_load_callback.is_null()) will_load_callback.Run(); @@ -417,10 +421,8 @@ void PluginList::LoadPluginsInternal(ScopedVector<PluginGroup>* plugin_groups) { void PluginList::LoadPlugins() { { base::AutoLock lock(lock_); - if (loading_state_ == LOADING_STATE_UP_TO_DATE) + if (!plugins_need_refresh_) return; - - loading_state_ = LOADING_STATE_REFRESHING; } ScopedVector<PluginGroup> new_plugin_groups; @@ -429,10 +431,6 @@ void PluginList::LoadPlugins() { base::AutoLock lock(lock_); plugin_groups_.swap(new_plugin_groups); - // If we haven't been invalidated in the mean time, mark the plug-in list as - // up-to-date. - if (loading_state_ != LOADING_STATE_NEEDS_REFRESH) - loading_state_ = LOADING_STATE_UP_TO_DATE; } bool PluginList::LoadPlugin(const FilePath& path, @@ -506,8 +504,7 @@ const std::vector<PluginGroup*>& PluginList::GetHardcodedPluginGroups() const { void PluginList::SetPlugins(const std::vector<webkit::WebPluginInfo>& plugins) { base::AutoLock lock(lock_); - DCHECK_NE(LOADING_STATE_REFRESHING, loading_state_); - loading_state_ = LOADING_STATE_UP_TO_DATE; + plugins_need_refresh_ = false; plugin_groups_.reset(); for (std::vector<webkit::WebPluginInfo>::const_iterator it = plugins.begin(); @@ -535,7 +532,7 @@ void PluginList::GetPlugins(std::vector<WebPluginInfo>* plugins) { bool PluginList::GetPluginsIfNoRefreshNeeded( std::vector<webkit::WebPluginInfo>* plugins) { base::AutoLock lock(lock_); - if (loading_state_ != LOADING_STATE_UP_TO_DATE) + if (plugins_need_refresh_) return false; for (size_t i = 0; i < plugin_groups_.size(); ++i) { @@ -560,7 +557,7 @@ void PluginList::GetPluginInfoArray( LoadPlugins(); base::AutoLock lock(lock_); if (use_stale) - *use_stale = (loading_state_ != LOADING_STATE_UP_TO_DATE); + *use_stale = plugins_need_refresh_; info->clear(); if (actual_mime_types) actual_mime_types->clear(); diff --git a/webkit/plugins/npapi/plugin_list.h b/webkit/plugins/npapi/plugin_list.h index a948782..d01b38f 100644 --- a/webkit/plugins/npapi/plugin_list.h +++ b/webkit/plugins/npapi/plugin_list.h @@ -121,7 +121,7 @@ class WEBKIT_PLUGINS_EXPORT PluginList { const string16& mime_type_descriptions, std::vector<webkit::WebPluginMimeType>* parsed_mime_types); - // Get all the plugins synchronously, loading them if necessary. + // Get all the plugins synchronously. void GetPlugins(std::vector<webkit::WebPluginInfo>* plugins); // Returns true if the list of plugins is cached and is copied into the out @@ -195,17 +195,6 @@ class WEBKIT_PLUGINS_EXPORT PluginList { ScopedVector<PluginGroup>* plugin_groups); private: - enum LoadingState { - LOADING_STATE_NEEDS_REFRESH, - LOADING_STATE_REFRESHING, - LOADING_STATE_UP_TO_DATE, - }; - - struct InternalPlugin { - webkit::WebPluginInfo info; - PluginEntryPoints entry_points; - }; - friend class PluginListTest; friend struct base::DefaultLazyInstanceTraits<PluginList>; FRIEND_TEST_ALL_PREFIXES(PluginGroupTest, PluginGroupDefinition); @@ -279,10 +268,8 @@ class WEBKIT_PLUGINS_EXPORT PluginList { // Internals // - // States whether we will load the plug-in list the next time we try to access - // it, whether we are currently in the process of loading it, or whether we - // consider it up-to-date. - LoadingState loading_state_; + // If true, we reload plugins even if they've been loaded already. + bool plugins_need_refresh_; // Extra plugin paths that we want to search when loading. std::vector<FilePath> extra_plugin_paths_; @@ -290,6 +277,10 @@ class WEBKIT_PLUGINS_EXPORT PluginList { // Extra plugin directories that we want to search when loading. std::vector<FilePath> extra_plugin_dirs_; + struct InternalPlugin { + webkit::WebPluginInfo info; + PluginEntryPoints entry_points; + }; // Holds information about internal plugins. std::vector<InternalPlugin> internal_plugins_; |