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

Side by Side Diff: ui/base/l10n/l10n_util_mac.mm

Issue 8491043: Allow linker initialization of lazy instance (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: thakis comment, renamed LAZY_INSTANCE_INITIALIZER Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import <Foundation/Foundation.h> 5 #import <Foundation/Foundation.h>
6 6
7 #include "base/sys_string_conversions.h" 7 #include "base/sys_string_conversions.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "ui/base/l10n/l10n_util.h" 10 #include "ui/base/l10n/l10n_util.h"
11 #include "ui/base/l10n/l10n_util_mac.h" 11 #include "ui/base/l10n/l10n_util_mac.h"
12 12
13 namespace { 13 namespace {
14 14
15 class OverrideLocaleHolder { 15 class OverrideLocaleHolder {
16 public: 16 public:
17 OverrideLocaleHolder() {} 17 OverrideLocaleHolder() {}
18 const std::string& value() const { return value_; } 18 const std::string& value() const { return value_; }
19 void set_value(const std::string override_value) { value_ = override_value; } 19 void set_value(const std::string override_value) { value_ = override_value; }
20 private: 20 private:
21 DISALLOW_COPY_AND_ASSIGN(OverrideLocaleHolder); 21 DISALLOW_COPY_AND_ASSIGN(OverrideLocaleHolder);
22 std::string value_; 22 std::string value_;
23 }; 23 };
24 24
25 base::LazyInstance<OverrideLocaleHolder> 25 base::LazyInstance<OverrideLocaleHolder>
26 override_locale_holder(base::LINKER_INITIALIZED); 26 override_locale_holder = LAZY_INSTANCE_INITIALIZER;
27 27
28 } // namespace 28 } // namespace
29 29
30 namespace l10n_util { 30 namespace l10n_util {
31 31
32 const std::string& GetLocaleOverride() { 32 const std::string& GetLocaleOverride() {
33 return override_locale_holder.Get().value(); 33 return override_locale_holder.Get().value();
34 } 34 }
35 35
36 void OverrideLocaleWithCocoaLocale() { 36 void OverrideLocaleWithCocoaLocale() {
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 const string16& a, 163 const string16& a,
164 const string16& b, 164 const string16& b,
165 const string16& c, 165 const string16& c,
166 const string16& d) { 166 const string16& d) {
167 return FixUpWindowsStyleLabel(l10n_util::GetStringFUTF16(message_id, 167 return FixUpWindowsStyleLabel(l10n_util::GetStringFUTF16(message_id,
168 a, b, c, d)); 168 a, b, c, d));
169 } 169 }
170 170
171 171
172 } // namespace l10n_util 172 } // namespace l10n_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698