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 #include "base/message_loop/message_pump_io_ios.h" | 5 #include "base/message_loop/message_pump_io_ios.h" |
6 | 6 |
7 #include <unistd.h> | 7 #include <unistd.h> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 if (IGNORE_EINTR(close(pipefds_[1])) < 0) | 37 if (IGNORE_EINTR(close(pipefds_[1])) < 0) |
38 PLOG(ERROR) << "close"; | 38 PLOG(ERROR) << "close"; |
39 } | 39 } |
40 | 40 |
41 MessageLoop* ui_loop() { return &ui_loop_; } | 41 MessageLoop* ui_loop() { return &ui_loop_; } |
42 MessageLoopForIO* io_loop() const { | 42 MessageLoopForIO* io_loop() const { |
43 return static_cast<MessageLoopForIO*>(io_thread_.message_loop()); | 43 return static_cast<MessageLoopForIO*>(io_thread_.message_loop()); |
44 } | 44 } |
45 | 45 |
46 void HandleFdIOEvent(MessageLoopForIO::FileDescriptorWatcher* watcher) { | 46 void HandleFdIOEvent(MessageLoopForIO::FileDescriptorWatcher* watcher) { |
47 MessagePumpIOSForIO::HandleFdIOEvent(watcher->fdref_, | 47 MessagePumpIOSForIO::HandleFdIOEvent(watcher->fdref_.get(), |
48 kCFFileDescriptorReadCallBack | kCFFileDescriptorWriteCallBack, | 48 kCFFileDescriptorReadCallBack | kCFFileDescriptorWriteCallBack, |
49 watcher); | 49 watcher); |
50 } | 50 } |
51 | 51 |
52 int pipefds_[2]; | 52 int pipefds_[2]; |
53 int alternate_pipefds_[2]; | 53 int alternate_pipefds_[2]; |
54 | 54 |
55 private: | 55 private: |
56 MessageLoop ui_loop_; | 56 MessageLoop ui_loop_; |
57 Thread io_thread_; | 57 Thread io_thread_; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 pump->WatchFileDescriptor(pipefds_[1], | 174 pump->WatchFileDescriptor(pipefds_[1], |
175 false, MessagePumpIOSForIO::WATCH_READ_WRITE, &watcher, &delegate); | 175 false, MessagePumpIOSForIO::WATCH_READ_WRITE, &watcher, &delegate); |
176 | 176 |
177 // Spoof a callback. | 177 // Spoof a callback. |
178 HandleFdIOEvent(&watcher); | 178 HandleFdIOEvent(&watcher); |
179 } | 179 } |
180 | 180 |
181 } // namespace | 181 } // namespace |
182 | 182 |
183 } // namespace base | 183 } // namespace base |
OLD | NEW |