OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/message_loop/incoming_task_queue.h" | 5 #include "base/message_loop/incoming_task_queue.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 message_loop_scheduled_(false), | 56 message_loop_scheduled_(false), |
57 always_schedule_work_(AlwaysNotifyPump(message_loop_->type())), | 57 always_schedule_work_(AlwaysNotifyPump(message_loop_->type())), |
58 is_ready_for_scheduling_(false) { | 58 is_ready_for_scheduling_(false) { |
59 } | 59 } |
60 | 60 |
61 bool IncomingTaskQueue::AddToIncomingQueue( | 61 bool IncomingTaskQueue::AddToIncomingQueue( |
62 const tracked_objects::Location& from_here, | 62 const tracked_objects::Location& from_here, |
63 Closure task, | 63 Closure task, |
64 TimeDelta delay, | 64 TimeDelta delay, |
65 bool nestable) { | 65 bool nestable) { |
| 66 DCHECK(task); |
66 DLOG_IF(WARNING, | 67 DLOG_IF(WARNING, |
67 delay.InSeconds() > kTaskDelayWarningThresholdInSeconds) | 68 delay.InSeconds() > kTaskDelayWarningThresholdInSeconds) |
68 << "Requesting super-long task delay period of " << delay.InSeconds() | 69 << "Requesting super-long task delay period of " << delay.InSeconds() |
69 << " seconds from here: " << from_here.ToString(); | 70 << " seconds from here: " << from_here.ToString(); |
70 | 71 |
71 PendingTask pending_task(from_here, std::move(task), | 72 PendingTask pending_task(from_here, std::move(task), |
72 CalculateDelayedRuntime(delay), nestable); | 73 CalculateDelayedRuntime(delay), nestable); |
73 #if defined(OS_WIN) | 74 #if defined(OS_WIN) |
74 // We consider the task needs a high resolution timer if the delay is | 75 // We consider the task needs a high resolution timer if the delay is |
75 // more than 0 and less than 32ms. This caps the relative error to | 76 // more than 0 and less than 32ms. This caps the relative error to |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 // that wants to post a task will be blocked until this thread switches back | 192 // that wants to post a task will be blocked until this thread switches back |
192 // in and releases |incoming_queue_lock_|. | 193 // in and releases |incoming_queue_lock_|. |
193 if (schedule_work) | 194 if (schedule_work) |
194 message_loop_->ScheduleWork(); | 195 message_loop_->ScheduleWork(); |
195 | 196 |
196 return true; | 197 return true; |
197 } | 198 } |
198 | 199 |
199 } // namespace internal | 200 } // namespace internal |
200 } // namespace base | 201 } // namespace base |
OLD | NEW |