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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(const PendingTask& pending_task); |
318 | 318 |
319 #if defined(OS_WIN) | |
320 // TODO (stanisc): crbug.com/596190: Remove this after the signaling issue | |
321 // has been investigated. | |
322 // This should be used for diagnostic only. If message pump wake-up mechanism | |
323 // is based on auto-reset event this call would reset the event to unset | |
324 // state. | |
325 bool MessagePumpWasSignaled(); | |
326 #endif | |
327 | |
328 //---------------------------------------------------------------------------- | 319 //---------------------------------------------------------------------------- |
329 protected: | 320 protected: |
330 std::unique_ptr<MessagePump> pump_; | 321 std::unique_ptr<MessagePump> pump_; |
331 | 322 |
332 using MessagePumpFactoryCallback = Callback<std::unique_ptr<MessagePump>()>; | 323 using MessagePumpFactoryCallback = Callback<std::unique_ptr<MessagePump>()>; |
333 | 324 |
334 // Common protected constructor. Other constructors delegate the | 325 // Common protected constructor. Other constructors delegate the |
335 // initialization to this constructor. | 326 // initialization to this constructor. |
336 // A subclass can invoke this constructor to create a message_loop of a | 327 // A subclass can invoke this constructor to create a message_loop of a |
337 // specific type with a custom loop. The implementation does not call | 328 // specific type with a custom loop. The implementation does not call |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 | 591 |
601 // Do not add any member variables to MessageLoopForIO! This is important b/c | 592 // Do not add any member variables to MessageLoopForIO! This is important b/c |
602 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra | 593 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra |
603 // data that you need should be stored on the MessageLoop's pump_ instance. | 594 // data that you need should be stored on the MessageLoop's pump_ instance. |
604 static_assert(sizeof(MessageLoop) == sizeof(MessageLoopForIO), | 595 static_assert(sizeof(MessageLoop) == sizeof(MessageLoopForIO), |
605 "MessageLoopForIO should not have extra member variables"); | 596 "MessageLoopForIO should not have extra member variables"); |
606 | 597 |
607 } // namespace base | 598 } // namespace base |
608 | 599 |
609 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ | 600 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ |
OLD | NEW |