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 | 8 |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 // Returns true if MessagePump::ScheduleWork() must be called one | 27 // Returns true if MessagePump::ScheduleWork() must be called one |
28 // time for every task that is added to the MessageLoop incoming queue. | 28 // time for every task that is added to the MessageLoop incoming queue. |
29 bool AlwaysNotifyPump(MessageLoop::Type type) { | 29 bool AlwaysNotifyPump(MessageLoop::Type type) { |
30 #if defined(OS_ANDROID) | 30 #if defined(OS_ANDROID) |
31 // The Android UI message loop needs to get notified each time a task is | 31 // The Android UI message loop needs to get notified each time a task is |
32 // added | 32 // added |
33 // to the incoming queue. | 33 // to the incoming queue. |
34 return type == MessageLoop::TYPE_UI || type == MessageLoop::TYPE_JAVA; | 34 return type == MessageLoop::TYPE_UI || type == MessageLoop::TYPE_JAVA; |
35 #else | 35 #else |
| 36 (void)type; // Avoid an unused warning. |
36 return false; | 37 return false; |
37 #endif | 38 #endif |
38 } | 39 } |
39 | 40 |
40 } // namespace | 41 } // namespace |
41 | 42 |
42 IncomingTaskQueue::IncomingTaskQueue(MessageLoop* message_loop) | 43 IncomingTaskQueue::IncomingTaskQueue(MessageLoop* message_loop) |
43 : high_res_task_count_(0), | 44 : high_res_task_count_(0), |
44 message_loop_(message_loop), | 45 message_loop_(message_loop), |
45 next_sequence_num_(0), | 46 next_sequence_num_(0), |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 // After we've scheduled the message loop, we do not need to do so again | 174 // After we've scheduled the message loop, we do not need to do so again |
174 // until we know it has processed all of the work in our queue and is | 175 // until we know it has processed all of the work in our queue and is |
175 // waiting for more work again. The message loop will always attempt to | 176 // waiting for more work again. The message loop will always attempt to |
176 // reload from the incoming queue before waiting again so we clear this flag | 177 // reload from the incoming queue before waiting again so we clear this flag |
177 // in ReloadWorkQueue(). | 178 // in ReloadWorkQueue(). |
178 message_loop_scheduled_ = true; | 179 message_loop_scheduled_ = true; |
179 } | 180 } |
180 | 181 |
181 } // namespace internal | 182 } // namespace internal |
182 } // namespace base | 183 } // namespace base |
OLD | NEW |