diff options
author | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-30 23:18:29 +0000 |
---|---|---|
committer | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-30 23:18:29 +0000 |
commit | 7f2e792eec4293b56c6eb9a5d014cee9ed612841 (patch) | |
tree | 08f30bf750e13bbaff2c3871bb0622137883294c /chrome/browser/plugin_service.cc | |
parent | e6d51160f9cf94237fdb2a25317c20c43eb14b6b (diff) | |
download | chromium_src-7f2e792eec4293b56c6eb9a5d014cee9ed612841.zip chromium_src-7f2e792eec4293b56c6eb9a5d014cee9ed612841.tar.gz chromium_src-7f2e792eec4293b56c6eb9a5d014cee9ed612841.tar.bz2 |
Revert 33344 - Relocate plugin list fetching to PluginService
We fetch the plugin list from three places. Previously, each location had
custom code to proxy the query to the file thread. This change moves
the query to the PluginService, which then internally manages posting to
the file thread and calling back.
I experimented with some different approaches to handling the lifetimes
of the requests and responses. The approach now is simple:
The PluginService plugin methods are called and respond on the IO
thread. Two of the three consumers of the plugin lists are already on
the IO thread, so they don't need any complicated thread handling.
None of the callers ever need to cancel their requests: one is a
singleton, and the other two always wait (in terms of holding a ref
on the object) for the requests to complete. This makes lifetime
management a lot simpler than it would otherwise be.
With this change in place, I can then look at refactoring the PluginService
implementation on Linux to do more complicated plugin loading as needed in
bug 17863.
BUG=17863
Review URL: http://codereview.chromium.org/437069
TBR=evan@chromium.org
Review URL: http://codereview.chromium.org/456012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33369 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/plugin_service.cc')
-rw-r--r-- | chrome/browser/plugin_service.cc | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/chrome/browser/plugin_service.cc b/chrome/browser/plugin_service.cc index 578e23e..ba5821e 100644 --- a/chrome/browser/plugin_service.cc +++ b/chrome/browser/plugin_service.cc @@ -126,44 +126,6 @@ const FilePath& PluginService::GetChromePluginDataDir() { return chrome_plugin_data_dir_; } -// Call the GetPluginListClient back with a list of plugings. -// |plugins| is intentionally pass-by-value so it's copied from the File thread -// back to the IO thread. -static void CallGetPluginListClient(PluginService::GetPluginListClient* client, - const std::vector<WebPluginInfo> plugins) { - DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); - - client->OnGetPluginList(plugins); -} - -// Go out to disk (well, NPAPI::PluginList) to get the plugin list. -// Called on the file thread. -static void GetPluginListOnFileThread( - bool refresh, - PluginService::GetPluginListClient* client) { - DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE)); - - std::vector<WebPluginInfo> plugins; - NPAPI::PluginList::Singleton()->GetPlugins(refresh, &plugins); - - // Call the client back on the IO thread. - ChromeThread::PostTask( - ChromeThread::IO, FROM_HERE, - NewRunnableFunction(&CallGetPluginListClient, - client, - plugins)); -} - -void PluginService::GetPluginList(bool refresh, - GetPluginListClient* client) { - DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); - - // Forward the request on to the file thread. - ChromeThread::PostTask( - ChromeThread::FILE, FROM_HERE, - NewRunnableFunction(&GetPluginListOnFileThread, refresh, client)); -} - const std::wstring& PluginService::GetUILocale() { return ui_locale_; } |