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

Unified Diff: base/task/cancelable_task_tracker.cc

Issue 2830093003: Replace uses of hash_map in //base (Closed)
Patch Set: iOS Created 3 years, 8 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 | « base/task/cancelable_task_tracker.h ('k') | base/trace_event/heap_profiler_allocation_context.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/task/cancelable_task_tracker.cc
diff --git a/base/task/cancelable_task_tracker.cc b/base/task/cancelable_task_tracker.cc
index 0d4e57cfa8b7f68b2e7ccc457850655763b2f0e8..bb3cc0197f30b9ba6b8cf68723a7188be1a25212 100644
--- a/base/task/cancelable_task_tracker.cc
+++ b/base/task/cancelable_task_tracker.cc
@@ -134,7 +134,7 @@ CancelableTaskTracker::TaskId CancelableTaskTracker::NewTrackedTaskId(
void CancelableTaskTracker::TryCancel(TaskId id) {
DCHECK(sequence_checker_.CalledOnValidSequence());
- hash_map<TaskId, CancellationFlag*>::const_iterator it = task_flags_.find(id);
+ const auto it = task_flags_.find(id);
if (it == task_flags_.end()) {
// Two possibilities:
//
@@ -149,13 +149,8 @@ void CancelableTaskTracker::TryCancel(TaskId id) {
void CancelableTaskTracker::TryCancelAll() {
DCHECK(sequence_checker_.CalledOnValidSequence());
-
- for (hash_map<TaskId, CancellationFlag*>::const_iterator it =
- task_flags_.begin();
- it != task_flags_.end();
- ++it) {
- it->second->Set();
- }
+ for (const auto& it : task_flags_)
+ it.second->Set();
}
bool CancelableTaskTracker::HasTrackedTasks() const {
@@ -165,7 +160,6 @@ bool CancelableTaskTracker::HasTrackedTasks() const {
void CancelableTaskTracker::Track(TaskId id, CancellationFlag* flag) {
DCHECK(sequence_checker_.CalledOnValidSequence());
-
bool success = task_flags_.insert(std::make_pair(id, flag)).second;
DCHECK(success);
}
« no previous file with comments | « base/task/cancelable_task_tracker.h ('k') | base/trace_event/heap_profiler_allocation_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698