Revert 137396 - Sequentialize calls to PluginList::GetPlugins from PluginService.
BUG=105987
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10381087
[email protected]
Review URL: https://chromiumcodereview.appspot.com/10383210
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137398 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/content/browser/plugin_service_impl.cc b/content/browser/plugin_service_impl.cc
index 29873b4..e7dfead 100644
--- a/content/browser/plugin_service_impl.cc
+++ b/content/browser/plugin_service_impl.cc
@@ -13,6 +13,7 @@
#include "base/path_service.h"
#include "base/string_util.h"
#include "base/synchronization/waitable_event.h"
+#include "base/threading/sequenced_worker_pool.h"
#include "base/threading/thread.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
@@ -59,17 +60,13 @@
// Callback set on the PluginList to assert that plugin loading happens on the
// correct thread.
+void WillLoadPluginsCallback() {
#if defined(OS_WIN)
-void WillLoadPluginsCallbackWin(
- base::SequencedWorkerPool::SequenceToken token) {
- CHECK(BrowserThread::GetBlockingPool()->IsRunningSequenceOnCurrentThread(
- token));
-}
+ CHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread());
#else
-void WillLoadPluginsCallbackPosix() {
CHECK(false) << "Plugin loading should happen out-of-process.";
-}
#endif
+}
} // namespace
@@ -150,14 +147,8 @@
if (!plugin_list_)
plugin_list_ = webkit::npapi::PluginList::Singleton();
-#if defined(OS_WIN)
- plugin_list_token_ = BrowserThread::GetBlockingPool()->GetSequenceToken();
plugin_list_->set_will_load_plugins_callback(
- base::Bind(&WillLoadPluginsCallbackWin, plugin_list_token_));
-#else
- plugin_list_->set_will_load_plugins_callback(
- base::Bind(&WillLoadPluginsCallbackPosix));
-#endif
+ base::Bind(&WillLoadPluginsCallback));
RegisterPepperPlugins();
@@ -172,7 +163,6 @@
if (!path.empty())
plugin_list_->AddExtraPluginDir(path);
-
#if defined(OS_MACOSX)
// We need to know when the browser comes forward so we can bring modal plugin
// windows forward too.
@@ -202,8 +192,7 @@
hklm_watcher_.StartWatching(hklm_event_.get(), this);
}
}
-#endif
-#if defined(OS_POSIX) && !defined(OS_OPENBSD)
+#elif defined(OS_POSIX) && !defined(OS_OPENBSD)
// On ChromeOS the user can't install plugins anyway and on Windows all
// important plugins register themselves in the registry so no need to do that.
file_watcher_delegate_ = new PluginDirWatcherDelegate();
@@ -517,13 +506,12 @@
MessageLoop::current()->message_loop_proxy());
#if defined(OS_WIN)
- BrowserThread::GetBlockingPool()->PostSequencedWorkerTaskWithShutdownBehavior(
- plugin_list_token_,
+ BrowserThread::GetBlockingPool()->PostWorkerTaskWithShutdownBehavior(
FROM_HERE,
base::Bind(&PluginServiceImpl::GetPluginsInternal, base::Unretained(this),
target_loop, callback),
base::SequencedWorkerPool::SKIP_ON_SHUTDOWN);
-#elif defined(OS_POSIX)
+#else
std::vector<webkit::WebPluginInfo> cached_plugins;
if (plugin_list_->GetPluginsIfNoRefreshNeeded(&cached_plugins)) {
// Can't assume the caller is reentrant.
@@ -538,8 +526,6 @@
base::Bind(&PluginLoaderPosix::LoadPlugins, plugin_loader_,
target_loop, callback));
}
-#else
-#error Not implemented
#endif
}
@@ -548,12 +534,10 @@
GetPlugins(base::Bind(&GetPluginsForGroupsCallback, callback));
}
-#if defined(OS_WIN)
void PluginServiceImpl::GetPluginsInternal(
base::MessageLoopProxy* target_loop,
const PluginService::GetPluginsCallback& callback) {
- DCHECK(BrowserThread::GetBlockingPool()->IsRunningSequenceOnCurrentThread(
- plugin_list_token_));
+ DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread());
std::vector<webkit::WebPluginInfo> plugins;
plugin_list_->GetPlugins(&plugins);
@@ -561,7 +545,6 @@
target_loop->PostTask(FROM_HERE,
base::Bind(callback, plugins));
}
-#endif
void PluginServiceImpl::OnWaitableEventSignaled(
base::WaitableEvent* waitable_event) {