diff options
author | satish@chromium.org <satish@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-09 08:15:04 +0000 |
---|---|---|
committer | satish@chromium.org <satish@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-09 08:15:04 +0000 |
commit | d3c6c0d77db083fbb68f81589acf4fc7c58a1fad (patch) | |
tree | c4f00bd9c7205cd3ec60533e86e2e2023acc6b83 /chrome/browser/browser_about_handler.cc | |
parent | ee16679f293ca27ce3d822a97efad7d3fa8a049e (diff) | |
download | chromium_src-d3c6c0d77db083fbb68f81589acf4fc7c58a1fad.zip chromium_src-d3c6c0d77db083fbb68f81589acf4fc7c58a1fad.tar.gz chromium_src-d3c6c0d77db083fbb68f81589acf4fc7c58a1fad.tar.bz2 |
Add a new GetInstance() method for singleton classes used in chrome/browser files.
This CL includes half of the files under chrome/browser using Singleton<T>.
The rest of the files will be sent in a second CL.
In one case I used a LazyInstance<T> instead of Singleton<T> as that was simpler and necessary since T was a typedef and can't add member functions to it.
BUG=65298
TEST=all existing tests should continue to pass.
Review URL: http://codereview.chromium.org/5519016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68723 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_about_handler.cc')
-rw-r--r-- | chrome/browser/browser_about_handler.cc | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc index de02f04..d37a100 100644 --- a/chrome/browser/browser_about_handler.cc +++ b/chrome/browser/browser_about_handler.cc @@ -17,6 +17,7 @@ #include "base/metrics/stats_table.h" #include "base/path_service.h" #include "base/platform_thread.h" +#include "base/singleton.h" #include "base/stringprintf.h" #include "base/string_number_conversions.h" #include "base/string_piece.h" @@ -88,9 +89,14 @@ using base::Time; using base::TimeDelta; #if defined(USE_TCMALLOC) +// static +AboutTcmallocOutputs* AboutTcmallocOutputs::GetInstance() { + return Singleton<AboutTcmallocOutputs>::get(); +} + // Glue between the callback task and the method in the singleton. void AboutTcmallocRendererCallback(base::ProcessId pid, std::string output) { - Singleton<AboutTcmallocOutputs>::get()->RendererCallback(pid, output); + AboutTcmallocOutputs::GetInstance()->RendererCallback(pid, output); } #endif @@ -364,7 +370,7 @@ class AboutDnsHandler : public base::RefCountedThreadSafe<AboutDnsHandler> { std::string AboutTcmalloc(const std::string& query) { std::string data; AboutTcmallocOutputsType* outputs = - Singleton<AboutTcmallocOutputs>::get()->outputs(); + AboutTcmallocOutputs::GetInstance()->outputs(); // Display any stats for which we sent off requests the last time. data.append("<html><head><title>About tcmalloc</title></head><body>\n"); @@ -392,7 +398,7 @@ std::string AboutTcmalloc(const std::string& query) { char buffer[1024 * 32]; MallocExtension::instance()->GetStats(buffer, sizeof(buffer)); std::string browser("Browser"); - Singleton<AboutTcmallocOutputs>::get()->SetOutput(browser, buffer); + AboutTcmallocOutputs::GetInstance()->SetOutput(browser, buffer); RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator()); while (!it.IsAtEnd()) { it.GetCurrentValue()->Send(new ViewMsg_GetRendererTcmalloc); @@ -590,7 +596,7 @@ std::string AboutSandbox() { data.append(l10n_util::GetStringUTF8(IDS_ABOUT_SANDBOX_TITLE)); data.append("</h1>"); - const int status = Singleton<ZygoteHost>()->sandbox_status(); + const int status = ZygoteHost::GetInstance()->sandbox_status(); data.append("<table>"); @@ -831,7 +837,7 @@ AboutSource::AboutSource() BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, NewRunnableMethod( - Singleton<ChromeURLDataManager>::get(), + ChromeURLDataManager::GetInstance(), &ChromeURLDataManager::AddDataSource, make_scoped_refptr(this))); } |