OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/bind.h" | 9 #include "base/bind.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 DCHECK_EQ(this, current()); | 401 DCHECK_EQ(this, current()); |
402 task_observers_.RemoveObserver(task_observer); | 402 task_observers_.RemoveObserver(task_observer); |
403 } | 403 } |
404 | 404 |
405 void MessageLoop::AssertIdle() const { | 405 void MessageLoop::AssertIdle() const { |
406 // We only check |incoming_queue_|, since we don't want to lock |work_queue_|. | 406 // We only check |incoming_queue_|, since we don't want to lock |work_queue_|. |
407 base::AutoLock lock(incoming_queue_lock_); | 407 base::AutoLock lock(incoming_queue_lock_); |
408 DCHECK(incoming_queue_.empty()); | 408 DCHECK(incoming_queue_.empty()); |
409 } | 409 } |
410 | 410 |
| 411 bool MessageLoop::is_running() const { |
| 412 DCHECK_EQ(this, current()); |
| 413 return state_ != NULL; |
| 414 } |
| 415 |
411 //------------------------------------------------------------------------------ | 416 //------------------------------------------------------------------------------ |
412 | 417 |
413 // Runs the loop in two different SEH modes: | 418 // Runs the loop in two different SEH modes: |
414 // enable_SEH_restoration_ = false : any unhandled exception goes to the last | 419 // enable_SEH_restoration_ = false : any unhandled exception goes to the last |
415 // one that calls SetUnhandledExceptionFilter(). | 420 // one that calls SetUnhandledExceptionFilter(). |
416 // enable_SEH_restoration_ = true : any unhandled exception goes to the filter | 421 // enable_SEH_restoration_ = true : any unhandled exception goes to the filter |
417 // that was existed before the loop was run. | 422 // that was existed before the loop was run. |
418 void MessageLoop::RunHandler() { | 423 void MessageLoop::RunHandler() { |
419 #if defined(OS_WIN) | 424 #if defined(OS_WIN) |
420 if (exception_restoration_) { | 425 if (exception_restoration_) { |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
871 Watcher *delegate) { | 876 Watcher *delegate) { |
872 return pump_libevent()->WatchFileDescriptor( | 877 return pump_libevent()->WatchFileDescriptor( |
873 fd, | 878 fd, |
874 persistent, | 879 persistent, |
875 static_cast<base::MessagePumpLibevent::Mode>(mode), | 880 static_cast<base::MessagePumpLibevent::Mode>(mode), |
876 controller, | 881 controller, |
877 delegate); | 882 delegate); |
878 } | 883 } |
879 | 884 |
880 #endif | 885 #endif |
OLD | NEW |