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