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

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

Issue 1538743002: Switch to standard integer types in base/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DEPS roll too Created 4 years, 12 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 | « base/system_monitor/system_monitor_unittest.cc ('k') | base/task/cancelable_task_tracker.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 // 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 18 matching lines...) Expand all
29 // are outstanding tasks. This is commonly used to cancel all outstanding 29 // are outstanding tasks. This is commonly used to cancel all outstanding
30 // tasks. 30 // tasks.
31 // 31 //
32 // 2. Both task and reply are deleted on the originating thread. 32 // 2. Both task and reply are deleted on the originating thread.
33 // 33 //
34 // 3. IsCanceledCallback is thread safe and can be run or deleted on any 34 // 3. IsCanceledCallback is thread safe and can be run or deleted on any
35 // thread. 35 // thread.
36 #ifndef BASE_TASK_CANCELABLE_TASK_TRACKER_H_ 36 #ifndef BASE_TASK_CANCELABLE_TASK_TRACKER_H_
37 #define BASE_TASK_CANCELABLE_TASK_TRACKER_H_ 37 #define BASE_TASK_CANCELABLE_TASK_TRACKER_H_
38 38
39 #include <stdint.h>
40
39 #include "base/base_export.h" 41 #include "base/base_export.h"
40 #include "base/basictypes.h"
41 #include "base/callback.h" 42 #include "base/callback.h"
42 #include "base/containers/hash_tables.h" 43 #include "base/containers/hash_tables.h"
44 #include "base/macros.h"
43 #include "base/memory/weak_ptr.h" 45 #include "base/memory/weak_ptr.h"
44 #include "base/task_runner_util.h" 46 #include "base/task_runner_util.h"
45 #include "base/threading/thread_checker.h" 47 #include "base/threading/thread_checker.h"
46 48
47 namespace tracked_objects { 49 namespace tracked_objects {
48 class Location; 50 class Location;
49 } // namespace tracked_objects 51 } // namespace tracked_objects
50 52
51 namespace base { 53 namespace base {
52 54
53 class CancellationFlag; 55 class CancellationFlag;
54 class TaskRunner; 56 class TaskRunner;
55 57
56 class BASE_EXPORT CancelableTaskTracker { 58 class BASE_EXPORT CancelableTaskTracker {
57 public: 59 public:
58 // All values except kBadTaskId are valid. 60 // All values except kBadTaskId are valid.
59 typedef int64 TaskId; 61 typedef int64_t TaskId;
60 static const TaskId kBadTaskId; 62 static const TaskId kBadTaskId;
61 63
62 typedef base::Callback<bool()> IsCanceledCallback; 64 typedef base::Callback<bool()> IsCanceledCallback;
63 65
64 CancelableTaskTracker(); 66 CancelableTaskTracker();
65 67
66 // Cancels all tracked tasks. 68 // Cancels all tracked tasks.
67 ~CancelableTaskTracker(); 69 ~CancelableTaskTracker();
68 70
69 TaskId PostTask(base::TaskRunner* task_runner, 71 TaskId PostTask(base::TaskRunner* task_runner,
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 base::ThreadChecker thread_checker_; 133 base::ThreadChecker thread_checker_;
132 134
133 base::WeakPtrFactory<CancelableTaskTracker> weak_factory_; 135 base::WeakPtrFactory<CancelableTaskTracker> weak_factory_;
134 136
135 DISALLOW_COPY_AND_ASSIGN(CancelableTaskTracker); 137 DISALLOW_COPY_AND_ASSIGN(CancelableTaskTracker);
136 }; 138 };
137 139
138 } // namespace base 140 } // namespace base
139 141
140 #endif // BASE_TASK_CANCELABLE_TASK_TRACKER_H_ 142 #endif // BASE_TASK_CANCELABLE_TASK_TRACKER_H_
OLDNEW
« no previous file with comments | « base/system_monitor/system_monitor_unittest.cc ('k') | base/task/cancelable_task_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698