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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 // Returns true if the message loop is "idle". Provided for testing. | 383 // Returns true if the message loop is "idle". Provided for testing. |
384 bool IsIdleForTesting(); | 384 bool IsIdleForTesting(); |
385 | 385 |
386 // Returns the TaskAnnotator which is used to add debug information to posted | 386 // Returns the TaskAnnotator which is used to add debug information to posted |
387 // tasks. | 387 // tasks. |
388 debug::TaskAnnotator* task_annotator() { return &task_annotator_; } | 388 debug::TaskAnnotator* task_annotator() { return &task_annotator_; } |
389 | 389 |
390 // Runs the specified PendingTask. | 390 // Runs the specified PendingTask. |
391 void RunTask(const PendingTask& pending_task); | 391 void RunTask(const PendingTask& pending_task); |
392 | 392 |
393 #if defined(OS_WIN) | |
394 // TODO (stanisc): crbug.com/596190: Remove this after the signaling issue | |
395 // has been investigated. | |
396 // This should be used for diagnostic only. If message pump wake-up mechanism | |
397 // is based on auto-reset event this call would reset the event to unset | |
398 // state. | |
399 bool MessagePumpWasSignaled(); | |
400 #endif | |
401 | |
402 //---------------------------------------------------------------------------- | 393 //---------------------------------------------------------------------------- |
403 protected: | 394 protected: |
404 std::unique_ptr<MessagePump> pump_; | 395 std::unique_ptr<MessagePump> pump_; |
405 | 396 |
406 using MessagePumpFactoryCallback = Callback<std::unique_ptr<MessagePump>()>; | 397 using MessagePumpFactoryCallback = Callback<std::unique_ptr<MessagePump>()>; |
407 | 398 |
408 // Common protected constructor. Other constructors delegate the | 399 // Common protected constructor. Other constructors delegate the |
409 // initialization to this constructor. | 400 // initialization to this constructor. |
410 // A subclass can invoke this constructor to create a message_loop of a | 401 // A subclass can invoke this constructor to create a message_loop of a |
411 // specific type with a custom loop. The implementation does not call | 402 // specific type with a custom loop. The implementation does not call |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 | 681 |
691 // Do not add any member variables to MessageLoopForIO! This is important b/c | 682 // Do not add any member variables to MessageLoopForIO! This is important b/c |
692 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra | 683 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra |
693 // data that you need should be stored on the MessageLoop's pump_ instance. | 684 // data that you need should be stored on the MessageLoop's pump_ instance. |
694 static_assert(sizeof(MessageLoop) == sizeof(MessageLoopForIO), | 685 static_assert(sizeof(MessageLoop) == sizeof(MessageLoopForIO), |
695 "MessageLoopForIO should not have extra member variables"); | 686 "MessageLoopForIO should not have extra member variables"); |
696 | 687 |
697 } // namespace base | 688 } // namespace base |
698 | 689 |
699 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ | 690 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ |
OLD | NEW |