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

Unified Diff: net/nqe/socket_watcher.cc

Issue 2024813003: Split SocketWatcher and SocketWatcherFactory out of NQE (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 6 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/nqe/socket_watcher.h ('k') | net/nqe/socket_watcher_factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/nqe/socket_watcher.cc
diff --git a/net/nqe/socket_watcher.cc b/net/nqe/socket_watcher.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d03b98ecf8193a91fefb449d766b7fa352e4b61b
--- /dev/null
+++ b/net/nqe/socket_watcher.cc
@@ -0,0 +1,49 @@
+// Copyright 2016 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/nqe/socket_watcher.h"
+
+#include "base/bind.h"
+#include "base/location.h"
+#include "base/single_thread_task_runner.h"
+#include "base/time/time.h"
+
+namespace net {
+
+namespace nqe {
+
+namespace internal {
+
+SocketWatcher::SocketWatcher(
+ SocketPerformanceWatcherFactory::Protocol protocol,
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner,
+ OnUpdatedRTTAvailableCallback updated_rtt_observation_callback)
+ : protocol_(protocol),
+ task_runner_(std::move(task_runner)),
+ updated_rtt_observation_callback_(updated_rtt_observation_callback) {}
+
+SocketWatcher::~SocketWatcher() {}
+
+bool SocketWatcher::ShouldNotifyUpdatedRTT() const {
+ DCHECK(thread_checker_.CalledOnValidThread());
+
+ return true;
+}
+
+void SocketWatcher::OnUpdatedRTTAvailable(const base::TimeDelta& rtt) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+
+ task_runner_->PostTask(
+ FROM_HERE, base::Bind(updated_rtt_observation_callback_, protocol_, rtt));
+}
+
+void SocketWatcher::OnConnectionChanged() {
+ DCHECK(thread_checker_.CalledOnValidThread());
+}
+
+} // namespace internal
+
+} // namespace nqe
+
+} // namespace net
« no previous file with comments | « net/nqe/socket_watcher.h ('k') | net/nqe/socket_watcher_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698