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

Side by Side Diff: net/dns/dns_client.cc

Issue 1898033006: DNS: Add stubs for persisting data across restarts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: *silently glares at editor, reuploads with proper spacing* Created 4 years, 4 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
« no previous file with comments | « net/dns/dns_client.h ('k') | net/dns/dns_session.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/dns/dns_client.h" 5 #include "net/dns/dns_client.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 const DnsConfig* GetConfig() const override { 49 const DnsConfig* GetConfig() const override {
50 return session_.get() ? &session_->config() : NULL; 50 return session_.get() ? &session_->config() : NULL;
51 } 51 }
52 52
53 DnsTransactionFactory* GetTransactionFactory() override { 53 DnsTransactionFactory* GetTransactionFactory() override {
54 return session_.get() ? factory_.get() : NULL; 54 return session_.get() ? factory_.get() : NULL;
55 } 55 }
56 56
57 AddressSorter* GetAddressSorter() override { return address_sorter_.get(); } 57 AddressSorter* GetAddressSorter() override { return address_sorter_.get(); }
58 58
59 std::unique_ptr<const base::Value> GetPersistentData() const override {
60 if (!session_)
61 return std::unique_ptr<const base::Value>();
62 return session_->GetPersistentData();
63 }
64
65 void ApplyPersistentData(const base::Value& data) override {
66 if (!session_)
67 return;
68 session_->ApplyPersistentData(data);
69 }
70
59 private: 71 private:
60 scoped_refptr<DnsSession> session_; 72 scoped_refptr<DnsSession> session_;
61 std::unique_ptr<DnsTransactionFactory> factory_; 73 std::unique_ptr<DnsTransactionFactory> factory_;
62 std::unique_ptr<AddressSorter> address_sorter_; 74 std::unique_ptr<AddressSorter> address_sorter_;
63 75
64 NetLog* net_log_; 76 NetLog* net_log_;
65 77
66 ClientSocketFactory* socket_factory_; 78 ClientSocketFactory* socket_factory_;
67 const RandIntCallback rand_int_callback_; 79 const RandIntCallback rand_int_callback_;
68 80
(...skipping 13 matching lines...) Expand all
82 std::unique_ptr<DnsClient> DnsClient::CreateClientForTesting( 94 std::unique_ptr<DnsClient> DnsClient::CreateClientForTesting(
83 NetLog* net_log, 95 NetLog* net_log,
84 ClientSocketFactory* socket_factory, 96 ClientSocketFactory* socket_factory,
85 const RandIntCallback& rand_int_callback) { 97 const RandIntCallback& rand_int_callback) {
86 return base::WrapUnique( 98 return base::WrapUnique(
87 new DnsClientImpl(net_log, socket_factory, rand_int_callback)); 99 new DnsClientImpl(net_log, socket_factory, rand_int_callback));
88 } 100 }
89 101
90 } // namespace net 102 } // namespace net
91 103
OLDNEW
« no previous file with comments | « net/dns/dns_client.h ('k') | net/dns/dns_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698