Chromium Code Reviews| 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 #ifndef BASE_MESSAGE_LOOP_H_ | 5 #ifndef BASE_MESSAGE_LOOP_H_ |
| 6 #define BASE_MESSAGE_LOOP_H_ | 6 #define BASE_MESSAGE_LOOP_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 274 bool nestable; // True if OK to dispatch from a nested loop. | 274 bool nestable; // True if OK to dispatch from a nested loop. |
| 275 | 275 |
| 276 PendingTask(Task* task, bool nestable) | 276 PendingTask(Task* task, bool nestable) |
| 277 : task(task), sequence_num(0), nestable(nestable) { | 277 : task(task), sequence_num(0), nestable(nestable) { |
| 278 } | 278 } |
| 279 | 279 |
| 280 // Used to support sorting. | 280 // Used to support sorting. |
| 281 bool operator<(const PendingTask& other) const; | 281 bool operator<(const PendingTask& other) const; |
| 282 }; | 282 }; |
| 283 | 283 |
| 284 typedef std::queue<PendingTask> TaskQueue; | 284 class TaskQueue : public std::queue<PendingTask> { |
| 285 public: | |
| 286 void Swap(TaskQueue* queue) { | |
| 287 c.swap(queue->c); | |
|
eric.rannaud
2009/09/02 18:37:46
What is c?
| |
| 288 } | |
| 289 }; | |
| 290 | |
| 285 typedef std::priority_queue<PendingTask> DelayedTaskQueue; | 291 typedef std::priority_queue<PendingTask> DelayedTaskQueue; |
| 286 | 292 |
| 287 #if defined(OS_WIN) | 293 #if defined(OS_WIN) |
| 288 base::MessagePumpWin* pump_win() { | 294 base::MessagePumpWin* pump_win() { |
| 289 return static_cast<base::MessagePumpWin*>(pump_.get()); | 295 return static_cast<base::MessagePumpWin*>(pump_.get()); |
| 290 } | 296 } |
| 291 #elif defined(OS_POSIX) | 297 #elif defined(OS_POSIX) |
| 292 base::MessagePumpLibevent* pump_libevent() { | 298 base::MessagePumpLibevent* pump_libevent() { |
| 293 return static_cast<base::MessagePumpLibevent*>(pump_.get()); | 299 return static_cast<base::MessagePumpLibevent*>(pump_.get()); |
| 294 } | 300 } |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 504 #endif // defined(OS_POSIX) | 510 #endif // defined(OS_POSIX) |
| 505 }; | 511 }; |
| 506 | 512 |
| 507 // Do not add any member variables to MessageLoopForIO! This is important b/c | 513 // Do not add any member variables to MessageLoopForIO! This is important b/c |
| 508 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra | 514 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra |
| 509 // data that you need should be stored on the MessageLoop's pump_ instance. | 515 // data that you need should be stored on the MessageLoop's pump_ instance. |
| 510 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), | 516 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), |
| 511 MessageLoopForIO_should_not_have_extra_member_variables); | 517 MessageLoopForIO_should_not_have_extra_member_variables); |
| 512 | 518 |
| 513 #endif // BASE_MESSAGE_LOOP_H_ | 519 #endif // BASE_MESSAGE_LOOP_H_ |
| OLD | NEW |