From a436d92d5121ebfc9996682cfed4c3ad33313138 Mon Sep 17 00:00:00 2001 From: "jam@chromium.org" Date: Fri, 13 Feb 2009 23:16:42 +0000 Subject: Have ChildProcessInfo contain a list of all running child processes (i.e. instead of Service and other child process service maintain it). In a future change I'll start moving some of the code from PluginProcessHost to ChildProcessInfo. Review URL: http://codereview.chromium.org/24017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9804 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/plugin_service.h | 73 ++++------------------------------------- 1 file changed, 6 insertions(+), 67 deletions(-) (limited to 'chrome/browser/plugin_service.h') diff --git a/chrome/browser/plugin_service.h b/chrome/browser/plugin_service.h index c569bdb..66bd408 100644 --- a/chrome/browser/plugin_service.h +++ b/chrome/browser/plugin_service.h @@ -14,6 +14,7 @@ #include "base/hash_tables.h" #include "base/lock.h" #include "base/ref_counted.h" +#include "base/singleton.h" #include "chrome/browser/browser_process.h" #include "webkit/glue/webplugin.h" @@ -34,13 +35,6 @@ class PluginService { // Returns the PluginService singleton. static PluginService* GetInstance(); - // Creates the PluginService object, but doesn't actually build the plugin - // list yet. It's generated lazily. - // Note: don't call these directly - use GetInstance() above. They are public - // so Singleton can access them. - PluginService(); - ~PluginService(); - // Gets the list of available plugins. void GetPlugins(bool refresh, std::vector* plugins); @@ -78,13 +72,6 @@ class PluginService { const std::wstring& locale, IPC::Message* reply_msg); - // A PluginProcessHost object calls this before its process is shut down. - void OnPluginProcessIsShuttingDown(PluginProcessHost* host); - - // A PluginProcessHost object calls this after its process has exited. This - // call deletes the host instance. - void OnPluginProcessExited(PluginProcessHost* host); - bool HavePluginFor(const std::string& mime_type, bool allow_wildcard); FilePath GetPluginPath(const GURL& url, @@ -114,10 +101,12 @@ class PluginService { void Shutdown(); private: - friend class PluginProcessHostIterator; + friend DefaultSingletonTraits; - // Removes a host from the plugin_hosts collection - void RemoveHost(PluginProcessHost* host); + // Creates the PluginService object, but doesn't actually build the plugin + // list yet. It's generated lazily. + PluginService(); + ~PluginService(); // Shutdown handler which executes in the context of the IO thread. void OnShutdown(); @@ -165,54 +154,4 @@ class PluginService { DISALLOW_COPY_AND_ASSIGN(PluginService); }; -// The PluginProcessHostIterator allows to iterate through all the -// PluginProcessHosts. Note that this should be done from the IO thread and that -// the iterator should not be kept around as it may be invalidated on -// subsequent event processing in the event loop. -class PluginProcessHostIterator { - public: - PluginProcessHostIterator(); - PluginProcessHostIterator(const PluginProcessHostIterator& instance); - - PluginProcessHostIterator& operator=( - const PluginProcessHostIterator& instance) { - iterator_ = instance.iterator_; - return *this; - } - - const PluginProcessHost* operator->() const { - return iterator_->second; - } - - const PluginProcessHost* operator*() const { - return iterator_->second; - } - - const PluginProcessHost* operator++() { // ++preincrement - ++iterator_; - if (iterator_ == end_) - return NULL; - else - return iterator_->second; - } - - const PluginProcessHost* operator++(int) { // postincrement++ - const PluginProcessHost* r; - if (iterator_ == end_) - r = NULL; - else - r = iterator_->second; - iterator_++; - return r; - } - - bool Done() { - return (iterator_ == end_); - } - - private: - PluginService::PluginMap::const_iterator iterator_; - PluginService::PluginMap::const_iterator end_; -}; - #endif // CHROME_BROWSER_PLUGIN_SERVICE_H_ -- cgit v1.1