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 NET_DNS_NOTIFY_WATCHER_MAC_H_ | 5 #ifndef NET_DNS_NOTIFY_WATCHER_MAC_H_ |
6 #define NET_DNS_NOTIFY_WATCHER_MAC_H_ | 6 #define NET_DNS_NOTIFY_WATCHER_MAC_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 // Registers for notifications for |key|. Returns true if succeeds. If so, | 25 // Registers for notifications for |key|. Returns true if succeeds. If so, |
26 // will deliver asynchronous notifications and errors to |callback|. | 26 // will deliver asynchronous notifications and errors to |callback|. |
27 bool Watch(const char* key, const CallbackType& callback); | 27 bool Watch(const char* key, const CallbackType& callback); |
28 | 28 |
29 // Cancels the watch. | 29 // Cancels the watch. |
30 void Cancel(); | 30 void Cancel(); |
31 | 31 |
32 private: | 32 private: |
33 // MessageLoopForIO::Watcher: | 33 // MessageLoopForIO::Watcher: |
34 virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; | 34 virtual void OnFileCanReadWithoutBlocking(int fd) override; |
35 virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE {} | 35 virtual void OnFileCanWriteWithoutBlocking(int fd) override {} |
36 | 36 |
37 int notify_fd_; | 37 int notify_fd_; |
38 int notify_token_; | 38 int notify_token_; |
39 CallbackType callback_; | 39 CallbackType callback_; |
40 base::MessageLoopForIO::FileDescriptorWatcher watcher_; | 40 base::MessageLoopForIO::FileDescriptorWatcher watcher_; |
41 | 41 |
42 DISALLOW_COPY_AND_ASSIGN(NotifyWatcherMac); | 42 DISALLOW_COPY_AND_ASSIGN(NotifyWatcherMac); |
43 }; | 43 }; |
44 | 44 |
45 } // namespace net | 45 } // namespace net |
46 | 46 |
47 #endif // NET_DNS_NOTIFY_WATCHER_MAC_H_ | 47 #endif // NET_DNS_NOTIFY_WATCHER_MAC_H_ |
OLD | NEW |