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

Unified Diff: net/dns/notify_watcher_mac.cc

Issue 992733002: Remove //net (except for Android test stuff) and sdch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/dns/notify_watcher_mac.h ('k') | net/dns/record_parsed.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/dns/notify_watcher_mac.cc
diff --git a/net/dns/notify_watcher_mac.cc b/net/dns/notify_watcher_mac.cc
deleted file mode 100644
index 286f18bb7bb9ee15dae245777ac16cf3cde8590d..0000000000000000000000000000000000000000
--- a/net/dns/notify_watcher_mac.cc
+++ /dev/null
@@ -1,64 +0,0 @@
-// 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.
-
-#include "net/dns/notify_watcher_mac.h"
-
-#include <notify.h>
-
-#include "base/logging.h"
-#include "base/posix/eintr_wrapper.h"
-
-namespace net {
-
-NotifyWatcherMac::NotifyWatcherMac() : notify_fd_(-1), notify_token_(-1) {}
-
-NotifyWatcherMac::~NotifyWatcherMac() {
- Cancel();
-}
-
-bool NotifyWatcherMac::Watch(const char* key, const CallbackType& callback) {
- DCHECK(key);
- DCHECK(!callback.is_null());
- Cancel();
- uint32_t status = notify_register_file_descriptor(
- key, &notify_fd_, 0, &notify_token_);
- if (status != NOTIFY_STATUS_OK)
- return false;
- DCHECK_GE(notify_fd_, 0);
- if (!base::MessageLoopForIO::current()->WatchFileDescriptor(
- notify_fd_,
- true,
- base::MessageLoopForIO::WATCH_READ,
- &watcher_,
- this)) {
- Cancel();
- return false;
- }
- callback_ = callback;
- return true;
-}
-
-void NotifyWatcherMac::Cancel() {
- if (notify_fd_ >= 0) {
- notify_cancel(notify_token_); // Also closes |notify_fd_|.
- notify_fd_ = -1;
- callback_.Reset();
- watcher_.StopWatchingFileDescriptor();
- }
-}
-
-void NotifyWatcherMac::OnFileCanReadWithoutBlocking(int fd) {
- int token;
- int status = HANDLE_EINTR(read(notify_fd_, &token, sizeof(token)));
- if (status != sizeof(token)) {
- Cancel();
- callback_.Run(false);
- return;
- }
- // Ignoring |token| value to avoid possible endianness mismatch:
- // http://openradar.appspot.com/8821081
- callback_.Run(true);
-}
-
-} // namespace net
« no previous file with comments | « net/dns/notify_watcher_mac.h ('k') | net/dns/record_parsed.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698