| 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 <queue> | 8 #include <queue> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 // This type of ML only supports tasks and timers. | 102 // This type of ML only supports tasks and timers. |
| 103 // | 103 // |
| 104 // TYPE_UI | 104 // TYPE_UI |
| 105 // This type of ML also supports native UI events (e.g., Windows messages). | 105 // This type of ML also supports native UI events (e.g., Windows messages). |
| 106 // See also MessageLoopForUI. | 106 // See also MessageLoopForUI. |
| 107 // | 107 // |
| 108 // TYPE_IO | 108 // TYPE_IO |
| 109 // This type of ML also supports asynchronous IO. See also | 109 // This type of ML also supports asynchronous IO. See also |
| 110 // MessageLoopForIO. | 110 // MessageLoopForIO. |
| 111 // | 111 // |
| 112 // TYPE_JAVA |
| 113 // This type of ML is backed by a Java message handler which is responsible |
| 114 // for running the tasks added to the ML. This is only for use on Android. |
| 115 // TYPE_JAVA behaves in essence like TYPE_UI, except during construction |
| 116 // where it does not use the main thread specific pump factory. |
| 117 // |
| 112 enum Type { | 118 enum Type { |
| 113 TYPE_DEFAULT, | 119 TYPE_DEFAULT, |
| 114 TYPE_UI, | 120 TYPE_UI, |
| 115 TYPE_IO | 121 TYPE_IO, |
| 122 #if defined(OS_ANDROID) |
| 123 TYPE_JAVA, |
| 124 #endif // defined(OS_ANDROID) |
| 116 }; | 125 }; |
| 117 | 126 |
| 118 // Normally, it is not necessary to instantiate a MessageLoop. Instead, it | 127 // Normally, it is not necessary to instantiate a MessageLoop. Instead, it |
| 119 // is typical to make use of the current thread's MessageLoop instance. | 128 // is typical to make use of the current thread's MessageLoop instance. |
| 120 explicit MessageLoop(Type type = TYPE_DEFAULT); | 129 explicit MessageLoop(Type type = TYPE_DEFAULT); |
| 121 virtual ~MessageLoop(); | 130 virtual ~MessageLoop(); |
| 122 | 131 |
| 123 // Returns the MessageLoop object for the current thread, or null if none. | 132 // Returns the MessageLoop object for the current thread, or null if none. |
| 124 static MessageLoop* current(); | 133 static MessageLoop* current(); |
| 125 | 134 |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 | 710 |
| 702 // Do not add any member variables to MessageLoopForIO! This is important b/c | 711 // Do not add any member variables to MessageLoopForIO! This is important b/c |
| 703 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra | 712 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra |
| 704 // data that you need should be stored on the MessageLoop's pump_ instance. | 713 // data that you need should be stored on the MessageLoop's pump_ instance. |
| 705 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), | 714 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), |
| 706 MessageLoopForIO_should_not_have_extra_member_variables); | 715 MessageLoopForIO_should_not_have_extra_member_variables); |
| 707 | 716 |
| 708 } // namespace base | 717 } // namespace base |
| 709 | 718 |
| 710 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ | 719 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ |
| OLD | NEW |