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

Side by Side Diff: components/metrics/daily_event.cc

Issue 1159883003: Substituting pattern ScopedVector push_back(ptr.release()) with push_back(ptr.Pass()) in components… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 | « no previous file | components/metrics/metrics_service.cc » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/metrics/daily_event.h" 5 #include "components/metrics/daily_event.h"
6 6
7 #include "base/i18n/time_formatting.h" 7 #include "base/i18n/time_formatting.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/prefs/pref_registry_simple.h" 9 #include "base/prefs/pref_registry_simple.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 // static 52 // static
53 void DailyEvent::RegisterPref(PrefRegistrySimple* registry, 53 void DailyEvent::RegisterPref(PrefRegistrySimple* registry,
54 const char* pref_name) { 54 const char* pref_name) {
55 registry->RegisterInt64Pref(pref_name, base::Time().ToInternalValue()); 55 registry->RegisterInt64Pref(pref_name, base::Time().ToInternalValue());
56 } 56 }
57 57
58 void DailyEvent::AddObserver(scoped_ptr<DailyEvent::Observer> observer) { 58 void DailyEvent::AddObserver(scoped_ptr<DailyEvent::Observer> observer) {
59 DVLOG(2) << "DailyEvent observer added."; 59 DVLOG(2) << "DailyEvent observer added.";
60 DCHECK(last_fired_.is_null()); 60 DCHECK(last_fired_.is_null());
61 observers_.push_back(observer.release()); 61 observers_.push_back(observer.Pass());
62 } 62 }
63 63
64 void DailyEvent::CheckInterval() { 64 void DailyEvent::CheckInterval() {
65 base::Time now = base::Time::Now(); 65 base::Time now = base::Time::Now();
66 if (last_fired_.is_null()) { 66 if (last_fired_.is_null()) {
67 // The first time we call CheckInterval, we read the time stored in prefs. 67 // The first time we call CheckInterval, we read the time stored in prefs.
68 last_fired_ = base::Time::FromInternalValue( 68 last_fired_ = base::Time::FromInternalValue(
69 pref_service_->GetInt64(pref_name_)); 69 pref_service_->GetInt64(pref_name_));
70 DVLOG(1) << "DailyEvent time loaded: " 70 DVLOG(1) << "DailyEvent time loaded: "
71 << base::TimeFormatShortDateAndTime(last_fired_); 71 << base::TimeFormatShortDateAndTime(last_fired_);
(...skipping 25 matching lines...) Expand all
97 97
98 // Notify all observers 98 // Notify all observers
99 for (ScopedVector<DailyEvent::Observer>::iterator it = observers_.begin(); 99 for (ScopedVector<DailyEvent::Observer>::iterator it = observers_.begin();
100 it != observers_.end(); 100 it != observers_.end();
101 ++it) { 101 ++it) {
102 (*it)->OnDailyEvent(); 102 (*it)->OnDailyEvent();
103 } 103 }
104 } 104 }
105 105
106 } // namespace metrics 106 } // namespace metrics
OLDNEW
« no previous file with comments | « no previous file | components/metrics/metrics_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698