Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3788)

Unified Diff: chrome/browser/renderer_host/resource_message_filter_gtk.cc

Issue 5711001: Add a new GetInstance() method for remaining files with singleton classes under chrome/browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/renderer_host/resource_message_filter_gtk.cc
diff --git a/chrome/browser/renderer_host/resource_message_filter_gtk.cc b/chrome/browser/renderer_host/resource_message_filter_gtk.cc
index e2bf64124d93efb0575f6ce2aebfe31fa30b6d8f..f10931eef633ed3522ff5dc4d6dda6007809c2ab 100644
--- a/chrome/browser/renderer_host/resource_message_filter_gtk.cc
+++ b/chrome/browser/renderer_host/resource_message_filter_gtk.cc
@@ -10,8 +10,8 @@
#include "app/clipboard/clipboard.h"
#include "app/x11_util.h"
#include "base/file_util.h"
+#include "base/lazy_instance.h"
#include "base/path_service.h"
-#include "base/singleton.h"
#include "chrome/browser/browser_thread.h"
#if defined(TOOLKIT_GTK)
#include "chrome/browser/printing/print_dialog_gtk.h"
@@ -37,6 +37,9 @@ struct PrintingFileDescriptorMap {
FdMap map;
};
+static base::LazyInstance<PrintingFileDescriptorMap>
+ g_printing_file_descriptor_map(base::LINKER_INITIALIZED);
+
} // namespace
// We get null window_ids passed into the two functions below; please see
@@ -234,7 +237,7 @@ void ResourceMessageFilter::DoOnAllocateTempFileForPrinting(
file_util::CreateTemporaryFile(&path)) {
int fd = open(path.value().c_str(), O_WRONLY);
if (fd >= 0) {
- FdMap* map = &Singleton<PrintingFileDescriptorMap>::get()->map;
+ FdMap* map = &g_printing_file_descriptor_map.Get().map;
FdMap::iterator it = map->find(fd);
if (it != map->end()) {
NOTREACHED() << "The file descriptor is in use. fd=" << fd;
@@ -366,7 +369,7 @@ void ResourceMessageFilter::OnAllocateTempFileForPrinting(
// Called on the IO thread.
void ResourceMessageFilter::OnTempFileForPrintingWritten(int fd_in_browser) {
- FdMap* map = &Singleton<PrintingFileDescriptorMap>::get()->map;
+ FdMap* map = &g_printing_file_descriptor_map.Get().map;
FdMap::iterator it = map->find(fd_in_browser);
if (it == map->end()) {
NOTREACHED() << "Got a file descriptor that we didn't pass to the "

Powered by Google App Engine
This is Rietveld 408576698