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

Unified Diff: ui/message_center/message_center_impl.cc

Issue 1096983002: Update usages of std::map to use ScopedPtrMap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@passwordmanager-scopedmemory
Patch Set: Rebase. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/message_center/message_center_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/message_center/message_center_impl.cc
diff --git a/ui/message_center/message_center_impl.cc b/ui/message_center/message_center_impl.cc
index 142d9887a5ab9299e53dc7e10fc1e7f1475a820b..b54f183449958b0ac199c4c19fdc42b0f1c23dde 100644
--- a/ui/message_center/message_center_impl.cc
+++ b/ui/message_center/message_center_impl.cc
@@ -342,7 +342,7 @@ void PopupTimer::Reset() {
// PopupTimersController
PopupTimersController::PopupTimersController(MessageCenter* message_center)
- : message_center_(message_center), popup_deleter_(&popup_timers_) {
+ : message_center_(message_center) {
message_center_->AddObserver(this);
}
@@ -352,17 +352,17 @@ PopupTimersController::~PopupTimersController() {
void PopupTimersController::StartTimer(const std::string& id,
const base::TimeDelta& timeout) {
- PopupTimerCollection::iterator iter = popup_timers_.find(id);
+ PopupTimerCollection::const_iterator iter = popup_timers_.find(id);
if (iter != popup_timers_.end()) {
DCHECK(iter->second);
iter->second->Start();
return;
}
- PopupTimer* timer = new PopupTimer(id, timeout, AsWeakPtr());
+ scoped_ptr<PopupTimer> timer(new PopupTimer(id, timeout, AsWeakPtr()));
timer->Start();
- popup_timers_[id] = timer;
+ popup_timers_.insert(id, timer.Pass());
}
void PopupTimersController::StartAll() {
@@ -377,7 +377,7 @@ void PopupTimersController::ResetTimer(const std::string& id,
}
void PopupTimersController::PauseTimer(const std::string& id) {
- PopupTimerCollection::iterator iter = popup_timers_.find(id);
+ PopupTimerCollection::const_iterator iter = popup_timers_.find(id);
if (iter == popup_timers_.end())
return;
iter->second->Pause();
@@ -389,16 +389,11 @@ void PopupTimersController::PauseAll() {
}
void PopupTimersController::CancelTimer(const std::string& id) {
- PopupTimerCollection::iterator iter = popup_timers_.find(id);
- if (iter == popup_timers_.end())
- return;
-
- delete iter->second;
- popup_timers_.erase(iter);
+ popup_timers_.erase(id);
}
void PopupTimersController::CancelAll() {
- STLDeleteValues(&popup_timers_);
+ popup_timers_.clear();
}
void PopupTimersController::TimerFinished(const std::string& id) {
« no previous file with comments | « ui/message_center/message_center_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698