| 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 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 void QuitNow(); | 251 void QuitNow(); |
| 252 | 252 |
| 253 // TODO(jbates) remove this. crbug.com/131220. See QuitWhenIdleClosure(). | 253 // TODO(jbates) remove this. crbug.com/131220. See QuitWhenIdleClosure(). |
| 254 static base::Closure QuitClosure() { return QuitWhenIdleClosure(); } | 254 static base::Closure QuitClosure() { return QuitWhenIdleClosure(); } |
| 255 | 255 |
| 256 // Deprecated: use RunLoop instead. | 256 // Deprecated: use RunLoop instead. |
| 257 // Construct a Closure that will call QuitWhenIdle(). Useful to schedule an | 257 // Construct a Closure that will call QuitWhenIdle(). Useful to schedule an |
| 258 // arbitrary MessageLoop to QuitWhenIdle. | 258 // arbitrary MessageLoop to QuitWhenIdle. |
| 259 static base::Closure QuitWhenIdleClosure(); | 259 static base::Closure QuitWhenIdleClosure(); |
| 260 | 260 |
| 261 // Returns true if this loop is |type|. This allows subclasses (especially |
| 262 // those in tests) to specialize how they are identified. |
| 263 virtual bool IsType(Type type) const; |
| 264 |
| 261 // Returns the type passed to the constructor. | 265 // Returns the type passed to the constructor. |
| 262 Type type() const { return type_; } | 266 Type type() const { return type_; } |
| 263 | 267 |
| 264 // Optional call to connect the thread name with this loop. | 268 // Optional call to connect the thread name with this loop. |
| 265 void set_thread_name(const std::string& thread_name) { | 269 void set_thread_name(const std::string& thread_name) { |
| 266 DCHECK(thread_name_.empty()) << "Should not rename this thread!"; | 270 DCHECK(thread_name_.empty()) << "Should not rename this thread!"; |
| 267 thread_name_ = thread_name; | 271 thread_name_ = thread_name; |
| 268 } | 272 } |
| 269 const std::string& thread_name() const { return thread_name_; } | 273 const std::string& thread_name() const { return thread_name_; } |
| 270 | 274 |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 #endif // defined(OS_POSIX) | 655 #endif // defined(OS_POSIX) |
| 652 }; | 656 }; |
| 653 | 657 |
| 654 // Do not add any member variables to MessageLoopForIO! This is important b/c | 658 // Do not add any member variables to MessageLoopForIO! This is important b/c |
| 655 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra | 659 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra |
| 656 // data that you need should be stored on the MessageLoop's pump_ instance. | 660 // data that you need should be stored on the MessageLoop's pump_ instance. |
| 657 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), | 661 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), |
| 658 MessageLoopForIO_should_not_have_extra_member_variables); | 662 MessageLoopForIO_should_not_have_extra_member_variables); |
| 659 | 663 |
| 660 #endif // BASE_MESSAGE_LOOP_H_ | 664 #endif // BASE_MESSAGE_LOOP_H_ |
| OLD | NEW |