OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_MESSAGE_LOOP_H_ | 5 #ifndef BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ |
6 #define BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ | 6 #define BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 #if defined(OS_WIN) | 29 #if defined(OS_WIN) |
30 #include "base/message_loop/message_pump_win.h" | 30 #include "base/message_loop/message_pump_win.h" |
31 #elif defined(OS_IOS) | 31 #elif defined(OS_IOS) |
32 #include "base/message_loop/message_pump_io_ios.h" | 32 #include "base/message_loop/message_pump_io_ios.h" |
33 #elif defined(OS_POSIX) | 33 #elif defined(OS_POSIX) |
34 #include "base/message_loop/message_pump_libevent.h" | 34 #include "base/message_loop/message_pump_libevent.h" |
35 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) | 35 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) |
36 | 36 |
37 #if defined(USE_AURA) && defined(USE_X11) && !defined(OS_NACL) | 37 #if defined(USE_AURA) && defined(USE_X11) && !defined(OS_NACL) |
38 #include "base/message_loop/message_pump_x11.h" | 38 #include "base/message_loop/message_pump_x11.h" |
39 #elif defined(USE_OZONE) && !defined(OS_NACL) | |
40 #include "base/message_loop/message_pump_ozone.h" | |
41 #elif !defined(OS_ANDROID_HOST) | 39 #elif !defined(OS_ANDROID_HOST) |
42 #define USE_GTK_MESSAGE_PUMP | 40 #define USE_GTK_MESSAGE_PUMP |
43 #include "base/message_loop/message_pump_gtk.h" | 41 #include "base/message_loop/message_pump_gtk.h" |
44 #if defined(TOOLKIT_GTK) | 42 #if defined(TOOLKIT_GTK) |
45 #include "base/message_loop/message_pump_x11.h" | 43 #include "base/message_loop/message_pump_x11.h" |
46 #endif | 44 #endif |
47 #endif | 45 #endif |
48 | 46 |
49 #endif | 47 #endif |
50 #endif | 48 #endif |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 void Attach(); | 570 void Attach(); |
573 #endif | 571 #endif |
574 | 572 |
575 #if defined(OS_ANDROID) | 573 #if defined(OS_ANDROID) |
576 // On Android, the UI message loop is handled by Java side. So Run() should | 574 // On Android, the UI message loop is handled by Java side. So Run() should |
577 // never be called. Instead use Start(), which will forward all the native UI | 575 // never be called. Instead use Start(), which will forward all the native UI |
578 // events to the Java message loop. | 576 // events to the Java message loop. |
579 void Start(); | 577 void Start(); |
580 #endif | 578 #endif |
581 | 579 |
582 #if !defined(OS_NACL) && (defined(TOOLKIT_GTK) || defined(USE_OZONE) || \ | 580 #if !defined(OS_NACL) && (defined(TOOLKIT_GTK) || \ |
583 defined(OS_WIN) || defined(USE_X11)) | 581 defined(OS_WIN) || defined(USE_X11)) |
584 // Please see message_pump_win/message_pump_glib for definitions of these | 582 // Please see message_pump_win/message_pump_glib for definitions of these |
585 // methods. | 583 // methods. |
586 void AddObserver(Observer* observer); | 584 void AddObserver(Observer* observer); |
587 void RemoveObserver(Observer* observer); | 585 void RemoveObserver(Observer* observer); |
588 #endif | 586 #endif |
589 | 587 |
| 588 #if defined(USE_OZONE) |
| 589 // Please see MessagePumpLibevent for definition. |
| 590 bool WatchFileDescriptor( |
| 591 int fd, |
| 592 bool persistent, |
| 593 MessagePumpLibevent::Mode mode, |
| 594 MessagePumpLibevent::FileDescriptorWatcher* controller, |
| 595 MessagePumpLibevent::Watcher* delegate); |
| 596 #endif |
| 597 |
590 protected: | 598 protected: |
591 #if defined(USE_X11) | 599 #if defined(USE_X11) |
592 friend class MessagePumpX11; | 600 friend class MessagePumpX11; |
593 #endif | 601 #endif |
594 #if defined(USE_OZONE) && !defined(OS_NACL) | |
595 friend class MessagePumpOzone; | |
596 #endif | |
597 | 602 |
598 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) | 603 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) |
599 // TODO(rvargas): Make this platform independent. | 604 // TODO(rvargas): Make this platform independent. |
600 MessagePumpForUI* pump_ui() { | 605 MessagePumpForUI* pump_ui() { |
601 return static_cast<MessagePumpForUI*>(pump_.get()); | 606 return static_cast<MessagePumpForUI*>(pump_.get()); |
602 } | 607 } |
603 #endif | 608 #endif |
604 }; | 609 }; |
605 | 610 |
606 // Do not add any member variables to MessageLoopForUI! This is important b/c | 611 // Do not add any member variables to MessageLoopForUI! This is important b/c |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 | 717 |
713 // Do not add any member variables to MessageLoopForIO! This is important b/c | 718 // Do not add any member variables to MessageLoopForIO! This is important b/c |
714 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra | 719 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra |
715 // data that you need should be stored on the MessageLoop's pump_ instance. | 720 // data that you need should be stored on the MessageLoop's pump_ instance. |
716 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), | 721 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), |
717 MessageLoopForIO_should_not_have_extra_member_variables); | 722 MessageLoopForIO_should_not_have_extra_member_variables); |
718 | 723 |
719 } // namespace base | 724 } // namespace base |
720 | 725 |
721 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ | 726 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ |
OLD | NEW |