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

Unified Diff: net/dns/dns_client.cc

Issue 8835011: Revert 113282 - Isolates generic DnsClient from AsyncHostResolver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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/dns_client.h ('k') | net/dns/dns_client_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/dns/dns_client.cc
===================================================================
--- net/dns/dns_client.cc (revision 113383)
+++ net/dns/dns_client.cc (working copy)
@@ -1,91 +0,0 @@
-// Copyright (c) 2011 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/dns_client.h"
-
-#include "base/bind.h"
-#include "base/string_piece.h"
-#include "net/base/net_errors.h"
-#include "net/dns/dns_response.h"
-#include "net/dns/dns_session.h"
-#include "net/dns/dns_transaction.h"
-#include "net/socket/client_socket_factory.h"
-
-namespace net {
-
-DnsClient::Request::Request(const base::StringPiece& qname,
- uint16 qtype,
- const RequestCallback& callback)
- : qname_(qname.data(), qname.size()),
- qtype_(qtype),
- callback_(callback) {
-}
-
-DnsClient::Request::~Request() {}
-
-// Implementation of DnsClient that uses DnsTransaction to serve requests.
-class DnsClientImpl : public DnsClient {
- public:
- class RequestImpl : public Request {
- public:
- RequestImpl(const base::StringPiece& qname,
- uint16 qtype,
- const RequestCallback& callback,
- DnsSession* session,
- const BoundNetLog& net_log)
- : Request(qname, qtype, callback),
- session_(session),
- net_log_(net_log) {
- }
-
- virtual int Start() OVERRIDE {
- transaction_.reset(new DnsTransaction(
- session_,
- qname(),
- qtype(),
- base::Bind(&RequestImpl::OnComplete, base::Unretained(this)),
- net_log_));
- return transaction_->Start();
- }
-
- void OnComplete(DnsTransaction* transaction, int rv) {
- DCHECK_EQ(transaction_.get(), transaction);
- // TODO(szym):
- // - handle retransmissions here instead of DnsTransaction
- // - handle rcode and flags here instead of DnsTransaction
- // - update RTT in DnsSession
- // - perform suffix search
- // - handle DNS over TCP
- DoCallback(rv, (rv == OK) ? transaction->response() : NULL);
- }
-
- private:
- scoped_refptr<DnsSession> session_;
- BoundNetLog net_log_;
- scoped_ptr<DnsTransaction> transaction_;
- };
-
- explicit DnsClientImpl(DnsSession* session) {
- session_ = session;
- }
-
- virtual Request* CreateRequest(
- const base::StringPiece& qname,
- uint16 qtype,
- const RequestCallback& callback,
- const BoundNetLog& source_net_log) OVERRIDE {
- return new RequestImpl(qname, qtype, callback, session_, source_net_log);
- }
-
- private:
- scoped_refptr<DnsSession> session_;
-};
-
-// static
-DnsClient* DnsClient::CreateClient(DnsSession* session) {
- return new DnsClientImpl(session);
-}
-
-} // namespace net
-
« no previous file with comments | « net/dns/dns_client.h ('k') | net/dns/dns_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698