diff options
author | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-14 14:38:00 +0000 |
---|---|---|
committer | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-14 14:38:00 +0000 |
commit | a40996367757f82fb2e22035ac65c9d0510e1651 (patch) | |
tree | b4676838b8c03991dc09736ea0046cd61a27442c /chrome/browser/plugin_service.cc | |
parent | d90bcafafdccbef95760c2d9c1b4ce8206d46b7b (diff) | |
download | chromium_src-a40996367757f82fb2e22035ac65c9d0510e1651.zip chromium_src-a40996367757f82fb2e22035ac65c9d0510e1651.tar.gz chromium_src-a40996367757f82fb2e22035ac65c9d0510e1651.tar.bz2 |
Reverting 23420. It caused a reliability regression.
TBR=jam
BUG=none
TEST=reliability
Review URL: http://codereview.chromium.org/165532
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23437 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/plugin_service.cc')
-rw-r--r-- | chrome/browser/plugin_service.cc | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/chrome/browser/plugin_service.cc b/chrome/browser/plugin_service.cc index fe6dfa6..d9d3e65 100644 --- a/chrome/browser/plugin_service.cc +++ b/chrome/browser/plugin_service.cc @@ -40,10 +40,8 @@ PluginService::PluginService() // Load the one specified on the command line as well. const CommandLine* command_line = CommandLine::ForCurrentProcess(); std::wstring path = command_line->GetSwitchValue(switches::kLoadPlugin); - if (!path.empty()) { - NPAPI::PluginList::Singleton()->AddExtraPluginPath( - FilePath::FromWStringHack(path)); - } + if (!path.empty()) + NPAPI::PluginList::AddExtraPluginPath(FilePath::FromWStringHack(path)); #if defined(OS_WIN) hkcu_key_.Create( @@ -77,6 +75,12 @@ PluginService::~PluginService() { #endif } +void PluginService::GetPlugins(bool refresh, + std::vector<WebPluginInfo>* plugins) { + AutoLock lock(lock_); + NPAPI::PluginList::Singleton()->GetPlugins(refresh, plugins); +} + void PluginService::LoadChromePlugins( ResourceDispatcherHost* resource_dispatcher_host) { resource_dispatcher_host_ = resource_dispatcher_host; @@ -84,10 +88,12 @@ void PluginService::LoadChromePlugins( } void PluginService::SetChromePluginDataDir(const FilePath& data_dir) { + AutoLock lock(lock_); chrome_plugin_data_dir_ = data_dir; } const FilePath& PluginService::GetChromePluginDataDir() { + AutoLock lock(lock_); return chrome_plugin_data_dir_; } @@ -126,8 +132,7 @@ PluginProcessHost* PluginService::FindOrStartPluginProcess( return plugin_host; WebPluginInfo info; - if (!NPAPI::PluginList::Singleton()->GetPluginInfoByPath( - plugin_path, &info)) { + if (!GetPluginInfoByPath(plugin_path, &info)) { DCHECK(false); return NULL; } @@ -174,6 +179,7 @@ FilePath PluginService::GetPluginPath(const GURL& url, const std::string& mime_type, const std::string& clsid, std::string* actual_mime_type) { + AutoLock lock(lock_); bool allow_wildcard = true; WebPluginInfo info; if (NPAPI::PluginList::Singleton()->GetPluginInfo(url, mime_type, clsid, @@ -186,6 +192,23 @@ FilePath PluginService::GetPluginPath(const GURL& url, return FilePath(); } +bool PluginService::GetPluginInfoByPath(const FilePath& plugin_path, + WebPluginInfo* info) { + AutoLock lock(lock_); + return NPAPI::PluginList::Singleton()->GetPluginInfoByPath(plugin_path, info); +} + +bool PluginService::HavePluginFor(const std::string& mime_type, + bool allow_wildcard) { + AutoLock lock(lock_); + + GURL url; + WebPluginInfo info; + return NPAPI::PluginList::Singleton()->GetPluginInfo(url, mime_type, "", + allow_wildcard, &info, + NULL); +} + void PluginService::OnWaitableEventSignaled(base::WaitableEvent* waitable_event) { #if defined(OS_WIN) if (waitable_event == hkcu_event_.get()) { @@ -194,7 +217,8 @@ void PluginService::OnWaitableEventSignaled(base::WaitableEvent* waitable_event) hklm_key_.StartWatching(); } - NPAPI::PluginList::Singleton()->ResetPluginsLoaded(); + AutoLock lock(lock_); + NPAPI::PluginList::ResetPluginsLoaded(); for (RenderProcessHost::iterator it = RenderProcessHost::begin(); it != RenderProcessHost::end(); ++it) { @@ -218,8 +242,9 @@ void PluginService::Observe(NotificationType type, extension != extensions->end(); ++extension) { for (size_t i = 0; i < (*extension)->plugins().size(); ++i ) { const Extension::PluginInfo& plugin = (*extension)->plugins()[i]; - NPAPI::PluginList::Singleton()->ResetPluginsLoaded(); - NPAPI::PluginList::Singleton()->AddExtraPluginPath(plugin.path); + AutoLock lock(lock_); + NPAPI::PluginList::ResetPluginsLoaded(); + NPAPI::PluginList::AddExtraPluginPath(plugin.path); if (!plugin.is_public) private_plugins_[plugin.path] = (*extension)->url(); } |