| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 #if defined(OS_WIN) | 370 #if defined(OS_WIN) |
| 371 void set_os_modal_loop(bool os_modal_loop) { | 371 void set_os_modal_loop(bool os_modal_loop) { |
| 372 os_modal_loop_ = os_modal_loop; | 372 os_modal_loop_ = os_modal_loop; |
| 373 } | 373 } |
| 374 | 374 |
| 375 bool os_modal_loop() const { | 375 bool os_modal_loop() const { |
| 376 return os_modal_loop_; | 376 return os_modal_loop_; |
| 377 } | 377 } |
| 378 #endif // OS_WIN | 378 #endif // OS_WIN |
| 379 | 379 |
| 380 // Can only be called from the thread that owns the MessageLoop. |
| 381 bool is_running() const; |
| 382 |
| 380 //---------------------------------------------------------------------------- | 383 //---------------------------------------------------------------------------- |
| 381 protected: | 384 protected: |
| 382 struct RunState { | 385 struct RunState { |
| 383 // Used to count how many Run() invocations are on the stack. | 386 // Used to count how many Run() invocations are on the stack. |
| 384 int run_depth; | 387 int run_depth; |
| 385 | 388 |
| 386 // Used to record that Quit() was called, or that we should quit the pump | 389 // Used to record that Quit() was called, or that we should quit the pump |
| 387 // once it becomes idle. | 390 // once it becomes idle. |
| 388 bool quit_received; | 391 bool quit_received; |
| 389 | 392 |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 #endif // defined(OS_POSIX) | 714 #endif // defined(OS_POSIX) |
| 712 }; | 715 }; |
| 713 | 716 |
| 714 // Do not add any member variables to MessageLoopForIO! This is important b/c | 717 // Do not add any member variables to MessageLoopForIO! This is important b/c |
| 715 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra | 718 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra |
| 716 // data that you need should be stored on the MessageLoop's pump_ instance. | 719 // data that you need should be stored on the MessageLoop's pump_ instance. |
| 717 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), | 720 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), |
| 718 MessageLoopForIO_should_not_have_extra_member_variables); | 721 MessageLoopForIO_should_not_have_extra_member_variables); |
| 719 | 722 |
| 720 #endif // BASE_MESSAGE_LOOP_H_ | 723 #endif // BASE_MESSAGE_LOOP_H_ |
| OLD | NEW |