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

Side by Side Diff: net/http/http_response_info.cc

Issue 9447084: Refactor Pickle Read methods to use higher performance PickleIterator. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: compile (racing with incoming CLs) Created 8 years, 9 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 | « net/http/http_response_headers_unittest.cc ('k') | net/http/http_vary_data.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/http/http_response_info.h" 5 #include "net/http/http_response_info.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/pickle.h" 8 #include "base/pickle.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "net/base/auth.h" 10 #include "net/base/auth.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 cert_request_info = rhs.cert_request_info; 109 cert_request_info = rhs.cert_request_info;
110 ssl_info = rhs.ssl_info; 110 ssl_info = rhs.ssl_info;
111 headers = rhs.headers; 111 headers = rhs.headers;
112 vary_data = rhs.vary_data; 112 vary_data = rhs.vary_data;
113 metadata = rhs.metadata; 113 metadata = rhs.metadata;
114 return *this; 114 return *this;
115 } 115 }
116 116
117 bool HttpResponseInfo::InitFromPickle(const Pickle& pickle, 117 bool HttpResponseInfo::InitFromPickle(const Pickle& pickle,
118 bool* response_truncated) { 118 bool* response_truncated) {
119 void* iter = NULL; 119 PickleIterator iter(pickle);
120 120
121 // read flags and verify version 121 // read flags and verify version
122 int flags; 122 int flags;
123 if (!pickle.ReadInt(&iter, &flags)) 123 if (!pickle.ReadInt(&iter, &flags))
124 return false; 124 return false;
125 int version = flags & RESPONSE_INFO_VERSION_MASK; 125 int version = flags & RESPONSE_INFO_VERSION_MASK;
126 if (version < RESPONSE_INFO_MINIMUM_VERSION || 126 if (version < RESPONSE_INFO_MINIMUM_VERSION ||
127 version > RESPONSE_INFO_VERSION) { 127 version > RESPONSE_INFO_VERSION) {
128 DLOG(ERROR) << "unexpected response info version: " << version; 128 DLOG(ERROR) << "unexpected response info version: " << version;
129 return false; 129 return false;
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 vary_data.Persist(pickle); 269 vary_data.Persist(pickle);
270 270
271 pickle->WriteString(socket_address.host()); 271 pickle->WriteString(socket_address.host());
272 pickle->WriteUInt16(socket_address.port()); 272 pickle->WriteUInt16(socket_address.port());
273 273
274 if (was_npn_negotiated) 274 if (was_npn_negotiated)
275 pickle->WriteString(npn_negotiated_protocol); 275 pickle->WriteString(npn_negotiated_protocol);
276 } 276 }
277 277
278 } // namespace net 278 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_response_headers_unittest.cc ('k') | net/http/http_vary_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698