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

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

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 #include "base/task/cancelable_task_tracker.h" 5 #include "base/task/cancelable_task_tracker.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 } 53 }
54 54
55 } // namespace 55 } // namespace
56 56
57 namespace base { 57 namespace base {
58 58
59 // static 59 // static
60 const CancelableTaskTracker::TaskId CancelableTaskTracker::kBadTaskId = 0; 60 const CancelableTaskTracker::TaskId CancelableTaskTracker::kBadTaskId = 0;
61 61
62 CancelableTaskTracker::CancelableTaskTracker() 62 CancelableTaskTracker::CancelableTaskTracker()
63 : weak_factory_(this), next_id_(1) {} 63 : next_id_(1),weak_factory_(this) {}
64 64
65 CancelableTaskTracker::~CancelableTaskTracker() { 65 CancelableTaskTracker::~CancelableTaskTracker() {
66 DCHECK(thread_checker_.CalledOnValidThread()); 66 DCHECK(thread_checker_.CalledOnValidThread());
67 67
68 TryCancelAll(); 68 TryCancelAll();
69 } 69 }
70 70
71 CancelableTaskTracker::TaskId CancelableTaskTracker::PostTask( 71 CancelableTaskTracker::TaskId CancelableTaskTracker::PostTask(
72 TaskRunner* task_runner, 72 TaskRunner* task_runner,
73 const tracked_objects::Location& from_here, 73 const tracked_objects::Location& from_here,
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 DCHECK(success); 178 DCHECK(success);
179 } 179 }
180 180
181 void CancelableTaskTracker::Untrack(TaskId id) { 181 void CancelableTaskTracker::Untrack(TaskId id) {
182 DCHECK(thread_checker_.CalledOnValidThread()); 182 DCHECK(thread_checker_.CalledOnValidThread());
183 size_t num = task_flags_.erase(id); 183 size_t num = task_flags_.erase(id);
184 DCHECK_EQ(1u, num); 184 DCHECK_EQ(1u, num);
185 } 185 }
186 186
187 } // namespace base 187 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698