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 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 #if defined(OS_ANDROID) | 616 #if defined(OS_ANDROID) |
617 // On Android, the UI message loop is handled by Java side. So Run() should | 617 // On Android, the UI message loop is handled by Java side. So Run() should |
618 // never be called. Instead use Start(), which will forward all the native UI | 618 // never be called. Instead use Start(), which will forward all the native UI |
619 // events to the Java message loop. | 619 // events to the Java message loop. |
620 void Start(); | 620 void Start(); |
621 #elif !defined(OS_MACOSX) | 621 #elif !defined(OS_MACOSX) |
622 // Please see message_pump_win/message_pump_glib for definitions of these | 622 // Please see message_pump_win/message_pump_glib for definitions of these |
623 // methods. | 623 // methods. |
624 void AddObserver(Observer* observer); | 624 void AddObserver(Observer* observer); |
625 void RemoveObserver(Observer* observer); | 625 void RemoveObserver(Observer* observer); |
626 void Run(Dispatcher* dispatcher); | 626 void RunWithDispatcher(Dispatcher* dispatcher); |
627 void RunAllPendingWithDispatcher(Dispatcher* dispatcher); | 627 void RunAllPendingWithDispatcher(Dispatcher* dispatcher); |
628 | 628 |
629 protected: | 629 protected: |
630 // TODO(rvargas): Make this platform independent. | 630 // TODO(rvargas): Make this platform independent. |
631 base::MessagePumpForUI* pump_ui() { | 631 base::MessagePumpForUI* pump_ui() { |
632 return static_cast<base::MessagePumpForUI*>(pump_.get()); | 632 return static_cast<base::MessagePumpForUI*>(pump_.get()); |
633 } | 633 } |
634 #endif // !defined(OS_MACOSX) | 634 #endif // !defined(OS_MACOSX) |
635 }; | 635 }; |
636 | 636 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 #endif // defined(OS_POSIX) | 711 #endif // defined(OS_POSIX) |
712 }; | 712 }; |
713 | 713 |
714 // Do not add any member variables to MessageLoopForIO! This is important b/c | 714 // Do not add any member variables to MessageLoopForIO! This is important b/c |
715 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra | 715 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra |
716 // data that you need should be stored on the MessageLoop's pump_ instance. | 716 // data that you need should be stored on the MessageLoop's pump_ instance. |
717 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), | 717 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), |
718 MessageLoopForIO_should_not_have_extra_member_variables); | 718 MessageLoopForIO_should_not_have_extra_member_variables); |
719 | 719 |
720 #endif // BASE_MESSAGE_LOOP_H_ | 720 #endif // BASE_MESSAGE_LOOP_H_ |
OLD | NEW |