Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(354)

Side by Side Diff: net/dns/notify_watcher_mac.h

Issue 9969190: [net/dns] Watch configd notifications to detect DnsConfig changes on Mac. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Added comments. Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
Mark Mentovai 2012/04/17 16:27:43 You need #include guards.
szym 2012/04/17 19:39:31 Oops.
5 #include "base/callback.h"
6 #include "base/message_loop.h"
7
8 namespace net {
9
10 // 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
11 class NotifyWatcherMac : public MessageLoopForIO::Watcher {
12 public:
13 typedef base::Callback<void(bool succeeded)> CallbackType;
14
15 NotifyWatcherMac();
16 // When deleted, automatically cancels.
Mark Mentovai 2012/04/17 16:27:43 Blank line before this. That helps the reader “see
17 virtual ~NotifyWatcherMac();
18
19 // Registers for notifications for |key|. Returns true if succeeds. If so,
20 // 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
21 // After failure the watch is cancelled and will have to be restarted.
22 bool Watch(const char* key, const CallbackType& callback);
23
24 // Cancels the watch.
25 void Cancel();
26
27 private:
28 // MessageLoopForIO::Watcher:
29 virtual void OnFileCanReadWithoutBlocking(int /* fd */) OVERRIDE;
Mark Mentovai 2012/04/17 16:27:43 The /* fd */ shouldn’t be necessary, because we do
30 virtual void OnFileCanWriteWithoutBlocking(int /* fd */) OVERRIDE {}
31
32 int notify_fd_;
33 int notify_token_;
34 CallbackType callback_;
35 MessageLoopForIO::FileDescriptorWatcher watcher_;
36 };
Mark Mentovai 2012/04/17 16:27:43 DISALLOW_COPY_AND_ASSIGN.
37
38 } // namespace net
39
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:
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698