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

Unified Diff: chrome/browser/autofill/autofill_dialog_controller_mac.mm

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/autofill/autofill_dialog_controller_mac.mm
diff --git a/chrome/browser/autofill/autofill_dialog_controller_mac.mm b/chrome/browser/autofill/autofill_dialog_controller_mac.mm
index 990ba58c6f08ed9d95275013c49b7f90c7e361c9..ac17b073353d3131cc1c674b84b8c0febe39bd49 100644
--- a/chrome/browser/autofill/autofill_dialog_controller_mac.mm
+++ b/chrome/browser/autofill/autofill_dialog_controller_mac.mm
@@ -5,8 +5,8 @@
#import "chrome/browser/autofill/autofill_dialog_controller_mac.h"
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
+#include "base/lazy_instance.h"
#include "base/mac_util.h"
-#include "base/singleton.h"
#include "base/sys_string_conversions.h"
#import "chrome/browser/autofill/autofill_address_model_mac.h"
#import "chrome/browser/autofill/autofill_address_sheet_controller_mac.h"
@@ -32,6 +32,9 @@ namespace {
// dialog.
typedef std::map<Profile*, AutoFillDialogController*> ProfileControllerMap;
+static base::LazyInstance<ProfileControllerMap> g_profile_controller_map(
+ base::LINKER_INITIALIZED);
+
} // namespace
// Delegate protocol that needs to be in place for the AutoFillTableView's
@@ -268,7 +271,7 @@ class PreferenceObserver : public NotificationObserver {
[self autorelease];
// Remove ourself from the map.
- ProfileControllerMap* map = Singleton<ProfileControllerMap>::get();
+ ProfileControllerMap* map = g_profile_controller_map.Pointer();
ProfileControllerMap::iterator it = map->find(profile_);
if (it != map->end()) {
map->erase(it);
@@ -633,7 +636,7 @@ class PreferenceObserver : public NotificationObserver {
profile:(Profile*)profile {
profile = profile->GetOriginalProfile();
- ProfileControllerMap* map = Singleton<ProfileControllerMap>::get();
+ ProfileControllerMap* map = g_profile_controller_map.Pointer();
DCHECK(map != NULL);
ProfileControllerMap::iterator it = map->find(profile);
if (it == map->end()) {

Powered by Google App Engine
This is Rietveld 408576698