| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 MessageLoop* loop = MessageLoop::current(); | 541 MessageLoop* loop = MessageLoop::current(); |
| 542 DCHECK(loop); | 542 DCHECK(loop); |
| 543 DCHECK_EQ(MessageLoop::TYPE_UI, loop->type()); | 543 DCHECK_EQ(MessageLoop::TYPE_UI, loop->type()); |
| 544 return static_cast<MessageLoopForUI*>(loop); | 544 return static_cast<MessageLoopForUI*>(loop); |
| 545 } | 545 } |
| 546 | 546 |
| 547 #if defined(OS_WIN) | 547 #if defined(OS_WIN) |
| 548 void DidProcessMessage(const MSG& message); | 548 void DidProcessMessage(const MSG& message); |
| 549 #endif // defined(OS_WIN) | 549 #endif // defined(OS_WIN) |
| 550 | 550 |
| 551 #if defined(OS_IOS) |
| 552 // On iOS, the main message loop cannot be Run(). Instead call Attach(), |
| 553 // which connects this MessageLoop to the UI thread's CFRunLoop and allows |
| 554 // PostTask() to work. |
| 555 void Attach(); |
| 556 #endif |
| 557 |
| 551 #if defined(OS_ANDROID) | 558 #if defined(OS_ANDROID) |
| 552 // On Android, the UI message loop is handled by Java side. So Run() should | 559 // On Android, the UI message loop is handled by Java side. So Run() should |
| 553 // never be called. Instead use Start(), which will forward all the native UI | 560 // never be called. Instead use Start(), which will forward all the native UI |
| 554 // events to the Java message loop. | 561 // events to the Java message loop. |
| 555 void Start(); | 562 void Start(); |
| 556 #elif !defined(OS_MACOSX) | 563 #elif !defined(OS_MACOSX) |
| 557 // Please see message_pump_win/message_pump_glib for definitions of these | 564 // Please see message_pump_win/message_pump_glib for definitions of these |
| 558 // methods. | 565 // methods. |
| 559 void AddObserver(Observer* observer); | 566 void AddObserver(Observer* observer); |
| 560 void RemoveObserver(Observer* observer); | 567 void RemoveObserver(Observer* observer); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 #endif // defined(OS_POSIX) | 651 #endif // defined(OS_POSIX) |
| 645 }; | 652 }; |
| 646 | 653 |
| 647 // Do not add any member variables to MessageLoopForIO! This is important b/c | 654 // Do not add any member variables to MessageLoopForIO! This is important b/c |
| 648 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra | 655 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra |
| 649 // data that you need should be stored on the MessageLoop's pump_ instance. | 656 // data that you need should be stored on the MessageLoop's pump_ instance. |
| 650 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), | 657 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), |
| 651 MessageLoopForIO_should_not_have_extra_member_variables); | 658 MessageLoopForIO_should_not_have_extra_member_variables); |
| 652 | 659 |
| 653 #endif // BASE_MESSAGE_LOOP_H_ | 660 #endif // BASE_MESSAGE_LOOP_H_ |
| OLD | NEW |