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" |
11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
12 #include "base/synchronization/waitable_event.h" | 12 #include "base/synchronization/waitable_event.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
15 | 15 |
16 namespace base { | 16 namespace base { |
17 namespace internal { | 17 namespace internal { |
18 | 18 |
19 namespace { | 19 namespace { |
20 | 20 |
21 #if DCHECK_IS_ON() | 21 #if DCHECK_IS_ON() || DVLOG_IS_ON() |
22 // Delays larger than this are often bogus, and a warning should be emitted in | 22 // Delays larger than this are often bogus, and a warning should be emitted in |
23 // debug builds to warn developers. http://crbug.com/450045 | 23 // debug builds to warn developers. http://crbug.com/450045 |
24 const int kTaskDelayWarningThresholdInSeconds = | 24 const int kTaskDelayWarningThresholdInSeconds = |
25 14 * 24 * 60 * 60; // 14 days. | 25 14 * 24 * 60 * 60; // 14 days. |
26 #endif | 26 #endif // DCHECK_IS_ON() || DVLOG_IS_ON() |
27 | 27 |
28 // Returns true if MessagePump::ScheduleWork() must be called one | 28 // Returns true if MessagePump::ScheduleWork() must be called one |
29 // time for every task that is added to the MessageLoop incoming queue. | 29 // time for every task that is added to the MessageLoop incoming queue. |
30 bool AlwaysNotifyPump(MessageLoop::Type type) { | 30 bool AlwaysNotifyPump(MessageLoop::Type type) { |
31 #if defined(OS_ANDROID) | 31 #if defined(OS_ANDROID) |
32 // The Android UI message loop needs to get notified each time a task is | 32 // The Android UI message loop needs to get notified each time a task is |
33 // added | 33 // added |
34 // to the incoming queue. | 34 // to the incoming queue. |
35 return type == MessageLoop::TYPE_UI || type == MessageLoop::TYPE_JAVA; | 35 return type == MessageLoop::TYPE_UI || type == MessageLoop::TYPE_JAVA; |
36 #else | 36 #else |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 // 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 |
195 // in and releases |incoming_queue_lock_|. | 195 // in and releases |incoming_queue_lock_|. |
196 if (schedule_work) | 196 if (schedule_work) |
197 message_loop_->ScheduleWork(); | 197 message_loop_->ScheduleWork(); |
198 | 198 |
199 return true; | 199 return true; |
200 } | 200 } |
201 | 201 |
202 } // namespace internal | 202 } // namespace internal |
203 } // namespace base | 203 } // namespace base |
OLD | NEW |