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

Side by Side Diff: base/i18n/number_formatting.cc

Issue 2733283002: Require explicit selection of traits for LazyInstance (Closed)
Patch Set: l10n again Created 3 years, 9 months 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
« no previous file with comments | « base/files/file_path_watcher_linux.cc ('k') | base/lazy_instance.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "base/i18n/number_formatting.h" 5 #include "base/i18n/number_formatting.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 24 matching lines...) Expand all
35 // This can cause problems if a different allocator is used by this file 35 // This can cause problems if a different allocator is used by this file
36 // than by ICU. 36 // than by ICU.
37 UErrorCode status = U_ZERO_ERROR; 37 UErrorCode status = U_ZERO_ERROR;
38 number_format.reset(icu::NumberFormat::createInstance(status)); 38 number_format.reset(icu::NumberFormat::createInstance(status));
39 DCHECK(U_SUCCESS(status)); 39 DCHECK(U_SUCCESS(status));
40 } 40 }
41 41
42 std::unique_ptr<icu::NumberFormat> number_format; 42 std::unique_ptr<icu::NumberFormat> number_format;
43 }; 43 };
44 44
45 LazyInstance<NumberFormatWrapper> g_number_format_int = 45 LazyInstance<NumberFormatWrapper>::DestructorAtExit g_number_format_int =
46 LAZY_INSTANCE_INITIALIZER; 46 LAZY_INSTANCE_INITIALIZER;
47 LazyInstance<NumberFormatWrapper> g_number_format_float = 47 LazyInstance<NumberFormatWrapper>::DestructorAtExit g_number_format_float =
48 LAZY_INSTANCE_INITIALIZER; 48 LAZY_INSTANCE_INITIALIZER;
49 49
50 } // namespace 50 } // namespace
51 51
52 string16 FormatNumber(int64_t number) { 52 string16 FormatNumber(int64_t number) {
53 icu::NumberFormat* number_format = 53 icu::NumberFormat* number_format =
54 g_number_format_int.Get().number_format.get(); 54 g_number_format_int.Get().number_format.get();
55 55
56 if (!number_format) { 56 if (!number_format) {
57 // As a fallback, just return the raw number in a string. 57 // As a fallback, just return the raw number in a string.
(...skipping 29 matching lines...) Expand all
87 namespace testing { 87 namespace testing {
88 88
89 void ResetFormatters() { 89 void ResetFormatters() {
90 g_number_format_int.Get().Reset(); 90 g_number_format_int.Get().Reset();
91 g_number_format_float.Get().Reset(); 91 g_number_format_float.Get().Reset();
92 } 92 }
93 93
94 } // namespace testing 94 } // namespace testing
95 95
96 } // namespace base 96 } // namespace base
OLDNEW
« no previous file with comments | « base/files/file_path_watcher_linux.cc ('k') | base/lazy_instance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698