OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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.h" | 5 #include "base/message_loop.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 DCHECK_EQ(this, current()); | 158 DCHECK_EQ(this, current()); |
159 | 159 |
160 DCHECK(!state_); | 160 DCHECK(!state_); |
161 | 161 |
162 // Clean up any unprocessed tasks, but take care: deleting a task could | 162 // Clean up any unprocessed tasks, but take care: deleting a task could |
163 // result in the addition of more tasks (e.g., via DeleteSoon). We set a | 163 // result in the addition of more tasks (e.g., via DeleteSoon). We set a |
164 // limit on the number of times we will allow a deleted task to generate more | 164 // limit on the number of times we will allow a deleted task to generate more |
165 // tasks. Normally, we should only pass through this loop once or twice. If | 165 // tasks. Normally, we should only pass through this loop once or twice. If |
166 // we end up hitting the loop limit, then it is probably due to one task that | 166 // we end up hitting the loop limit, then it is probably due to one task that |
167 // is being stubborn. Inspect the queues to see who is left. | 167 // is being stubborn. Inspect the queues to see who is left. |
168 bool did_work; | 168 bool did_work = false; // clang pr9061 |
169 for (int i = 0; i < 100; ++i) { | 169 for (int i = 0; i < 100; ++i) { |
170 DeletePendingTasks(); | 170 DeletePendingTasks(); |
171 ReloadWorkQueue(); | 171 ReloadWorkQueue(); |
172 // If we end up with empty queues, then break out of the loop. | 172 // If we end up with empty queues, then break out of the loop. |
173 did_work = DeletePendingTasks(); | 173 did_work = DeletePendingTasks(); |
174 if (!did_work) | 174 if (!did_work) |
175 break; | 175 break; |
176 } | 176 } |
177 DCHECK(!did_work); | 177 DCHECK(!did_work); |
178 | 178 |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 Watcher *delegate) { | 702 Watcher *delegate) { |
703 return pump_libevent()->WatchFileDescriptor( | 703 return pump_libevent()->WatchFileDescriptor( |
704 fd, | 704 fd, |
705 persistent, | 705 persistent, |
706 static_cast<base::MessagePumpLibevent::Mode>(mode), | 706 static_cast<base::MessagePumpLibevent::Mode>(mode), |
707 controller, | 707 controller, |
708 delegate); | 708 delegate); |
709 } | 709 } |
710 | 710 |
711 #endif | 711 #endif |
OLD | NEW |