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

Side by Side Diff: components/autofill/core/common/autofill_clock.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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "components/autofill/core/common/autofill_clock.h" 5 #include "components/autofill/core/common/autofill_clock.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/time/clock.h" 9 #include "base/time/clock.h"
10 #include "base/time/default_clock.h" 10 #include "base/time/default_clock.h"
11 11
12 namespace autofill { 12 namespace autofill {
13 13
14 namespace { 14 namespace {
15 15
16 static base::LazyInstance<AutofillClock> g_autofill_clock = 16 static base::LazyInstance<AutofillClock>::DestructorAtExit g_autofill_clock =
17 LAZY_INSTANCE_INITIALIZER; 17 LAZY_INSTANCE_INITIALIZER;
18 18
19 } // namespace 19 } // namespace
20 20
21 // static 21 // static
22 base::Time AutofillClock::Now() { 22 base::Time AutofillClock::Now() {
23 if (!g_autofill_clock.Get().clock_) 23 if (!g_autofill_clock.Get().clock_)
24 SetClock(); 24 SetClock();
25 25
26 return g_autofill_clock.Get().clock_->Now(); 26 return g_autofill_clock.Get().clock_->Now();
27 } 27 }
28 28
29 AutofillClock::AutofillClock(){}; 29 AutofillClock::AutofillClock(){};
30 AutofillClock::~AutofillClock(){}; 30 AutofillClock::~AutofillClock(){};
31 31
32 // static 32 // static
33 void AutofillClock::SetClock() { 33 void AutofillClock::SetClock() {
34 g_autofill_clock.Get().clock_.reset(new base::DefaultClock()); 34 g_autofill_clock.Get().clock_.reset(new base::DefaultClock());
35 } 35 }
36 36
37 // static 37 // static
38 void AutofillClock::SetTestClock(std::unique_ptr<base::Clock> clock) { 38 void AutofillClock::SetTestClock(std::unique_ptr<base::Clock> clock) {
39 DCHECK(clock); 39 DCHECK(clock);
40 g_autofill_clock.Get().clock_ = std::move(clock); 40 g_autofill_clock.Get().clock_ = std::move(clock);
41 } 41 }
42 42
43 } // namespace autofill 43 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/common/autofill_clock.h ('k') | components/content_settings/core/browser/content_settings_registry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698