| 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 #ifndef BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ | 5 #ifndef BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ |
| 6 #define BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ | 6 #define BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <queue> | 9 #include <queue> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 bool HasHighResolutionTasks(); | 307 bool HasHighResolutionTasks(); |
| 308 | 308 |
| 309 // Returns true if the message loop is "idle". Provided for testing. | 309 // Returns true if the message loop is "idle". Provided for testing. |
| 310 bool IsIdleForTesting(); | 310 bool IsIdleForTesting(); |
| 311 | 311 |
| 312 // Returns the TaskAnnotator which is used to add debug information to posted | 312 // Returns the TaskAnnotator which is used to add debug information to posted |
| 313 // tasks. | 313 // tasks. |
| 314 debug::TaskAnnotator* task_annotator() { return &task_annotator_; } | 314 debug::TaskAnnotator* task_annotator() { return &task_annotator_; } |
| 315 | 315 |
| 316 // Runs the specified PendingTask. | 316 // Runs the specified PendingTask. |
| 317 void RunTask(const PendingTask& pending_task); | 317 void RunTask(PendingTask* pending_task); |
| 318 | 318 |
| 319 // Disallow nesting. After this is called, running a nested RunLoop or calling | 319 // Disallow nesting. After this is called, running a nested RunLoop or calling |
| 320 // Add/RemoveNestingObserver() on this MessageLoop will crash. | 320 // Add/RemoveNestingObserver() on this MessageLoop will crash. |
| 321 void DisallowNesting() { allow_nesting_ = false; } | 321 void DisallowNesting() { allow_nesting_ = false; } |
| 322 | 322 |
| 323 //---------------------------------------------------------------------------- | 323 //---------------------------------------------------------------------------- |
| 324 protected: | 324 protected: |
| 325 std::unique_ptr<MessagePump> pump_; | 325 std::unique_ptr<MessagePump> pump_; |
| 326 | 326 |
| 327 using MessagePumpFactoryCallback = Callback<std::unique_ptr<MessagePump>()>; | 327 using MessagePumpFactoryCallback = Callback<std::unique_ptr<MessagePump>()>; |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 | 598 |
| 599 // Do not add any member variables to MessageLoopForIO! This is important b/c | 599 // Do not add any member variables to MessageLoopForIO! This is important b/c |
| 600 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra | 600 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra |
| 601 // data that you need should be stored on the MessageLoop's pump_ instance. | 601 // data that you need should be stored on the MessageLoop's pump_ instance. |
| 602 static_assert(sizeof(MessageLoop) == sizeof(MessageLoopForIO), | 602 static_assert(sizeof(MessageLoop) == sizeof(MessageLoopForIO), |
| 603 "MessageLoopForIO should not have extra member variables"); | 603 "MessageLoopForIO should not have extra member variables"); |
| 604 | 604 |
| 605 } // namespace base | 605 } // namespace base |
| 606 | 606 |
| 607 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ | 607 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ |
| OLD | NEW |