OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 27 matching lines...) Expand all Loading... |
38 #include "base/message_pump_gtk.h" | 38 #include "base/message_pump_gtk.h" |
39 #endif | 39 #endif |
40 | 40 |
41 #endif | 41 #endif |
42 #endif | 42 #endif |
43 | 43 |
44 namespace base { | 44 namespace base { |
45 class Histogram; | 45 class Histogram; |
46 } | 46 } |
47 | 47 |
48 namespace tracked_objects { | |
49 class Births; | |
50 } | |
51 | |
52 // 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 |
53 // at most one MessageLoop instance per thread. | 49 // at most one MessageLoop instance per thread. |
54 // | 50 // |
55 // 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 |
56 // 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 |
57 // 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 |
58 // 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 |
59 // may also be processed. | 55 // may also be processed. |
60 // | 56 // |
61 // NOTE: Unless otherwise specified, a MessageLoop's methods may only be called | 57 // NOTE: Unless otherwise specified, a MessageLoop's methods may only be called |
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 // TODO(rvargas): Make this platform independent. | 681 // TODO(rvargas): Make this platform independent. |
686 base::MessagePumpForIO* pump_io() { | 682 base::MessagePumpForIO* pump_io() { |
687 return static_cast<base::MessagePumpForIO*>(pump_.get()); | 683 return static_cast<base::MessagePumpForIO*>(pump_.get()); |
688 } | 684 } |
689 | 685 |
690 #elif defined(OS_POSIX) | 686 #elif defined(OS_POSIX) |
691 // Please see MessagePumpLibevent for definition. | 687 // Please see MessagePumpLibevent for definition. |
692 bool WatchFileDescriptor(int fd, | 688 bool WatchFileDescriptor(int fd, |
693 bool persistent, | 689 bool persistent, |
694 Mode mode, | 690 Mode mode, |
695 FileDescriptorWatcher *controller, | 691 FileDescriptorWatcher* controller, |
696 Watcher *delegate); | 692 Watcher* delegate); |
697 | 693 |
698 private: | 694 private: |
699 base::MessagePumpLibevent* pump_io() { | 695 base::MessagePumpLibevent* pump_io() { |
700 return static_cast<base::MessagePumpLibevent*>(pump_.get()); | 696 return static_cast<base::MessagePumpLibevent*>(pump_.get()); |
701 } | 697 } |
702 #endif // defined(OS_POSIX) | 698 #endif // defined(OS_POSIX) |
703 }; | 699 }; |
704 | 700 |
705 // Do not add any member variables to MessageLoopForIO! This is important b/c | 701 // Do not add any member variables to MessageLoopForIO! This is important b/c |
706 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra | 702 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra |
707 // data that you need should be stored on the MessageLoop's pump_ instance. | 703 // data that you need should be stored on the MessageLoop's pump_ instance. |
708 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), | 704 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), |
709 MessageLoopForIO_should_not_have_extra_member_variables); | 705 MessageLoopForIO_should_not_have_extra_member_variables); |
710 | 706 |
711 #endif // BASE_MESSAGE_LOOP_H_ | 707 #endif // BASE_MESSAGE_LOOP_H_ |
OLD | NEW |