diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-07 23:02:11 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-07 23:02:11 +0000 |
commit | 4b3c95dd199586b4c540800be8cd223e948e5e3f (patch) | |
tree | c97ef865a3c85f09e920d8b1bc4024a56bb8e8cf /net/http | |
parent | d160ec0e875e98829684f040d843e6a292dbb3ba (diff) | |
download | chromium_src-4b3c95dd199586b4c540800be8cd223e948e5e3f.zip chromium_src-4b3c95dd199586b4c540800be8cd223e948e5e3f.tar.gz chromium_src-4b3c95dd199586b4c540800be8cd223e948e5e3f.tar.bz2 |
Start reordering the methods in headers in net/.
This patch also starts reordering some of the cc files to match their
headers. More of both cleanups will be done in future patches.
BUG=68682
TEST=compiles
Review URL: http://codereview.chromium.org/6085013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70799 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http')
-rw-r--r-- | net/http/http_auth_cache.h | 21 | ||||
-rw-r--r-- | net/http/http_response_headers.h | 46 | ||||
-rw-r--r-- | net/http/http_response_info.h | 16 | ||||
-rw-r--r-- | net/http/http_util.cc | 2 | ||||
-rw-r--r-- | net/http/http_util.h | 1 |
5 files changed, 45 insertions, 41 deletions
diff --git a/net/http/http_auth_cache.h b/net/http/http_auth_cache.h index 707288c..b6c382c 100644 --- a/net/http/http_auth_cache.h +++ b/net/http/http_auth_cache.h @@ -28,6 +28,13 @@ class HttpAuthCache { public: class Entry; + // Prevent unbounded memory growth. These are safeguards for abuse; it is + // not expected that the limits will be reached in ordinary usage. + // This also defines the worst-case lookup times (which grow linearly + // with number of elements in the cache). + enum { kMaxNumPathsPerRealmEntry = 10 }; + enum { kMaxNumRealmEntries = 10 }; + HttpAuthCache(); ~HttpAuthCache(); @@ -93,13 +100,6 @@ class HttpAuthCache { const std::string& scheme, const std::string& auth_challenge); - // Prevent unbounded memory growth. These are safeguards for abuse; it is - // not expected that the limits will be reached in ordinary usage. - // This also defines the worst-case lookup times (which grow linearly - // with number of elements in the cache). - enum { kMaxNumPathsPerRealmEntry = 10 }; - enum { kMaxNumRealmEntries = 10 }; - private: typedef std::list<Entry> EntryList; EntryList entries_; @@ -108,6 +108,8 @@ class HttpAuthCache { // An authentication realm entry. class HttpAuthCache::Entry { public: + ~Entry(); + const GURL& origin() const { return origin_; } @@ -143,13 +145,13 @@ class HttpAuthCache::Entry { void UpdateStaleChallenge(const std::string& auth_challenge); - ~Entry(); - private: friend class HttpAuthCache; FRIEND_TEST_ALL_PREFIXES(HttpAuthCacheTest, AddPath); FRIEND_TEST_ALL_PREFIXES(HttpAuthCacheTest, AddToExistingEntry); + typedef std::list<std::string> PathList; + Entry(); // Adds a path defining the realm's protection space. If the path is @@ -172,7 +174,6 @@ class HttpAuthCache::Entry { int nonce_count_; // List of paths that define the realm's protection space. - typedef std::list<std::string> PathList; PathList paths_; }; diff --git a/net/http/http_response_headers.h b/net/http/http_response_headers.h index aacd35a..2b556b3 100644 --- a/net/http/http_response_headers.h +++ b/net/http/http_response_headers.h @@ -27,6 +27,16 @@ namespace net { class HttpResponseHeaders : public base::RefCountedThreadSafe<HttpResponseHeaders> { public: + // Persist options. + typedef int PersistOptions; + static const PersistOptions PERSIST_RAW = -1; // Raw, unparsed headers. + static const PersistOptions PERSIST_ALL = 0; // Parsed headers. + static const PersistOptions PERSIST_SANS_COOKIES = 1 << 0; + static const PersistOptions PERSIST_SANS_CHALLENGES = 1 << 1; + static const PersistOptions PERSIST_SANS_HOP_BY_HOP = 1 << 2; + static const PersistOptions PERSIST_SANS_NON_CACHEABLE = 1 << 3; + static const PersistOptions PERSIST_SANS_RANGES = 1 << 4; + // Parses the given raw_headers. raw_headers should be formatted thus: // includes the http status response line, each line is \0-terminated, and // it's terminated by an empty line (ie, 2 \0s in a row). @@ -45,16 +55,6 @@ class HttpResponseHeaders // be passed to the pickle's various Read* methods. HttpResponseHeaders(const Pickle& pickle, void** pickle_iter); - // Persist options. - typedef int PersistOptions; - static const PersistOptions PERSIST_RAW = -1; // Raw, unparsed headers. - static const PersistOptions PERSIST_ALL = 0; // Parsed headers. - static const PersistOptions PERSIST_SANS_COOKIES = 1 << 0; - static const PersistOptions PERSIST_SANS_CHALLENGES = 1 << 1; - static const PersistOptions PERSIST_SANS_HOP_BY_HOP = 1 << 2; - static const PersistOptions PERSIST_SANS_NON_CACHEABLE = 1 << 3; - static const PersistOptions PERSIST_SANS_RANGES = 1 << 4; - // Appends a representation of this object to the given pickle. // The options argument can be a combination of PersistOptions. void Persist(Pickle* pickle, PersistOptions options); @@ -253,6 +253,19 @@ class HttpResponseHeaders typedef base::hash_set<std::string> HeaderSet; + // The members of this structure point into raw_headers_. + struct ParsedHeader { + std::string::const_iterator name_begin; + std::string::const_iterator name_end; + std::string::const_iterator value_begin; + std::string::const_iterator value_end; + + // A header "continuation" contains only a subsequent value for the + // preceding header. (Header values are comma separated.) + bool is_continuation() const { return name_begin == name_end; } + }; + typedef std::vector<ParsedHeader> HeaderList; + HttpResponseHeaders(); ~HttpResponseHeaders(); @@ -319,19 +332,6 @@ class HttpResponseHeaders // Adds the set of content range response headers. static void AddHopContentRangeHeaders(HeaderSet* header_names); - // The members of this structure point into raw_headers_. - struct ParsedHeader { - std::string::const_iterator name_begin; - std::string::const_iterator name_end; - std::string::const_iterator value_begin; - std::string::const_iterator value_end; - - // A header "continuation" contains only a subsequent value for the - // preceding header. (Header values are comma separated.) - bool is_continuation() const { return name_begin == name_end; } - }; - typedef std::vector<ParsedHeader> HeaderList; - // We keep a list of ParsedHeader objects. These tell us where to locate the // header-value pairs within raw_headers_. HeaderList parsed_; diff --git a/net/http/http_response_info.h b/net/http/http_response_info.h index cd66982..4fbea3d 100644 --- a/net/http/http_response_info.h +++ b/net/http/http_response_info.h @@ -28,6 +28,14 @@ class HttpResponseInfo { // Even though we could get away with the copy ctor and default operator=, // that would prevent us from doing a bunch of forward declaration. + // Initializes from the representation stored in the given pickle. + bool InitFromPickle(const Pickle& pickle, bool* response_truncated); + + // Call this method to persist the response info. + void Persist(Pickle* pickle, + bool skip_transient_headers, + bool response_truncated) const; + // The following is only defined if the request_time member is set. // If this response was resurrected from cache, then this bool is set, and // request_time may corresponds to a time "far" in the past. Note that @@ -81,14 +89,6 @@ class HttpResponseInfo { // Any metadata asociated with this resource's cached data. scoped_refptr<IOBufferWithSize> metadata; - - // Initializes from the representation stored in the given pickle. - bool InitFromPickle(const Pickle& pickle, bool* response_truncated); - - // Call this method to persist the response info. - void Persist(Pickle* pickle, - bool skip_transient_headers, - bool response_truncated) const; }; } // namespace net diff --git a/net/http/http_util.cc b/net/http/http_util.cc index 1f57d70..bf56136 100644 --- a/net/http/http_util.cc +++ b/net/http/http_util.cc @@ -806,6 +806,8 @@ HttpUtil::NameValuePairsIterator::NameValuePairsIterator( value_is_quoted_(false) { } +HttpUtil::NameValuePairsIterator::~NameValuePairsIterator() {} + // We expect properties to be formatted as one of: // name="value" // name='value' diff --git a/net/http/http_util.h b/net/http/http_util.h index 2f5bd85..3da1635 100644 --- a/net/http/http_util.h +++ b/net/http/http_util.h @@ -283,6 +283,7 @@ class HttpUtil { NameValuePairsIterator(std::string::const_iterator begin, std::string::const_iterator end, char delimiter); + ~NameValuePairsIterator(); // Advances the iterator to the next pair, if any. Returns true if there // is a next pair. Use name* and value* methods to access the resultant |