| 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/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 #endif // OS_WIN | 145 #endif // OS_WIN |
| 146 message_histogram_(NULL), | 146 message_histogram_(NULL), |
| 147 run_loop_(NULL) { | 147 run_loop_(NULL) { |
| 148 DCHECK(pump_.get()); | 148 DCHECK(pump_.get()); |
| 149 Init(); | 149 Init(); |
| 150 } | 150 } |
| 151 | 151 |
| 152 MessageLoop::~MessageLoop() { | 152 MessageLoop::~MessageLoop() { |
| 153 DCHECK_EQ(this, current()); | 153 DCHECK_EQ(this, current()); |
| 154 | 154 |
| 155 // iOS just attaches to the loop, it doesn't Run it. |
| 156 // TODO(stuartmorgan): Consider wiring up a Detach(). |
| 157 #if !defined(OS_IOS) |
| 155 DCHECK(!run_loop_); | 158 DCHECK(!run_loop_); |
| 159 #endif |
| 160 |
| 156 #if defined(OS_WIN) | 161 #if defined(OS_WIN) |
| 157 if (in_high_res_mode_) | 162 if (in_high_res_mode_) |
| 158 Time::ActivateHighResolutionTimer(false); | 163 Time::ActivateHighResolutionTimer(false); |
| 159 #endif | 164 #endif |
| 160 // Clean up any unprocessed tasks, but take care: deleting a task could | 165 // Clean up any unprocessed tasks, but take care: deleting a task could |
| 161 // result in the addition of more tasks (e.g., via DeleteSoon). We set a | 166 // result in the addition of more tasks (e.g., via DeleteSoon). We set a |
| 162 // limit on the number of times we will allow a deleted task to generate more | 167 // limit on the number of times we will allow a deleted task to generate more |
| 163 // tasks. Normally, we should only pass through this loop once or twice. If | 168 // tasks. Normally, we should only pass through this loop once or twice. If |
| 164 // we end up hitting the loop limit, then it is probably due to one task that | 169 // we end up hitting the loop limit, then it is probably due to one task that |
| 165 // is being stubborn. Inspect the queues to see who is left. | 170 // is being stubborn. Inspect the queues to see who is left. |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 persistent, | 715 persistent, |
| 711 mode, | 716 mode, |
| 712 controller, | 717 controller, |
| 713 delegate); | 718 delegate); |
| 714 } | 719 } |
| 715 #endif | 720 #endif |
| 716 | 721 |
| 717 #endif // !defined(OS_NACL_SFI) | 722 #endif // !defined(OS_NACL_SFI) |
| 718 | 723 |
| 719 } // namespace base | 724 } // namespace base |
| OLD | NEW |