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/message_pump.h" | 13 #include "base/message_pump.h" |
14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
15 #include "base/ref_counted.h" | 15 #include "base/ref_counted.h" |
16 #include "base/synchronization/lock.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" |
| 27 typedef struct _XDisplay Display; |
27 #endif | 28 #endif |
28 #endif | 29 #endif |
29 #if defined(TOUCH_UI) | 30 #if defined(TOUCH_UI) |
30 #include "base/message_pump_glib_x_dispatch.h" | 31 #include "base/message_pump_glib_x_dispatch.h" |
31 #endif | 32 #endif |
32 | 33 |
33 namespace base { | 34 namespace base { |
34 class Histogram; | 35 class Histogram; |
35 } | 36 } |
36 | 37 |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 static MessageLoopForUI* current() { | 502 static MessageLoopForUI* current() { |
502 MessageLoop* loop = MessageLoop::current(); | 503 MessageLoop* loop = MessageLoop::current(); |
503 DCHECK_EQ(MessageLoop::TYPE_UI, loop->type()); | 504 DCHECK_EQ(MessageLoop::TYPE_UI, loop->type()); |
504 return static_cast<MessageLoopForUI*>(loop); | 505 return static_cast<MessageLoopForUI*>(loop); |
505 } | 506 } |
506 | 507 |
507 #if defined(OS_WIN) | 508 #if defined(OS_WIN) |
508 void DidProcessMessage(const MSG& message); | 509 void DidProcessMessage(const MSG& message); |
509 #endif // defined(OS_WIN) | 510 #endif // defined(OS_WIN) |
510 | 511 |
| 512 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 513 Display* get_display(); |
| 514 #endif |
| 515 |
511 #if !defined(OS_MACOSX) | 516 #if !defined(OS_MACOSX) |
512 // Please see message_pump_win/message_pump_glib for definitions of these | 517 // Please see message_pump_win/message_pump_glib for definitions of these |
513 // methods. | 518 // methods. |
514 void AddObserver(Observer* observer); | 519 void AddObserver(Observer* observer); |
515 void RemoveObserver(Observer* observer); | 520 void RemoveObserver(Observer* observer); |
516 void Run(Dispatcher* dispatcher); | 521 void Run(Dispatcher* dispatcher); |
517 | 522 |
518 protected: | 523 protected: |
519 // TODO(rvargas): Make this platform independent. | 524 // TODO(rvargas): Make this platform independent. |
520 base::MessagePumpForUI* pump_ui() { | 525 base::MessagePumpForUI* pump_ui() { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 #endif // defined(OS_POSIX) | 605 #endif // defined(OS_POSIX) |
601 }; | 606 }; |
602 | 607 |
603 // Do not add any member variables to MessageLoopForIO! This is important b/c | 608 // Do not add any member variables to MessageLoopForIO! This is important b/c |
604 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra | 609 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra |
605 // data that you need should be stored on the MessageLoop's pump_ instance. | 610 // data that you need should be stored on the MessageLoop's pump_ instance. |
606 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), | 611 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), |
607 MessageLoopForIO_should_not_have_extra_member_variables); | 612 MessageLoopForIO_should_not_have_extra_member_variables); |
608 | 613 |
609 #endif // BASE_MESSAGE_LOOP_H_ | 614 #endif // BASE_MESSAGE_LOOP_H_ |
OLD | NEW |