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