Chromium Code Reviews| Index: net/dns/notify_watcher_mac.h |
| diff --git a/net/dns/notify_watcher_mac.h b/net/dns/notify_watcher_mac.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c5e199c8165273103d475130cae843a5e180a797 |
| --- /dev/null |
| +++ b/net/dns/notify_watcher_mac.h |
| @@ -0,0 +1,39 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
|
Mark Mentovai
2012/04/17 16:27:43
You need #include guards.
szym
2012/04/17 19:39:31
Oops.
|
| +#include "base/callback.h" |
| +#include "base/message_loop.h" |
| + |
| +namespace net { |
| + |
| +// Receives notifications from notify_register and passes result to a Callback. |
|
Mark Mentovai
2012/04/17 16:27:43
This doesn’t explain what notify_register is, and
|
| +class NotifyWatcherMac : public MessageLoopForIO::Watcher { |
| + public: |
| + typedef base::Callback<void(bool succeeded)> CallbackType; |
| + |
| + NotifyWatcherMac(); |
| + // When deleted, automatically cancels. |
|
Mark Mentovai
2012/04/17 16:27:43
Blank line before this. That helps the reader “see
|
| + virtual ~NotifyWatcherMac(); |
| + |
| + // Registers for notifications for |key|. Returns true if succeeds. If so, |
| + // will pass true to |callback| on notification, and false on error. |
|
Mark Mentovai
2012/04/17 16:27:43
This comment is a little bit confusing to me: is t
szym
2012/04/17 19:39:31
The callback is never called synchronously from Wa
|
| + // After failure the watch is cancelled and will have to be restarted. |
| + bool Watch(const char* key, const CallbackType& callback); |
| + |
| + // Cancels the watch. |
| + void Cancel(); |
| + |
| + private: |
| + // MessageLoopForIO::Watcher: |
| + virtual void OnFileCanReadWithoutBlocking(int /* fd */) OVERRIDE; |
|
Mark Mentovai
2012/04/17 16:27:43
The /* fd */ shouldn’t be necessary, because we do
|
| + virtual void OnFileCanWriteWithoutBlocking(int /* fd */) OVERRIDE {} |
| + |
| + int notify_fd_; |
| + int notify_token_; |
| + CallbackType callback_; |
| + MessageLoopForIO::FileDescriptorWatcher watcher_; |
| +}; |
|
Mark Mentovai
2012/04/17 16:27:43
DISALLOW_COPY_AND_ASSIGN.
|
| + |
| +} // namespace net |
| + |
|
Mark Mentovai
2012/04/17 16:27:43
Get rid of the blank line at the end of the file.
szym
2012/04/17 19:39:31
Ok, although if you look at Patch Set 1, you'll se
Mark Mentovai
2012/04/17 19:47:39
szym wrote:
|