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> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/lock.h" | |
14 #include "base/message_pump.h" | 13 #include "base/message_pump.h" |
15 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
16 #include "base/ref_counted.h" | 15 #include "base/ref_counted.h" |
| 16 #include "base/synchronization/lock.h" |
17 #include "base/task.h" | 17 #include "base/task.h" |
18 | 18 |
19 #if defined(OS_WIN) | 19 #if defined(OS_WIN) |
20 // We need this to declare base::MessagePumpWin::Dispatcher, which we should | 20 // We need this to declare base::MessagePumpWin::Dispatcher, which we should |
21 // really just eliminate. | 21 // really just eliminate. |
22 #include "base/message_pump_win.h" | 22 #include "base/message_pump_win.h" |
23 #elif defined(OS_POSIX) | 23 #elif defined(OS_POSIX) |
24 #include "base/message_pump_libevent.h" | 24 #include "base/message_pump_libevent.h" |
25 #if !defined(OS_MACOSX) | 25 #if !defined(OS_MACOSX) |
26 #include "base/message_pump_glib.h" | 26 #include "base/message_pump_glib.h" |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 std::string thread_name_; | 459 std::string thread_name_; |
460 // A profiling histogram showing the counts of various messages and events. | 460 // A profiling histogram showing the counts of various messages and events. |
461 scoped_refptr<base::Histogram> message_histogram_; | 461 scoped_refptr<base::Histogram> message_histogram_; |
462 | 462 |
463 // A null terminated list which creates an incoming_queue of tasks that are | 463 // A null terminated list which creates an incoming_queue of tasks that are |
464 // aquired under a mutex for processing on this instance's thread. These tasks | 464 // aquired under a mutex for processing on this instance's thread. These tasks |
465 // have not yet been sorted out into items for our work_queue_ vs items that | 465 // have not yet been sorted out into items for our work_queue_ vs items that |
466 // will be handled by the TimerManager. | 466 // will be handled by the TimerManager. |
467 TaskQueue incoming_queue_; | 467 TaskQueue incoming_queue_; |
468 // Protect access to incoming_queue_. | 468 // Protect access to incoming_queue_. |
469 Lock incoming_queue_lock_; | 469 base::Lock incoming_queue_lock_; |
470 | 470 |
471 RunState* state_; | 471 RunState* state_; |
472 | 472 |
473 #if defined(OS_WIN) | 473 #if defined(OS_WIN) |
474 base::TimeTicks high_resolution_timer_expiration_; | 474 base::TimeTicks high_resolution_timer_expiration_; |
475 #endif | 475 #endif |
476 | 476 |
477 // The next sequence number to use for delayed tasks. | 477 // The next sequence number to use for delayed tasks. |
478 int next_sequence_num_; | 478 int next_sequence_num_; |
479 | 479 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 #endif // defined(OS_POSIX) | 597 #endif // defined(OS_POSIX) |
598 }; | 598 }; |
599 | 599 |
600 // Do not add any member variables to MessageLoopForIO! This is important b/c | 600 // Do not add any member variables to MessageLoopForIO! This is important b/c |
601 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra | 601 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra |
602 // data that you need should be stored on the MessageLoop's pump_ instance. | 602 // data that you need should be stored on the MessageLoop's pump_ instance. |
603 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), | 603 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), |
604 MessageLoopForIO_should_not_have_extra_member_variables); | 604 MessageLoopForIO_should_not_have_extra_member_variables); |
605 | 605 |
606 #endif // BASE_MESSAGE_LOOP_H_ | 606 #endif // BASE_MESSAGE_LOOP_H_ |
OLD | NEW |