OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <queue> | 9 #include <queue> |
10 #include <string> | 10 #include <string> |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "base/message_pump_x.h" | 35 #include "base/message_pump_x.h" |
36 #else | 36 #else |
37 #include "base/message_pump_gtk.h" | 37 #include "base/message_pump_gtk.h" |
38 #endif | 38 #endif |
39 | 39 |
40 #endif | 40 #endif |
41 #endif | 41 #endif |
42 | 42 |
43 namespace base { | 43 namespace base { |
44 class Histogram; | 44 class Histogram; |
45 } | 45 class ThreadTaskRunnerHandle; |
| 46 } // namespace base |
46 | 47 |
47 // A MessageLoop is used to process events for a particular thread. There is | 48 // A MessageLoop is used to process events for a particular thread. There is |
48 // at most one MessageLoop instance per thread. | 49 // at most one MessageLoop instance per thread. |
49 // | 50 // |
50 // Events include at a minimum Task instances submitted to PostTask or those | 51 // Events include at a minimum Task instances submitted to PostTask or those |
51 // managed by TimerManager. Depending on the type of message pump used by the | 52 // managed by TimerManager. Depending on the type of message pump used by the |
52 // MessageLoop other events such as UI messages may be processed. On Windows | 53 // MessageLoop other events such as UI messages may be processed. On Windows |
53 // APC calls (as time permits) and signals sent to a registered set of HANDLEs | 54 // APC calls (as time permits) and signals sent to a registered set of HANDLEs |
54 // may also be processed. | 55 // may also be processed. |
55 // | 56 // |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 bool os_modal_loop_; | 513 bool os_modal_loop_; |
513 #endif | 514 #endif |
514 | 515 |
515 // The next sequence number to use for delayed tasks. | 516 // The next sequence number to use for delayed tasks. |
516 int next_sequence_num_; | 517 int next_sequence_num_; |
517 | 518 |
518 ObserverList<TaskObserver> task_observers_; | 519 ObserverList<TaskObserver> task_observers_; |
519 | 520 |
520 // The message loop proxy associated with this message loop, if one exists. | 521 // The message loop proxy associated with this message loop, if one exists. |
521 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; | 522 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; |
| 523 scoped_ptr<base::ThreadTaskRunnerHandle> thread_task_runner_handle_; |
522 | 524 |
523 private: | 525 private: |
524 template <class T, class R> friend class base::subtle::DeleteHelperInternal; | 526 template <class T, class R> friend class base::subtle::DeleteHelperInternal; |
525 template <class T, class R> friend class base::subtle::ReleaseHelperInternal; | 527 template <class T, class R> friend class base::subtle::ReleaseHelperInternal; |
526 | 528 |
527 void DeleteSoonInternal(const tracked_objects::Location& from_here, | 529 void DeleteSoonInternal(const tracked_objects::Location& from_here, |
528 void(*deleter)(const void*), | 530 void(*deleter)(const void*), |
529 const void* object); | 531 const void* object); |
530 void ReleaseSoonInternal(const tracked_objects::Location& from_here, | 532 void ReleaseSoonInternal(const tracked_objects::Location& from_here, |
531 void(*releaser)(const void*), | 533 void(*releaser)(const void*), |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 #endif // defined(OS_POSIX) | 659 #endif // defined(OS_POSIX) |
658 }; | 660 }; |
659 | 661 |
660 // Do not add any member variables to MessageLoopForIO! This is important b/c | 662 // Do not add any member variables to MessageLoopForIO! This is important b/c |
661 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra | 663 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra |
662 // data that you need should be stored on the MessageLoop's pump_ instance. | 664 // data that you need should be stored on the MessageLoop's pump_ instance. |
663 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), | 665 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), |
664 MessageLoopForIO_should_not_have_extra_member_variables); | 666 MessageLoopForIO_should_not_have_extra_member_variables); |
665 | 667 |
666 #endif // BASE_MESSAGE_LOOP_H_ | 668 #endif // BASE_MESSAGE_LOOP_H_ |
OLD | NEW |