| 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_PUMP_LIBEVENT_H_ | 5 #ifndef BASE_MESSAGE_PUMP_LIBEVENT_H_ |
| 6 #define BASE_MESSAGE_PUMP_LIBEVENT_H_ | 6 #define BASE_MESSAGE_PUMP_LIBEVENT_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 // Stop watching the FD, always safe to call. No-op if there's nothing | 64 // Stop watching the FD, always safe to call. No-op if there's nothing |
| 65 // to do. | 65 // to do. |
| 66 bool StopWatchingFileDescriptor(); | 66 bool StopWatchingFileDescriptor(); |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 friend class MessagePumpLibevent; | 69 friend class MessagePumpLibevent; |
| 70 friend class MessagePumpLibeventTest; | 70 friend class MessagePumpLibeventTest; |
| 71 | 71 |
| 72 // Called by MessagePumpLibevent, ownership of |e| is transferred to this | 72 // Called by MessagePumpLibevent, ownership of |e| is transferred to this |
| 73 // object. | 73 // object. |
| 74 void Init(event* e, bool is_persistent); | 74 void Init(event* e); |
| 75 | 75 |
| 76 // Used by MessagePumpLibevent to take ownership of event_. | 76 // Used by MessagePumpLibevent to take ownership of event_. |
| 77 event *ReleaseEvent(); | 77 event *ReleaseEvent(); |
| 78 | 78 |
| 79 void set_pump(MessagePumpLibevent* pump) { pump_ = pump; } | 79 void set_pump(MessagePumpLibevent* pump) { pump_ = pump; } |
| 80 MessagePumpLibevent* pump() { return pump_; } | 80 MessagePumpLibevent* pump() { return pump_; } |
| 81 | 81 |
| 82 void set_watcher(Watcher* watcher) { watcher_ = watcher; } | 82 void set_watcher(Watcher* watcher) { watcher_ = watcher; } |
| 83 | 83 |
| 84 void OnFileCanReadWithoutBlocking(int fd, MessagePumpLibevent* pump); | 84 void OnFileCanReadWithoutBlocking(int fd, MessagePumpLibevent* pump); |
| 85 void OnFileCanWriteWithoutBlocking(int fd, MessagePumpLibevent* pump); | 85 void OnFileCanWriteWithoutBlocking(int fd, MessagePumpLibevent* pump); |
| 86 | 86 |
| 87 bool is_persistent_; // false if this event is one-shot. | |
| 88 event* event_; | 87 event* event_; |
| 89 MessagePumpLibevent* pump_; | 88 MessagePumpLibevent* pump_; |
| 90 Watcher* watcher_; | 89 Watcher* watcher_; |
| 91 base::WeakPtrFactory<FileDescriptorWatcher> weak_factory_; | 90 base::WeakPtrFactory<FileDescriptorWatcher> weak_factory_; |
| 92 | 91 |
| 93 DISALLOW_COPY_AND_ASSIGN(FileDescriptorWatcher); | 92 DISALLOW_COPY_AND_ASSIGN(FileDescriptorWatcher); |
| 94 }; | 93 }; |
| 95 | 94 |
| 96 enum Mode { | 95 enum Mode { |
| 97 WATCH_READ = 1 << 0, | 96 WATCH_READ = 1 << 0, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 event* wakeup_event_; | 171 event* wakeup_event_; |
| 173 | 172 |
| 174 ObserverList<IOObserver> io_observers_; | 173 ObserverList<IOObserver> io_observers_; |
| 175 ThreadChecker watch_file_descriptor_caller_checker_; | 174 ThreadChecker watch_file_descriptor_caller_checker_; |
| 176 DISALLOW_COPY_AND_ASSIGN(MessagePumpLibevent); | 175 DISALLOW_COPY_AND_ASSIGN(MessagePumpLibevent); |
| 177 }; | 176 }; |
| 178 | 177 |
| 179 } // namespace base | 178 } // namespace base |
| 180 | 179 |
| 181 #endif // BASE_MESSAGE_PUMP_LIBEVENT_H_ | 180 #endif // BASE_MESSAGE_PUMP_LIBEVENT_H_ |
| OLD | NEW |