| 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 <memory> | 8 #include <memory> | 
| 9 #include <queue> | 9 #include <queue> | 
| 10 #include <string> | 10 #include <string> | 
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 653   static bool IsCurrent() { | 653   static bool IsCurrent() { | 
| 654     MessageLoop* loop = MessageLoop::current(); | 654     MessageLoop* loop = MessageLoop::current(); | 
| 655     return loop && loop->type() == MessageLoop::TYPE_IO; | 655     return loop && loop->type() == MessageLoop::TYPE_IO; | 
| 656   } | 656   } | 
| 657 | 657 | 
| 658 #if !defined(OS_NACL_SFI) | 658 #if !defined(OS_NACL_SFI) | 
| 659 | 659 | 
| 660 #if defined(OS_WIN) | 660 #if defined(OS_WIN) | 
| 661   typedef MessagePumpForIO::IOHandler IOHandler; | 661   typedef MessagePumpForIO::IOHandler IOHandler; | 
| 662   typedef MessagePumpForIO::IOContext IOContext; | 662   typedef MessagePumpForIO::IOContext IOContext; | 
| 663   typedef MessagePumpForIO::IOObserver IOObserver; |  | 
| 664 #elif defined(OS_IOS) | 663 #elif defined(OS_IOS) | 
| 665   typedef MessagePumpIOSForIO::Watcher Watcher; | 664   typedef MessagePumpIOSForIO::Watcher Watcher; | 
| 666   typedef MessagePumpIOSForIO::FileDescriptorWatcher | 665   typedef MessagePumpIOSForIO::FileDescriptorWatcher | 
| 667       FileDescriptorWatcher; | 666       FileDescriptorWatcher; | 
| 668   typedef MessagePumpIOSForIO::IOObserver IOObserver; |  | 
| 669 | 667 | 
| 670   enum Mode { | 668   enum Mode { | 
| 671     WATCH_READ = MessagePumpIOSForIO::WATCH_READ, | 669     WATCH_READ = MessagePumpIOSForIO::WATCH_READ, | 
| 672     WATCH_WRITE = MessagePumpIOSForIO::WATCH_WRITE, | 670     WATCH_WRITE = MessagePumpIOSForIO::WATCH_WRITE, | 
| 673     WATCH_READ_WRITE = MessagePumpIOSForIO::WATCH_READ_WRITE | 671     WATCH_READ_WRITE = MessagePumpIOSForIO::WATCH_READ_WRITE | 
| 674   }; | 672   }; | 
| 675 #elif defined(OS_POSIX) | 673 #elif defined(OS_POSIX) | 
| 676   typedef MessagePumpLibevent::Watcher Watcher; | 674   typedef MessagePumpLibevent::Watcher Watcher; | 
| 677   typedef MessagePumpLibevent::FileDescriptorWatcher | 675   typedef MessagePumpLibevent::FileDescriptorWatcher | 
| 678       FileDescriptorWatcher; | 676       FileDescriptorWatcher; | 
| 679   typedef MessagePumpLibevent::IOObserver IOObserver; |  | 
| 680 | 677 | 
| 681   enum Mode { | 678   enum Mode { | 
| 682     WATCH_READ = MessagePumpLibevent::WATCH_READ, | 679     WATCH_READ = MessagePumpLibevent::WATCH_READ, | 
| 683     WATCH_WRITE = MessagePumpLibevent::WATCH_WRITE, | 680     WATCH_WRITE = MessagePumpLibevent::WATCH_WRITE, | 
| 684     WATCH_READ_WRITE = MessagePumpLibevent::WATCH_READ_WRITE | 681     WATCH_READ_WRITE = MessagePumpLibevent::WATCH_READ_WRITE | 
| 685   }; | 682   }; | 
| 686 #endif | 683 #endif | 
| 687 | 684 | 
| 688   void AddIOObserver(IOObserver* io_observer); |  | 
| 689   void RemoveIOObserver(IOObserver* io_observer); |  | 
| 690 |  | 
| 691 #if defined(OS_WIN) | 685 #if defined(OS_WIN) | 
| 692   // Please see MessagePumpWin for definitions of these methods. | 686   // Please see MessagePumpWin for definitions of these methods. | 
| 693   void RegisterIOHandler(HANDLE file, IOHandler* handler); | 687   void RegisterIOHandler(HANDLE file, IOHandler* handler); | 
| 694   bool RegisterJobObject(HANDLE job, IOHandler* handler); | 688   bool RegisterJobObject(HANDLE job, IOHandler* handler); | 
| 695   bool WaitForIOCompletion(DWORD timeout, IOHandler* filter); | 689   bool WaitForIOCompletion(DWORD timeout, IOHandler* filter); | 
| 696 #elif defined(OS_POSIX) | 690 #elif defined(OS_POSIX) | 
| 697   // Please see MessagePumpIOSForIO/MessagePumpLibevent for definition. | 691   // Please see MessagePumpIOSForIO/MessagePumpLibevent for definition. | 
| 698   bool WatchFileDescriptor(int fd, | 692   bool WatchFileDescriptor(int fd, | 
| 699                            bool persistent, | 693                            bool persistent, | 
| 700                            Mode mode, | 694                            Mode mode, | 
| 701                            FileDescriptorWatcher* controller, | 695                            FileDescriptorWatcher* controller, | 
| 702                            Watcher* delegate); | 696                            Watcher* delegate); | 
| 703 #endif  // defined(OS_IOS) || defined(OS_POSIX) | 697 #endif  // defined(OS_IOS) || defined(OS_POSIX) | 
| 704 #endif  // !defined(OS_NACL_SFI) | 698 #endif  // !defined(OS_NACL_SFI) | 
| 705 }; | 699 }; | 
| 706 | 700 | 
| 707 // Do not add any member variables to MessageLoopForIO!  This is important b/c | 701 // Do not add any member variables to MessageLoopForIO!  This is important b/c | 
| 708 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO).  Any extra | 702 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO).  Any extra | 
| 709 // data that you need should be stored on the MessageLoop's pump_ instance. | 703 // data that you need should be stored on the MessageLoop's pump_ instance. | 
| 710 static_assert(sizeof(MessageLoop) == sizeof(MessageLoopForIO), | 704 static_assert(sizeof(MessageLoop) == sizeof(MessageLoopForIO), | 
| 711               "MessageLoopForIO should not have extra member variables"); | 705               "MessageLoopForIO should not have extra member variables"); | 
| 712 | 706 | 
| 713 }  // namespace base | 707 }  // namespace base | 
| 714 | 708 | 
| 715 #endif  // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ | 709 #endif  // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ | 
| OLD | NEW | 
|---|