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

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

Issue 1154283003: Change most uses of Pickle to base::Pickle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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/http/http_response_info_unittest.cc ('k') | net/http/mock_http_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 #include "net/http/http_vary_data.h" 5 #include "net/http/http_vary_data.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include "base/pickle.h" 9 #include "base/pickle.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 processed_header = true; 57 processed_header = true;
58 } 58 }
59 59
60 if (!processed_header) 60 if (!processed_header)
61 return false; 61 return false;
62 62
63 base::MD5Final(&request_digest_, &ctx); 63 base::MD5Final(&request_digest_, &ctx);
64 return is_valid_ = true; 64 return is_valid_ = true;
65 } 65 }
66 66
67 bool HttpVaryData::InitFromPickle(PickleIterator* iter) { 67 bool HttpVaryData::InitFromPickle(base::PickleIterator* iter) {
68 is_valid_ = false; 68 is_valid_ = false;
69 const char* data; 69 const char* data;
70 if (iter->ReadBytes(&data, sizeof(request_digest_))) { 70 if (iter->ReadBytes(&data, sizeof(request_digest_))) {
71 memcpy(&request_digest_, data, sizeof(request_digest_)); 71 memcpy(&request_digest_, data, sizeof(request_digest_));
72 return is_valid_ = true; 72 return is_valid_ = true;
73 } 73 }
74 return false; 74 return false;
75 } 75 }
76 76
77 void HttpVaryData::Persist(Pickle* pickle) const { 77 void HttpVaryData::Persist(base::Pickle* pickle) const {
78 DCHECK(is_valid()); 78 DCHECK(is_valid());
79 pickle->WriteBytes(&request_digest_, sizeof(request_digest_)); 79 pickle->WriteBytes(&request_digest_, sizeof(request_digest_));
80 } 80 }
81 81
82 bool HttpVaryData::MatchesRequest( 82 bool HttpVaryData::MatchesRequest(
83 const HttpRequestInfo& request_info, 83 const HttpRequestInfo& request_info,
84 const HttpResponseHeaders& cached_response_headers) const { 84 const HttpResponseHeaders& cached_response_headers) const {
85 HttpVaryData new_vary_data; 85 HttpVaryData new_vary_data;
86 if (!new_vary_data.Init(request_info, cached_response_headers)) { 86 if (!new_vary_data.Init(request_info, cached_response_headers)) {
87 // This shouldn't happen provided the same response headers passed here 87 // This shouldn't happen provided the same response headers passed here
(...skipping 29 matching lines...) Expand all
117 // Append a character that cannot appear in the request header line so that we 117 // Append a character that cannot appear in the request header line so that we
118 // protect against case where the concatenation of two request headers could 118 // protect against case where the concatenation of two request headers could
119 // look the same for a variety of values for the individual request headers. 119 // look the same for a variety of values for the individual request headers.
120 // For example, "foo: 12\nbar: 3" looks like "foo: 1\nbar: 23" otherwise. 120 // For example, "foo: 12\nbar: 3" looks like "foo: 1\nbar: 23" otherwise.
121 request_value.append(1, '\n'); 121 request_value.append(1, '\n');
122 122
123 base::MD5Update(ctx, request_value); 123 base::MD5Update(ctx, request_value);
124 } 124 }
125 125
126 } // namespace net 126 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_response_info_unittest.cc ('k') | net/http/mock_http_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698