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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); | 70 // MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); |
71 // hr = DoDragDrop(...); // Implicitly runs a modal message loop. | 71 // hr = DoDragDrop(...); // Implicitly runs a modal message loop. |
72 // } | 72 // } |
73 // // Process |hr| (the result returned by DoDragDrop()). | 73 // // Process |hr| (the result returned by DoDragDrop()). |
74 // | 74 // |
75 // Please be SURE your task is reentrant (nestable) and all global variables | 75 // Please be SURE your task is reentrant (nestable) and all global variables |
76 // are stable and accessible before calling SetNestableTasksAllowed(true). | 76 // are stable and accessible before calling SetNestableTasksAllowed(true). |
77 // | 77 // |
78 class BASE_EXPORT MessageLoop : public base::MessagePump::Delegate { | 78 class BASE_EXPORT MessageLoop : public base::MessagePump::Delegate { |
79 public: | 79 public: |
80 #if defined(OS_WIN) | 80 |
81 typedef base::MessagePumpWin::Dispatcher Dispatcher; | 81 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) |
82 typedef base::MessagePumpObserver Observer; | |
83 #elif !defined(OS_MACOSX) && !defined(OS_ANDROID) | |
84 typedef base::MessagePumpDispatcher Dispatcher; | 82 typedef base::MessagePumpDispatcher Dispatcher; |
85 typedef base::MessagePumpObserver Observer; | 83 typedef base::MessagePumpObserver Observer; |
86 #endif | 84 #endif |
87 | 85 |
88 // A MessageLoop has a particular type, which indicates the set of | 86 // A MessageLoop has a particular type, which indicates the set of |
89 // asynchronous events it may process in addition to tasks and timers. | 87 // asynchronous events it may process in addition to tasks and timers. |
90 // | 88 // |
91 // TYPE_DEFAULT | 89 // TYPE_DEFAULT |
92 // This type of ML only supports tasks and timers. | 90 // This type of ML only supports tasks and timers. |
93 // | 91 // |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 #endif // defined(OS_POSIX) | 657 #endif // defined(OS_POSIX) |
660 }; | 658 }; |
661 | 659 |
662 // Do not add any member variables to MessageLoopForIO! This is important b/c | 660 // Do not add any member variables to MessageLoopForIO! This is important b/c |
663 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra | 661 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra |
664 // data that you need should be stored on the MessageLoop's pump_ instance. | 662 // data that you need should be stored on the MessageLoop's pump_ instance. |
665 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), | 663 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), |
666 MessageLoopForIO_should_not_have_extra_member_variables); | 664 MessageLoopForIO_should_not_have_extra_member_variables); |
667 | 665 |
668 #endif // BASE_MESSAGE_LOOP_H_ | 666 #endif // BASE_MESSAGE_LOOP_H_ |
OLD | NEW |