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 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
10 #include <mmsystem.h> | 10 #include <mmsystem.h> |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 DCHECK(!state_); | 106 DCHECK(!state_); |
107 | 107 |
108 // Most tasks that have not been Run() are deleted in the |timer_manager_| | 108 // Most tasks that have not been Run() are deleted in the |timer_manager_| |
109 // destructor after we remove our tls index. We delete the tasks in our | 109 // destructor after we remove our tls index. We delete the tasks in our |
110 // queues here so their destuction is similar to the tasks in the | 110 // queues here so their destuction is similar to the tasks in the |
111 // |timer_manager_|. | 111 // |timer_manager_|. |
112 DeletePendingTasks(); | 112 DeletePendingTasks(); |
113 ReloadWorkQueue(); | 113 ReloadWorkQueue(); |
114 DeletePendingTasks(); | 114 DeletePendingTasks(); |
115 | 115 |
| 116 // Delete tasks in the delayed work queue. |
| 117 while (!delayed_work_queue_.empty()) { |
| 118 Task* task = delayed_work_queue_.top().task; |
| 119 delayed_work_queue_.pop(); |
| 120 delete task; |
| 121 } |
| 122 |
116 #if defined(OS_WIN) | 123 #if defined(OS_WIN) |
117 // Match timeBeginPeriod() from construction. | 124 // Match timeBeginPeriod() from construction. |
118 timeEndPeriod(1); | 125 timeEndPeriod(1); |
119 #endif | 126 #endif |
120 } | 127 } |
121 | 128 |
122 void MessageLoop::AddDestructionObserver(DestructionObserver *obs) { | 129 void MessageLoop::AddDestructionObserver(DestructionObserver *obs) { |
123 DCHECK(this == current()); | 130 DCHECK(this == current()); |
124 destruction_observers_.AddObserver(obs); | 131 destruction_observers_.AddObserver(obs); |
125 } | 132 } |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 //------------------------------------------------------------------------------ | 550 //------------------------------------------------------------------------------ |
544 // MessageLoopForIO | 551 // MessageLoopForIO |
545 | 552 |
546 #if defined(OS_WIN) | 553 #if defined(OS_WIN) |
547 | 554 |
548 void MessageLoopForIO::WatchObject(HANDLE object, Watcher* watcher) { | 555 void MessageLoopForIO::WatchObject(HANDLE object, Watcher* watcher) { |
549 pump_win()->WatchObject(object, watcher); | 556 pump_win()->WatchObject(object, watcher); |
550 } | 557 } |
551 | 558 |
552 #endif // defined(OS_WIN) | 559 #endif // defined(OS_WIN) |
OLD | NEW |