diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-20 07:51:54 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-20 07:51:54 +0000 |
commit | f177ffd84b0f1b94de05fa0166520783cb5cddb9 (patch) | |
tree | 54f755e0de2d845cd2d8b481f08c528911ce62d2 /content/browser/plugin_service_impl.cc | |
parent | 57c1b56f4ae39e8cb1cd805fb46653423d4e5456 (diff) | |
download | chromium_src-f177ffd84b0f1b94de05fa0166520783cb5cddb9.zip chromium_src-f177ffd84b0f1b94de05fa0166520783cb5cddb9.tar.gz chromium_src-f177ffd84b0f1b94de05fa0166520783cb5cddb9.tar.bz2 |
Revert 118415 - Add a Content API around BrowserChildProcessHost, similar to what was done with ChildProcessHost. Now classes like PluginProcessHost don't derive from it, but instead use composition.
I've also moved the iterator class into its own file in the public directory. Since classes don't derive from BrowserChildProcessHost and so can't static_cast from it, I added a template helper that does this.
BUG=98716
Review URL: https://chromiumcodereview.appspot.com/9150017
TBR=jam@chromium.org
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118420 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/plugin_service_impl.cc')
-rw-r--r-- | content/browser/plugin_service_impl.cc | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/content/browser/plugin_service_impl.cc b/content/browser/plugin_service_impl.cc index cdb4db9..84734d5f 100644 --- a/content/browser/plugin_service_impl.cc +++ b/content/browser/plugin_service_impl.cc @@ -82,8 +82,12 @@ void WillLoadPluginsCallback() { static void NotifyPluginsOfActivation() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - for (PluginProcessHostIterator iter; !iter.Done(); ++iter) - iter->OnAppActivation(); + for (BrowserChildProcessHost::Iterator iter( + content::PROCESS_TYPE_PLUGIN); + !iter.Done(); ++iter) { + PluginProcessHost* plugin = static_cast<PluginProcessHost*>(*iter); + plugin->OnAppActivation(); + } } #endif #if defined(OS_POSIX) && !defined(OS_OPENBSD) @@ -227,9 +231,13 @@ void PluginServiceImpl::StartWatchingPlugins() { PluginProcessHost* PluginServiceImpl::FindNpapiPluginProcess( const FilePath& plugin_path) { - for (PluginProcessHostIterator iter; !iter.Done(); ++iter) { - if (iter->info().path == plugin_path) - return *iter; + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); + + for (BrowserChildProcessHost::Iterator iter(content::PROCESS_TYPE_PLUGIN); + !iter.Done(); ++iter) { + PluginProcessHost* plugin = static_cast<PluginProcessHost*>(*iter); + if (plugin->info().path == plugin_path) + return plugin; } return NULL; @@ -237,9 +245,15 @@ PluginProcessHost* PluginServiceImpl::FindNpapiPluginProcess( PpapiPluginProcessHost* PluginServiceImpl::FindPpapiPluginProcess( const FilePath& plugin_path) { - for (PpapiPluginProcessHostIterator iter; !iter.Done(); ++iter) { - if (iter->plugin_path() == plugin_path) - return *iter; + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); + + for (BrowserChildProcessHost::Iterator iter( + content::PROCESS_TYPE_PPAPI_PLUGIN); + !iter.Done(); ++iter) { + PpapiPluginProcessHost* plugin = + static_cast<PpapiPluginProcessHost*>(*iter); + if (plugin->plugin_path() == plugin_path) + return plugin; } return NULL; @@ -247,9 +261,15 @@ PpapiPluginProcessHost* PluginServiceImpl::FindPpapiPluginProcess( PpapiPluginProcessHost* PluginServiceImpl::FindPpapiBrokerProcess( const FilePath& broker_path) { - for (PpapiBrokerProcessHostIterator iter; !iter.Done(); ++iter) { - if (iter->plugin_path() == broker_path) - return *iter; + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); + + for (BrowserChildProcessHost::Iterator iter( + content::PROCESS_TYPE_PPAPI_BROKER); + !iter.Done(); ++iter) { + PpapiPluginProcessHost* broker = + static_cast<PpapiPluginProcessHost*>(*iter); + if (broker->plugin_path() == broker_path) + return broker; } return NULL; |