OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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_PUMP_IO_IOS_H_ | 5 #ifndef BASE_MESSAGE_PUMP_IO_IOS_H_ |
6 #define BASE_MESSAGE_PUMP_IO_IOS_H_ | 6 #define BASE_MESSAGE_PUMP_IO_IOS_H_ |
7 | 7 |
8 #include "base/base_export.h" | 8 #include "base/base_export.h" |
9 #include "base/mac/scoped_cffiledescriptorref.h" | 9 #include "base/mac/scoped_cffiledescriptorref.h" |
10 #include "base/mac/scoped_cftyperef.h" | 10 #include "base/mac/scoped_cftyperef.h" |
11 #include "base/memory/ref_counted.h" | |
11 #include "base/message_pump_mac.h" | 12 #include "base/message_pump_mac.h" |
12 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
13 | 14 |
14 namespace base { | 15 namespace base { |
15 | 16 |
16 // This file introduces a class to monitor sockets and issue callbacks when | 17 // This file introduces a class to monitor sockets and issue callbacks when |
17 // sockets are ready for I/O on iOS. | 18 // sockets are ready for I/O on iOS. |
18 class BASE_EXPORT MessagePumpIOSForIO : public MessagePumpNSRunLoop { | 19 class BASE_EXPORT MessagePumpIOSForIO : public MessagePumpNSRunLoop { |
19 public: | 20 public: |
20 class IOObserver { | 21 class IOObserver { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
74 | 75 |
75 void set_watcher(Watcher* watcher) { watcher_ = watcher; } | 76 void set_watcher(Watcher* watcher) { watcher_ = watcher; } |
76 | 77 |
77 void OnFileCanReadWithoutBlocking(int fd, MessagePumpIOSForIO* pump); | 78 void OnFileCanReadWithoutBlocking(int fd, MessagePumpIOSForIO* pump); |
78 void OnFileCanWriteWithoutBlocking(int fd, MessagePumpIOSForIO* pump); | 79 void OnFileCanWriteWithoutBlocking(int fd, MessagePumpIOSForIO* pump); |
79 | 80 |
80 bool is_persistent_; // false if this event is one-shot. | 81 bool is_persistent_; // false if this event is one-shot. |
81 base::mac::ScopedCFFileDescriptorRef fdref_; | 82 base::mac::ScopedCFFileDescriptorRef fdref_; |
82 CFOptionFlags callback_types_; | 83 CFOptionFlags callback_types_; |
83 base::mac::ScopedCFTypeRef<CFRunLoopSourceRef> fd_source_; | 84 base::mac::ScopedCFTypeRef<CFRunLoopSourceRef> fd_source_; |
84 MessagePumpIOSForIO* pump_; | 85 scoped_refptr<MessagePumpIOSForIO> pump_; |
wtc
2012/12/03 19:27:18
Do you know why the FileDescriptorWatcher class in
| |
85 Watcher* watcher_; | 86 Watcher* watcher_; |
86 | 87 |
87 DISALLOW_COPY_AND_ASSIGN(FileDescriptorWatcher); | 88 DISALLOW_COPY_AND_ASSIGN(FileDescriptorWatcher); |
88 }; | 89 }; |
89 | 90 |
90 enum Mode { | 91 enum Mode { |
91 WATCH_READ = 1 << 0, | 92 WATCH_READ = 1 << 0, |
92 WATCH_WRITE = 1 << 1, | 93 WATCH_WRITE = 1 << 1, |
93 WATCH_READ_WRITE = WATCH_READ | WATCH_WRITE | 94 WATCH_READ_WRITE = WATCH_READ | WATCH_WRITE |
94 }; | 95 }; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
132 | 133 |
133 ObserverList<IOObserver> io_observers_; | 134 ObserverList<IOObserver> io_observers_; |
134 ThreadChecker watch_file_descriptor_caller_checker_; | 135 ThreadChecker watch_file_descriptor_caller_checker_; |
135 | 136 |
136 DISALLOW_COPY_AND_ASSIGN(MessagePumpIOSForIO); | 137 DISALLOW_COPY_AND_ASSIGN(MessagePumpIOSForIO); |
137 }; | 138 }; |
138 | 139 |
139 } // namespace base | 140 } // namespace base |
140 | 141 |
141 #endif // BASE_MESSAGE_PUMP_IO_IOS_H_ | 142 #endif // BASE_MESSAGE_PUMP_IO_IOS_H_ |
OLD | NEW |