summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authortony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-30 18:15:22 +0000
committertony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-30 18:15:22 +0000
commit7dc56d8cbc0070bd537c8585a0f671d45ed1093c (patch)
tree106c18b72676251ae8089ca39fd5a4f40cd8010a /chrome
parentab3505360bf6612d18915a39a0fec74b00642e82 (diff)
downloadchromium_src-7dc56d8cbc0070bd537c8585a0f671d45ed1093c.zip
chromium_src-7dc56d8cbc0070bd537c8585a0f671d45ed1093c.tar.gz
chromium_src-7dc56d8cbc0070bd537c8585a0f671d45ed1093c.tar.bz2
Revert "Convert chrome_url_data_manager (previously a global) into a"
This reverts commit r30594. Review URL: http://codereview.chromium.org/342062 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30600 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/browser_about_handler.cc2
-rw-r--r--chrome/browser/dom_ui/chrome_url_data_manager.cc28
-rw-r--r--chrome/browser/dom_ui/chrome_url_data_manager.h3
-rw-r--r--chrome/browser/dom_ui/downloads_dom_handler.cc3
-rw-r--r--chrome/browser/dom_ui/downloads_ui.cc3
-rw-r--r--chrome/browser/dom_ui/filebrowse_ui.cc5
-rw-r--r--chrome/browser/dom_ui/history_ui.cc5
-rw-r--r--chrome/browser/dom_ui/most_visited_handler.cc5
-rw-r--r--chrome/browser/dom_ui/new_tab_ui.cc7
-rw-r--r--chrome/browser/dom_ui/print_ui.cc3
-rw-r--r--chrome/browser/extensions/extensions_ui.cc3
11 files changed, 31 insertions, 36 deletions
diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc
index 370cfa0..428a9d2 100644
--- a/chrome/browser/browser_about_handler.cc
+++ b/chrome/browser/browser_about_handler.cc
@@ -568,7 +568,7 @@ AboutSource::AboutSource()
// Add us to the global URL handler on the IO thread.
g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE,
- NewRunnableMethod(Singleton<ChromeURLDataManager>().get(),
+ NewRunnableMethod(&chrome_url_data_manager,
&ChromeURLDataManager::AddDataSource, this));
}
diff --git a/chrome/browser/dom_ui/chrome_url_data_manager.cc b/chrome/browser/dom_ui/chrome_url_data_manager.cc
index 3da06c1..2f2959a 100644
--- a/chrome/browser/dom_ui/chrome_url_data_manager.cc
+++ b/chrome/browser/dom_ui/chrome_url_data_manager.cc
@@ -8,7 +8,6 @@
#include "base/file_util.h"
#include "base/message_loop.h"
#include "base/path_service.h"
-#include "base/singleton.h"
#include "base/string_util.h"
#include "base/thread.h"
#include "base/values.h"
@@ -31,6 +30,9 @@
// TODO(glen): Choose a better location for this.
static const char kChromeURLScheme[] = "chrome";
+// The single global instance of ChromeURLDataManager.
+ChromeURLDataManager chrome_url_data_manager;
+
// URLRequestChromeJob is a URLRequestJob that manages running chrome-internal
// resource requests asynchronously.
// It hands off URL requests to ChromeURLDataManager, which asynchronously
@@ -103,10 +105,9 @@ void RegisterURLRequestChromeJob() {
// all features of in-process Web Inspector and Console Debugger. For the
// time being we need to serve the same content from chrome://inspector
// for the Console Debugger and in-process Web Inspector.
- Singleton<ChromeURLDataManager>()->AddFileSource("inspector",
- inspector_dir);
- Singleton<ChromeURLDataManager>()->AddFileSource(
- chrome::kChromeUIDevToolsHost, inspector_dir);
+ chrome_url_data_manager.AddFileSource("inspector", inspector_dir);
+ chrome_url_data_manager.AddFileSource(chrome::kChromeUIDevToolsHost,
+ inspector_dir);
}
URLRequest::RegisterProtocolFactory(kChromeURLScheme,
@@ -118,9 +119,8 @@ void RegisterURLRequestChromeJob() {
void UnregisterURLRequestChromeJob() {
FilePath inspector_dir;
if (PathService::Get(chrome::DIR_INSPECTOR, &inspector_dir)) {
- Singleton<ChromeURLDataManager>()->RemoveFileSource("inspector");
- Singleton<ChromeURLDataManager>()->RemoveFileSource(
- chrome::kChromeUIDevToolsHost);
+ chrome_url_data_manager.RemoveFileSource("inspector");
+ chrome_url_data_manager.RemoveFileSource(chrome::kChromeUIDevToolsHost);
}
}
@@ -164,8 +164,8 @@ bool ChromeURLDataManager::URLToFilePath(const GURL& url,
URLToRequest(url, &source_name, &relative_path);
FileSourceMap::const_iterator i(
- Singleton<ChromeURLDataManager>()->file_sources_.find(source_name));
- if (i == Singleton<ChromeURLDataManager>()->file_sources_.end())
+ chrome_url_data_manager.file_sources_.find(source_name));
+ if (i == chrome_url_data_manager.file_sources_.end())
return false;
*file_path = i->second.AppendASCII(relative_path);
@@ -275,7 +275,7 @@ void ChromeURLDataManager::DataSource::SendResponse(
RefCountedMemory* bytes) {
ChromeThread::PostTask(
ChromeThread::IO, FROM_HERE,
- NewRunnableMethod(Singleton<ChromeURLDataManager>().get(),
+ NewRunnableMethod(&chrome_url_data_manager,
&ChromeURLDataManager::DataAvailable,
request_id, scoped_refptr<RefCountedMemory>(bytes)));
}
@@ -350,7 +350,7 @@ URLRequestChromeJob::URLRequestChromeJob(URLRequest* request)
}
URLRequestChromeJob::~URLRequestChromeJob() {
- CHECK(!Singleton<ChromeURLDataManager>()->HasPendingJob(this));
+ CHECK(!chrome_url_data_manager.HasPendingJob(this));
}
void URLRequestChromeJob::Start() {
@@ -361,7 +361,7 @@ void URLRequestChromeJob::Start() {
}
void URLRequestChromeJob::Kill() {
- Singleton<ChromeURLDataManager>()->RemoveRequest(this);
+ chrome_url_data_manager.RemoveRequest(this);
}
bool URLRequestChromeJob::GetMimeType(std::string* mime_type) const {
@@ -421,7 +421,7 @@ void URLRequestChromeJob::StartAsync() {
if (!request_)
return;
- if (Singleton<ChromeURLDataManager>()->StartRequest(request_->url(), this)) {
+ if (chrome_url_data_manager.StartRequest(request_->url(), this)) {
NotifyHeadersComplete();
} else {
NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED,
diff --git a/chrome/browser/dom_ui/chrome_url_data_manager.h b/chrome/browser/dom_ui/chrome_url_data_manager.h
index c159190..bb1a82c 100644
--- a/chrome/browser/dom_ui/chrome_url_data_manager.h
+++ b/chrome/browser/dom_ui/chrome_url_data_manager.h
@@ -158,6 +158,9 @@ template <> struct RunnableMethodTraits<ChromeURLDataManager> {
void ReleaseCallee(ChromeURLDataManager* manager) {}
};
+// The single global instance of ChromeURLDataManager.
+extern ChromeURLDataManager chrome_url_data_manager;
+
// Register our special URL handler under our special URL scheme.
// Must be done once at startup.
void RegisterURLRequestChromeJob();
diff --git a/chrome/browser/dom_ui/downloads_dom_handler.cc b/chrome/browser/dom_ui/downloads_dom_handler.cc
index 6799475..7b77915 100644
--- a/chrome/browser/dom_ui/downloads_dom_handler.cc
+++ b/chrome/browser/dom_ui/downloads_dom_handler.cc
@@ -7,7 +7,6 @@
#include "app/l10n_util.h"
#include "base/basictypes.h"
#include "base/i18n/time_formatting.h"
-#include "base/singleton.h"
#include "base/string_piece.h"
#include "base/thread.h"
#include "base/values.h"
@@ -55,7 +54,7 @@ DownloadsDOMHandler::DownloadsDOMHandler(DownloadManager* dlm)
// Create our fileicon data source.
ChromeThread::PostTask(
ChromeThread::IO, FROM_HERE,
- NewRunnableMethod(Singleton<ChromeURLDataManager>().get(),
+ NewRunnableMethod(&chrome_url_data_manager,
&ChromeURLDataManager::AddDataSource,
new FileIconSource()));
}
diff --git a/chrome/browser/dom_ui/downloads_ui.cc b/chrome/browser/dom_ui/downloads_ui.cc
index 5df2ac6..ee17102 100644
--- a/chrome/browser/dom_ui/downloads_ui.cc
+++ b/chrome/browser/dom_ui/downloads_ui.cc
@@ -6,7 +6,6 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
-#include "base/singleton.h"
#include "base/string_piece.h"
#include "base/thread.h"
#include "base/values.h"
@@ -135,7 +134,7 @@ DownloadsUI::DownloadsUI(TabContents* contents) : DOMUI(contents) {
// Set up the chrome://downloads/ source.
ChromeThread::PostTask(
ChromeThread::IO, FROM_HERE,
- NewRunnableMethod(Singleton<ChromeURLDataManager>().get(),
+ NewRunnableMethod(&chrome_url_data_manager,
&ChromeURLDataManager::AddDataSource,
html_source));
}
diff --git a/chrome/browser/dom_ui/filebrowse_ui.cc b/chrome/browser/dom_ui/filebrowse_ui.cc
index a399aa5..bcd0aff 100644
--- a/chrome/browser/dom_ui/filebrowse_ui.cc
+++ b/chrome/browser/dom_ui/filebrowse_ui.cc
@@ -8,7 +8,6 @@
#include "app/resource_bundle.h"
#include "base/logging.h"
#include "base/message_loop.h"
-#include "base/singleton.h"
#include "base/string_piece.h"
#include "base/string_util.h"
#include "base/thread.h"
@@ -137,7 +136,7 @@ DOMMessageHandler* FileBrowseHandler::Attach(DOMUI* dom_ui) {
ChromeThread::PostTask(
ChromeThread::IO, FROM_HERE,
NewRunnableMethod(
- Singleton<ChromeURLDataManager>().get(),
+ &chrome_url_data_manager,
&ChromeURLDataManager::AddDataSource,
new DOMUIFavIconSource(dom_ui->GetProfile())));
@@ -254,7 +253,7 @@ FileBrowseUI::FileBrowseUI(TabContents* contents) : DOMUI(contents) {
ChromeThread::PostTask(
ChromeThread::IO, FROM_HERE,
NewRunnableMethod(
- Singleton<ChromeURLDataManager>().get(),
+ &chrome_url_data_manager,
&ChromeURLDataManager::AddDataSource,
html_source));
}
diff --git a/chrome/browser/dom_ui/history_ui.cc b/chrome/browser/dom_ui/history_ui.cc
index e852ee9..5e78bbe 100644
--- a/chrome/browser/dom_ui/history_ui.cc
+++ b/chrome/browser/dom_ui/history_ui.cc
@@ -8,7 +8,6 @@
#include "app/resource_bundle.h"
#include "base/i18n/time_formatting.h"
#include "base/message_loop.h"
-#include "base/singleton.h"
#include "base/string_piece.h"
#include "base/string_util.h"
#include "base/thread.h"
@@ -114,7 +113,7 @@ DOMMessageHandler* BrowsingHistoryHandler::Attach(DOMUI* dom_ui) {
ChromeThread::PostTask(
ChromeThread::IO, FROM_HERE,
NewRunnableMethod(
- Singleton<ChromeURLDataManager>().get(),
+ &chrome_url_data_manager,
&ChromeURLDataManager::AddDataSource,
new DOMUIFavIconSource(dom_ui->GetProfile())));
@@ -374,7 +373,7 @@ HistoryUI::HistoryUI(TabContents* contents) : DOMUI(contents) {
ChromeThread::PostTask(
ChromeThread::IO, FROM_HERE,
NewRunnableMethod(
- Singleton<ChromeURLDataManager>().get(),
+ &chrome_url_data_manager,
&ChromeURLDataManager::AddDataSource,
html_source));
}
diff --git a/chrome/browser/dom_ui/most_visited_handler.cc b/chrome/browser/dom_ui/most_visited_handler.cc
index a0e52bc..7aa82f8 100644
--- a/chrome/browser/dom_ui/most_visited_handler.cc
+++ b/chrome/browser/dom_ui/most_visited_handler.cc
@@ -6,7 +6,6 @@
#include "app/l10n_util.h"
#include "base/md5.h"
-#include "base/singleton.h"
#include "base/string_util.h"
#include "base/thread.h"
#include "base/values.h"
@@ -61,7 +60,7 @@ DOMMessageHandler* MostVisitedHandler::Attach(DOMUI* dom_ui) {
new DOMUIThumbnailSource(dom_ui->GetProfile());
bool posted = ChromeThread::PostTask(
ChromeThread::IO, FROM_HERE,
- NewRunnableMethod(Singleton<ChromeURLDataManager>().get(),
+ NewRunnableMethod(&chrome_url_data_manager,
&ChromeURLDataManager::AddDataSource, thumbnail_src));
if (!posted) {
thumbnail_src->AddRef();
@@ -71,7 +70,7 @@ DOMMessageHandler* MostVisitedHandler::Attach(DOMUI* dom_ui) {
DOMUIFavIconSource* favicon_src = new DOMUIFavIconSource(dom_ui->GetProfile());
posted = ChromeThread::PostTask(
ChromeThread::IO, FROM_HERE,
- NewRunnableMethod(Singleton<ChromeURLDataManager>().get(),
+ NewRunnableMethod(&chrome_url_data_manager,
&ChromeURLDataManager::AddDataSource, favicon_src));
if (!posted) {
favicon_src->AddRef();
diff --git a/chrome/browser/dom_ui/new_tab_ui.cc b/chrome/browser/dom_ui/new_tab_ui.cc
index d6aad59..02594fe 100644
--- a/chrome/browser/dom_ui/new_tab_ui.cc
+++ b/chrome/browser/dom_ui/new_tab_ui.cc
@@ -15,7 +15,6 @@
#include "base/command_line.h"
#include "base/file_util.h"
#include "base/histogram.h"
-#include "base/singleton.h"
#include "base/string_piece.h"
#include "base/thread.h"
#include "chrome/browser/browser.h"
@@ -553,7 +552,7 @@ NewTabUI::NewTabUI(TabContents* contents)
ChromeThread::PostTask(
ChromeThread::IO, FROM_HERE,
NewRunnableMethod(
- Singleton<ChromeURLDataManager>().get(),
+ &chrome_url_data_manager,
&ChromeURLDataManager::AddDataSource,
html_source));
} else {
@@ -576,7 +575,7 @@ NewTabUI::NewTabUI(TabContents* contents)
bool posted = ChromeThread::PostTask(
ChromeThread::IO, FROM_HERE,
NewRunnableMethod(
- Singleton<ChromeURLDataManager>().get(),
+ &chrome_url_data_manager,
&ChromeURLDataManager::AddDataSource,
html_source));
if (!posted) {
@@ -623,7 +622,7 @@ void NewTabUI::InitializeCSSCaches() {
bool posted = ChromeThread::PostTask(
ChromeThread::IO, FROM_HERE,
NewRunnableMethod(
- Singleton<ChromeURLDataManager>().get(),
+ &chrome_url_data_manager,
&ChromeURLDataManager::AddDataSource,
theme));
if (!posted) {
diff --git a/chrome/browser/dom_ui/print_ui.cc b/chrome/browser/dom_ui/print_ui.cc
index 4abc592..3821b98 100644
--- a/chrome/browser/dom_ui/print_ui.cc
+++ b/chrome/browser/dom_ui/print_ui.cc
@@ -7,7 +7,6 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
#include "base/message_loop.h"
-#include "base/singleton.h"
#include "base/thread.h"
#include "base/values.h"
#include "chrome/browser/chrome_thread.h"
@@ -30,7 +29,7 @@ PrintUI::PrintUI(TabContents* contents) : DOMUI(contents) {
ChromeThread::PostTask(
ChromeThread::IO, FROM_HERE,
NewRunnableMethod(
- Singleton<ChromeURLDataManager>().get(),
+ &chrome_url_data_manager,
&ChromeURLDataManager::AddDataSource,
html_source));
}
diff --git a/chrome/browser/extensions/extensions_ui.cc b/chrome/browser/extensions/extensions_ui.cc
index 06b9046..7ca742e 100644
--- a/chrome/browser/extensions/extensions_ui.cc
+++ b/chrome/browser/extensions/extensions_ui.cc
@@ -558,8 +558,7 @@ ExtensionsUI::ExtensionsUI(TabContents* contents) : DOMUI(contents) {
ChromeThread::PostTask(
ChromeThread::IO, FROM_HERE,
NewRunnableMethod(
- Singleton<ChromeURLDataManager>().get(),
- &ChromeURLDataManager::AddDataSource,
+ &chrome_url_data_manager, &ChromeURLDataManager::AddDataSource,
html_source));
}