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

Side by Side Diff: net/base/host_cache.h

Issue 10831277: [net] Change factory methods for HostResolver and HostCache to return a scoped_ptr (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove unnecessary initialization; respond to review Created 8 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « jingle/notifier/communicator/single_login_attempt_unittest.cc ('k') | net/base/host_cache.cc » ('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 #ifndef NET_BASE_HOST_CACHE_H_ 5 #ifndef NET_BASE_HOST_CACHE_H_
6 #define NET_BASE_HOST_CACHE_H_ 6 #define NET_BASE_HOST_CACHE_H_
7 7
8 #include <functional> 8 #include <functional>
9 #include <string> 9 #include <string>
10 10
11 #include "base/gtest_prod_util.h" 11 #include "base/gtest_prod_util.h"
12 #include "base/memory/scoped_ptr.h"
12 #include "base/threading/non_thread_safe.h" 13 #include "base/threading/non_thread_safe.h"
13 #include "base/time.h" 14 #include "base/time.h"
14 #include "net/base/address_family.h" 15 #include "net/base/address_family.h"
15 #include "net/base/address_list.h" 16 #include "net/base/address_list.h"
16 #include "net/base/expiring_cache.h" 17 #include "net/base/expiring_cache.h"
17 #include "net/base/net_export.h" 18 #include "net/base/net_export.h"
18 19
19 namespace net { 20 namespace net {
20 21
21 // Cache used by HostResolver to map hostnames to their resolved result. 22 // Cache used by HostResolver to map hostnames to their resolved result.
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 86
86 // Returns the number of entries in the cache. 87 // Returns the number of entries in the cache.
87 size_t size() const; 88 size_t size() const;
88 89
89 // Following are used by net_internals UI. 90 // Following are used by net_internals UI.
90 size_t max_entries() const; 91 size_t max_entries() const;
91 92
92 const EntryMap& entries() const; 93 const EntryMap& entries() const;
93 94
94 // Creates a default cache. 95 // Creates a default cache.
95 static HostCache* CreateDefaultCache(); 96 static scoped_ptr<HostCache> CreateDefaultCache();
96 97
97 private: 98 private:
98 FRIEND_TEST_ALL_PREFIXES(HostCacheTest, NoCache); 99 FRIEND_TEST_ALL_PREFIXES(HostCacheTest, NoCache);
99 100
100 // Returns true if this HostCache can contain no entries. 101 // Returns true if this HostCache can contain no entries.
101 bool caching_is_disabled() const { 102 bool caching_is_disabled() const {
102 return entries_.max_entries() == 0; 103 return entries_.max_entries() == 0;
103 } 104 }
104 105
105 // Map from hostname (presumably in lowercase canonicalized format) to 106 // Map from hostname (presumably in lowercase canonicalized format) to
106 // a resolved result entry. 107 // a resolved result entry.
107 EntryMap entries_; 108 EntryMap entries_;
108 109
109 DISALLOW_COPY_AND_ASSIGN(HostCache); 110 DISALLOW_COPY_AND_ASSIGN(HostCache);
110 }; 111 };
111 112
112 } // namespace net 113 } // namespace net
113 114
114 #endif // NET_BASE_HOST_CACHE_H_ 115 #endif // NET_BASE_HOST_CACHE_H_
OLDNEW
« no previous file with comments | « jingle/notifier/communicator/single_login_attempt_unittest.cc ('k') | net/base/host_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698