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

Unified Diff: content/browser/plugin_service_impl.cc

Issue 128773002: Restart plugin loading only if the plugin list has actually become stale. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test Created 6 years, 11 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/plugin_service_impl.h ('k') | content/common/plugin_list.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/plugin_service_impl.cc
diff --git a/content/browser/plugin_service_impl.cc b/content/browser/plugin_service_impl.cc
index b65704be40adb1c71def22a95a5ffe50b8af6cf9..047859aee84ac1a9c381fe916922ea189b5b18e9 100644
--- a/content/browser/plugin_service_impl.cc
+++ b/content/browser/plugin_service_impl.cc
@@ -115,6 +115,12 @@ void NotifyPluginDirChanged(const base::FilePath& path, bool error) {
}
#endif
+void ForwardCallback(base::MessageLoopProxy* target_loop,
+ const PluginService::GetPluginsCallback& callback,
+ const std::vector<WebPluginInfo>& plugins) {
+ target_loop->PostTask(FROM_HERE, base::Bind(callback, plugins));
+}
+
} // namespace
// static
@@ -597,20 +603,9 @@ void PluginServiceImpl::GetPlugins(const GetPluginsCallback& callback) {
return;
}
#if defined(OS_POSIX)
- std::vector<WebPluginInfo> cached_plugins;
- if (PluginList::Singleton()->GetPluginsNoRefresh(&cached_plugins)) {
- // Can't assume the caller is reentrant.
- target_loop->PostTask(FROM_HERE,
- base::Bind(callback, cached_plugins));
- } else {
- // If we switch back to loading plugins in process, then we need to make
- // sure g_thread_init() gets called since plugins may call glib at load.
- if (!plugin_loader_.get())
- plugin_loader_ = new PluginLoaderPosix;
- BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
- base::Bind(&PluginLoaderPosix::LoadPlugins, plugin_loader_,
- target_loop, callback));
- }
+ BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
+ base::Bind(&PluginServiceImpl::GetPluginsOnIOThread,
+ base::Unretained(this), target_loop, callback));
#else
NOTREACHED();
#endif
@@ -629,6 +624,23 @@ void PluginServiceImpl::GetPluginsInternal(
base::Bind(callback, plugins));
}
+#if defined(OS_POSIX)
+void PluginServiceImpl::GetPluginsOnIOThread(
+ base::MessageLoopProxy* target_loop,
+ const GetPluginsCallback& callback) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+
+ // If we switch back to loading plugins in process, then we need to make
+ // sure g_thread_init() gets called since plugins may call glib at load.
+
+ if (!plugin_loader_)
+ plugin_loader_ = new PluginLoaderPosix;
+
+ plugin_loader_->GetPlugins(
+ base::Bind(&ForwardCallback, make_scoped_refptr(target_loop), callback));
+}
+#endif
+
void PluginServiceImpl::OnWaitableEventSignaled(
base::WaitableEvent* waitable_event) {
#if defined(OS_WIN)
« no previous file with comments | « content/browser/plugin_service_impl.h ('k') | content/common/plugin_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698