OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... |
37 // | 37 // |
38 // On Windows, GetSystemTimeAsFileTime is the typical implementation. | 38 // On Windows, GetSystemTimeAsFileTime is the typical implementation. |
39 virtual int64_t CurrentTime() = 0; | 39 virtual int64_t CurrentTime() = 0; |
40 | 40 |
41 void StartTask(Task *task); | 41 void StartTask(Task *task); |
42 void RunTasks(); | 42 void RunTasks(); |
43 void PollTasks(); | 43 void PollTasks(); |
44 | 44 |
45 void UpdateTaskTimeout(Task* task, int64_t previous_task_timeout_time); | 45 void UpdateTaskTimeout(Task* task, int64_t previous_task_timeout_time); |
46 | 46 |
47 #ifdef _DEBUG | 47 #if !defined(NDEBUG) |
48 bool is_ok_to_delete(Task* task) { | 48 bool is_ok_to_delete(Task* task) { |
49 return task == deleting_task_; | 49 return task == deleting_task_; |
50 } | 50 } |
51 | 51 |
52 void IncrementAbortCount() { | 52 void IncrementAbortCount() { |
53 ++abort_count_; | 53 ++abort_count_; |
54 } | 54 } |
55 | 55 |
56 void DecrementAbortCount() { | 56 void DecrementAbortCount() { |
57 --abort_count_; | 57 --abort_count_; |
(...skipping 22 matching lines...) Expand all Loading... |
80 // by default, do nothing. | 80 // by default, do nothing. |
81 } | 81 } |
82 | 82 |
83 private: | 83 private: |
84 void InternalRunTasks(bool in_destructor); | 84 void InternalRunTasks(bool in_destructor); |
85 void CheckForTimeoutChange(int64_t previous_timeout_time); | 85 void CheckForTimeoutChange(int64_t previous_timeout_time); |
86 | 86 |
87 std::vector<Task *> tasks_; | 87 std::vector<Task *> tasks_; |
88 Task *next_timeout_task_; | 88 Task *next_timeout_task_; |
89 bool tasks_running_; | 89 bool tasks_running_; |
90 #ifdef _DEBUG | 90 #if !defined(NDEBUG) |
91 int abort_count_; | 91 int abort_count_; |
92 Task* deleting_task_; | 92 Task* deleting_task_; |
93 #endif | 93 #endif |
94 | 94 |
95 void RecalcNextTimeout(Task *exclude_task); | 95 void RecalcNextTimeout(Task *exclude_task); |
96 }; | 96 }; |
97 | 97 |
98 } // namespace rtc | 98 } // namespace rtc |
99 | 99 |
100 #endif // TASK_BASE_TASKRUNNER_H__ | 100 #endif // TASK_BASE_TASKRUNNER_H__ |
OLD | NEW |