| 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 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 MessageLoop* loop = MessageLoop::current(); | 589 MessageLoop* loop = MessageLoop::current(); |
| 590 DCHECK_EQ(MessageLoop::TYPE_IO, loop->type()); | 590 DCHECK_EQ(MessageLoop::TYPE_IO, loop->type()); |
| 591 return static_cast<MessageLoopForIO*>(loop); | 591 return static_cast<MessageLoopForIO*>(loop); |
| 592 } | 592 } |
| 593 | 593 |
| 594 static bool IsCurrent() { | 594 static bool IsCurrent() { |
| 595 MessageLoop* loop = MessageLoop::current(); | 595 MessageLoop* loop = MessageLoop::current(); |
| 596 return loop && loop->type() == MessageLoop::TYPE_IO; | 596 return loop && loop->type() == MessageLoop::TYPE_IO; |
| 597 } | 597 } |
| 598 | 598 |
| 599 #if !defined(OS_NACL) | 599 #if !defined(OS_NACL) || defined(__native_client_nonsfi__) |
| 600 | 600 |
| 601 #if defined(OS_WIN) | 601 #if defined(OS_WIN) |
| 602 typedef MessagePumpForIO::IOHandler IOHandler; | 602 typedef MessagePumpForIO::IOHandler IOHandler; |
| 603 typedef MessagePumpForIO::IOContext IOContext; | 603 typedef MessagePumpForIO::IOContext IOContext; |
| 604 typedef MessagePumpForIO::IOObserver IOObserver; | 604 typedef MessagePumpForIO::IOObserver IOObserver; |
| 605 #elif defined(OS_IOS) | 605 #elif defined(OS_IOS) |
| 606 typedef MessagePumpIOSForIO::Watcher Watcher; | 606 typedef MessagePumpIOSForIO::Watcher Watcher; |
| 607 typedef MessagePumpIOSForIO::FileDescriptorWatcher | 607 typedef MessagePumpIOSForIO::FileDescriptorWatcher |
| 608 FileDescriptorWatcher; | 608 FileDescriptorWatcher; |
| 609 typedef MessagePumpIOSForIO::IOObserver IOObserver; | 609 typedef MessagePumpIOSForIO::IOObserver IOObserver; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 635 bool RegisterJobObject(HANDLE job, IOHandler* handler); | 635 bool RegisterJobObject(HANDLE job, IOHandler* handler); |
| 636 bool WaitForIOCompletion(DWORD timeout, IOHandler* filter); | 636 bool WaitForIOCompletion(DWORD timeout, IOHandler* filter); |
| 637 #elif defined(OS_POSIX) | 637 #elif defined(OS_POSIX) |
| 638 // Please see MessagePumpIOSForIO/MessagePumpLibevent for definition. | 638 // Please see MessagePumpIOSForIO/MessagePumpLibevent for definition. |
| 639 bool WatchFileDescriptor(int fd, | 639 bool WatchFileDescriptor(int fd, |
| 640 bool persistent, | 640 bool persistent, |
| 641 Mode mode, | 641 Mode mode, |
| 642 FileDescriptorWatcher *controller, | 642 FileDescriptorWatcher *controller, |
| 643 Watcher *delegate); | 643 Watcher *delegate); |
| 644 #endif // defined(OS_IOS) || defined(OS_POSIX) | 644 #endif // defined(OS_IOS) || defined(OS_POSIX) |
| 645 #endif // !defined(OS_NACL) | 645 #endif // !defined(OS_NACL) || defined(__native_client_nonsfi__) |
| 646 }; | 646 }; |
| 647 | 647 |
| 648 // Do not add any member variables to MessageLoopForIO! This is important b/c | 648 // Do not add any member variables to MessageLoopForIO! This is important b/c |
| 649 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra | 649 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra |
| 650 // data that you need should be stored on the MessageLoop's pump_ instance. | 650 // data that you need should be stored on the MessageLoop's pump_ instance. |
| 651 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), | 651 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), |
| 652 MessageLoopForIO_should_not_have_extra_member_variables); | 652 MessageLoopForIO_should_not_have_extra_member_variables); |
| 653 | 653 |
| 654 } // namespace base | 654 } // namespace base |
| 655 | 655 |
| 656 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ | 656 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ |
| OLD | NEW |