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

Side by Side Diff: base/task/cancelable_task_tracker.h

Issue 565123002: Maintaing the proper order of initialization WeakPtrFactory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 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 // CancelableTaskTracker posts tasks (in the form of a Closure) to a 5 // CancelableTaskTracker posts tasks (in the form of a Closure) to a
6 // TaskRunner, and is able to cancel the task later if it's not needed 6 // TaskRunner, and is able to cancel the task later if it's not needed
7 // anymore. On destruction, CancelableTaskTracker will cancel all 7 // anymore. On destruction, CancelableTaskTracker will cancel all
8 // tracked tasks. 8 // tracked tasks.
9 // 9 //
10 // Each cancelable task can be associated with a reply (also a Closure). After 10 // Each cancelable task can be associated with a reply (also a Closure). After
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 119
120 // Returns true iff there are in-flight tasks that are still being 120 // Returns true iff there are in-flight tasks that are still being
121 // tracked. 121 // tracked.
122 bool HasTrackedTasks() const; 122 bool HasTrackedTasks() const;
123 123
124 private: 124 private:
125 void Track(TaskId id, base::CancellationFlag* flag); 125 void Track(TaskId id, base::CancellationFlag* flag);
126 void Untrack(TaskId id); 126 void Untrack(TaskId id);
127 127
128 base::hash_map<TaskId, base::CancellationFlag*> task_flags_; 128 base::hash_map<TaskId, base::CancellationFlag*> task_flags_;
129 base::WeakPtrFactory<CancelableTaskTracker> weak_factory_;
130 129
131 TaskId next_id_; 130 TaskId next_id_;
132 base::ThreadChecker thread_checker_; 131 base::ThreadChecker thread_checker_;
133 132
133 base::WeakPtrFactory<CancelableTaskTracker> weak_factory_;
134
134 DISALLOW_COPY_AND_ASSIGN(CancelableTaskTracker); 135 DISALLOW_COPY_AND_ASSIGN(CancelableTaskTracker);
135 }; 136 };
136 137
137 } // namespace base 138 } // namespace base
138 139
139 #endif // BASE_TASK_CANCELABLE_TASK_TRACKER_H_ 140 #endif // BASE_TASK_CANCELABLE_TASK_TRACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698