summaryrefslogtreecommitdiffstats
path: root/chrome/common/time_format.cc
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2011-05-11 20:53:37 +0100
committerKristian Monsen <kristianm@google.com>2011-05-16 13:54:48 +0100
commit21d179b334e59e9a3bfcaed4c4430bef1bc5759d (patch)
tree64e2bb6da27af6a5c93ca34f6051584aafbfcb9e /chrome/common/time_format.cc
parent0c63f00edd6ed0482fd5cbcea937ca088baf7858 (diff)
downloadexternal_chromium-21d179b334e59e9a3bfcaed4c4430bef1bc5759d.zip
external_chromium-21d179b334e59e9a3bfcaed4c4430bef1bc5759d.tar.gz
external_chromium-21d179b334e59e9a3bfcaed4c4430bef1bc5759d.tar.bz2
Merge Chromium at 10.0.621.0: Initial merge by git.
Change-Id: I070cc91c608dfa4a968a5a54c173260765ac8097
Diffstat (limited to 'chrome/common/time_format.cc')
-rw-r--r--chrome/common/time_format.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/chrome/common/time_format.cc b/chrome/common/time_format.cc
index c62f4f5..9de3a40 100644
--- a/chrome/common/time_format.cc
+++ b/chrome/common/time_format.cc
@@ -7,9 +7,9 @@
#include <vector>
#include "app/l10n_util.h"
+#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/scoped_ptr.h"
-#include "base/singleton.h"
#include "base/stl_util-inl.h"
#include "base/string16.h"
#include "base/time.h"
@@ -168,8 +168,7 @@ class TimeFormatter {
STLDeleteContainerPointers(time_elapsed_formatter_.begin(),
time_elapsed_formatter_.end());
}
- friend class Singleton<TimeFormatter>;
- friend struct DefaultSingletonTraits<TimeFormatter>;
+ friend struct base::DefaultLazyInstanceTraits<TimeFormatter>;
std::vector<icu::PluralFormat*> short_formatter_;
std::vector<icu::PluralFormat*> time_left_formatter_;
@@ -182,6 +181,9 @@ class TimeFormatter {
DISALLOW_COPY_AND_ASSIGN(TimeFormatter);
};
+static base::LazyInstance<TimeFormatter> g_time_formatter(
+ base::LINKER_INITIALIZED);
+
void TimeFormatter::BuildFormats(
FormatType format_type, std::vector<icu::PluralFormat*>* time_formats) {
static const icu::UnicodeString kKeywords[] = {
@@ -253,8 +255,6 @@ icu::PluralFormat* TimeFormatter::createFallbackFormat(
return format;
}
-Singleton<TimeFormatter> time_formatter;
-
static string16 FormatTimeImpl(const TimeDelta& delta, FormatType format_type) {
if (delta.ToInternalValue() < 0) {
NOTREACHED() << "Negative duration";
@@ -264,7 +264,7 @@ static string16 FormatTimeImpl(const TimeDelta& delta, FormatType format_type) {
int number;
const std::vector<icu::PluralFormat*>& formatters =
- time_formatter->formatter(format_type);
+ g_time_formatter.Get().formatter(format_type);
UErrorCode error = U_ZERO_ERROR;
icu::UnicodeString time_string;