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 OnceClosure task, | 63 OnceClosure task, |
64 TimeDelta delay, | 64 TimeDelta delay, |
65 bool nestable) { | 65 bool nestable) { |
66 DCHECK(task); | 66 // Use CHECK instead of DCHECK to crash earlier. See http://crbug.com/711167 |
| 67 // for details. |
| 68 CHECK(task); |
67 DLOG_IF(WARNING, | 69 DLOG_IF(WARNING, |
68 delay.InSeconds() > kTaskDelayWarningThresholdInSeconds) | 70 delay.InSeconds() > kTaskDelayWarningThresholdInSeconds) |
69 << "Requesting super-long task delay period of " << delay.InSeconds() | 71 << "Requesting super-long task delay period of " << delay.InSeconds() |
70 << " seconds from here: " << from_here.ToString(); | 72 << " seconds from here: " << from_here.ToString(); |
71 | 73 |
72 PendingTask pending_task(from_here, std::move(task), | 74 PendingTask pending_task(from_here, std::move(task), |
73 CalculateDelayedRuntime(delay), nestable); | 75 CalculateDelayedRuntime(delay), nestable); |
74 #if defined(OS_WIN) | 76 #if defined(OS_WIN) |
75 // We consider the task needs a high resolution timer if the delay is | 77 // We consider the task needs a high resolution timer if the delay is |
76 // more than 0 and less than 32ms. This caps the relative error to | 78 // 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... |
192 // that wants to post a task will be blocked until this thread switches back | 194 // that wants to post a task will be blocked until this thread switches back |
193 // in and releases |incoming_queue_lock_|. | 195 // in and releases |incoming_queue_lock_|. |
194 if (schedule_work) | 196 if (schedule_work) |
195 message_loop_->ScheduleWork(); | 197 message_loop_->ScheduleWork(); |
196 | 198 |
197 return true; | 199 return true; |
198 } | 200 } |
199 | 201 |
200 } // namespace internal | 202 } // namespace internal |
201 } // namespace base | 203 } // namespace base |
OLD | NEW |