| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/memory_debug.h" | |
| 13 #include "base/message_pump_default.h" | 12 #include "base/message_pump_default.h" |
| 14 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 15 #include "base/thread_local.h" | 14 #include "base/thread_local.h" |
| 16 | 15 |
| 17 #if defined(OS_MACOSX) | 16 #if defined(OS_MACOSX) |
| 18 #include "base/message_pump_mac.h" | 17 #include "base/message_pump_mac.h" |
| 19 #endif | 18 #endif |
| 20 #if defined(OS_POSIX) | 19 #if defined(OS_POSIX) |
| 21 #include "base/message_pump_libevent.h" | 20 #include "base/message_pump_libevent.h" |
| 22 #endif | 21 #endif |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 pump_ = base::MessagePumpMac::Create(); | 100 pump_ = base::MessagePumpMac::Create(); |
| 102 #elif defined(OS_LINUX) | 101 #elif defined(OS_LINUX) |
| 103 pump_ = new base::MessagePumpForUI(); | 102 pump_ = new base::MessagePumpForUI(); |
| 104 #endif // OS_LINUX | 103 #endif // OS_LINUX |
| 105 } else if (type_ == TYPE_IO) { | 104 } else if (type_ == TYPE_IO) { |
| 106 pump_ = new base::MessagePumpLibevent(); | 105 pump_ = new base::MessagePumpLibevent(); |
| 107 } else { | 106 } else { |
| 108 pump_ = new base::MessagePumpDefault(); | 107 pump_ = new base::MessagePumpDefault(); |
| 109 } | 108 } |
| 110 #endif // OS_POSIX | 109 #endif // OS_POSIX |
| 111 | |
| 112 // We override the PURIFY build to disregard any UMRs in delayed_work_queue_. | |
| 113 // This avoids an error in pop(), which pushes the |comp| field onto the | |
| 114 // stack. The |comp| field is uninitialized, since it is std::less, which is | |
| 115 // an empty struct -- VS reserves 1 byte for this struct, which will never | |
| 116 // be initialized. See http://crbug.com/5555. | |
| 117 base::MemoryDebug::MarkAsInitialized(&delayed_work_queue_, | |
| 118 sizeof(delayed_work_queue_)); | |
| 119 } | 110 } |
| 120 | 111 |
| 121 MessageLoop::~MessageLoop() { | 112 MessageLoop::~MessageLoop() { |
| 122 DCHECK(this == current()); | 113 DCHECK(this == current()); |
| 123 | 114 |
| 124 // Let interested parties have one last shot at accessing this. | 115 // Let interested parties have one last shot at accessing this. |
| 125 FOR_EACH_OBSERVER(DestructionObserver, destruction_observers_, | 116 FOR_EACH_OBSERVER(DestructionObserver, destruction_observers_, |
| 126 WillDestroyCurrentMessageLoop()); | 117 WillDestroyCurrentMessageLoop()); |
| 127 | 118 |
| 128 DCHECK(!state_); | 119 DCHECK(!state_); |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 Watcher *delegate) { | 600 Watcher *delegate) { |
| 610 return pump_libevent()->WatchFileDescriptor( | 601 return pump_libevent()->WatchFileDescriptor( |
| 611 fd, | 602 fd, |
| 612 persistent, | 603 persistent, |
| 613 static_cast<base::MessagePumpLibevent::Mode>(mode), | 604 static_cast<base::MessagePumpLibevent::Mode>(mode), |
| 614 controller, | 605 controller, |
| 615 delegate); | 606 delegate); |
| 616 } | 607 } |
| 617 | 608 |
| 618 #endif | 609 #endif |
| OLD | NEW |