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

Side by Side Diff: content/common/resource_messages.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
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 "content/common/resource_messages.h" 5 #include "content/common/resource_messages.h"
6 6
7 #include "net/base/load_timing_info.h" 7 #include "net/base/load_timing_info.h"
8 #include "net/http/http_response_headers.h" 8 #include "net/http/http_response_headers.h"
9 9
10 namespace IPC { 10 namespace IPC {
11 11
12 void ParamTraits<scoped_refptr<net::HttpResponseHeaders> >::Write( 12 void ParamTraits<scoped_refptr<net::HttpResponseHeaders> >::Write(
13 Message* m, const param_type& p) { 13 Message* m, const param_type& p) {
14 WriteParam(m, p.get() != NULL); 14 WriteParam(m, p.get() != NULL);
15 if (p.get()) { 15 if (p.get()) {
16 // Do not disclose Set-Cookie headers over IPC. 16 // Do not disclose Set-Cookie headers over IPC.
17 p->Persist(m, net::HttpResponseHeaders::PERSIST_SANS_COOKIES); 17 p->Persist(m, net::HttpResponseHeaders::PERSIST_SANS_COOKIES);
18 } 18 }
19 } 19 }
20 20
21 bool ParamTraits<scoped_refptr<net::HttpResponseHeaders> >::Read( 21 bool ParamTraits<scoped_refptr<net::HttpResponseHeaders>>::Read(
22 const Message* m, PickleIterator* iter, param_type* r) { 22 const Message* m,
23 base::PickleIterator* iter,
24 param_type* r) {
23 bool has_object; 25 bool has_object;
24 if (!ReadParam(m, iter, &has_object)) 26 if (!ReadParam(m, iter, &has_object))
25 return false; 27 return false;
26 if (has_object) 28 if (has_object)
27 *r = new net::HttpResponseHeaders(iter); 29 *r = new net::HttpResponseHeaders(iter);
28 return true; 30 return true;
29 } 31 }
30 32
31 void ParamTraits<scoped_refptr<net::HttpResponseHeaders> >::Log( 33 void ParamTraits<scoped_refptr<net::HttpResponseHeaders> >::Log(
32 const param_type& p, std::string* l) { 34 const param_type& p, std::string* l) {
(...skipping 25 matching lines...) Expand all
58 DCHECK(p.type() == storage::DataElement::TYPE_BLOB); 60 DCHECK(p.type() == storage::DataElement::TYPE_BLOB);
59 WriteParam(m, p.blob_uuid()); 61 WriteParam(m, p.blob_uuid());
60 WriteParam(m, p.offset()); 62 WriteParam(m, p.offset());
61 WriteParam(m, p.length()); 63 WriteParam(m, p.length());
62 break; 64 break;
63 } 65 }
64 } 66 }
65 } 67 }
66 68
67 bool ParamTraits<storage::DataElement>::Read(const Message* m, 69 bool ParamTraits<storage::DataElement>::Read(const Message* m,
68 PickleIterator* iter, 70 base::PickleIterator* iter,
69 param_type* r) { 71 param_type* r) {
70 int type; 72 int type;
71 if (!ReadParam(m, iter, &type)) 73 if (!ReadParam(m, iter, &type))
72 return false; 74 return false;
73 switch (type) { 75 switch (type) {
74 case storage::DataElement::TYPE_BYTES: { 76 case storage::DataElement::TYPE_BYTES: {
75 const char* data; 77 const char* data;
76 int len; 78 int len;
77 if (!iter->ReadData(&data, &len)) 79 if (!iter->ReadData(&data, &len))
78 return false; 80 return false;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 if (p.get()) { 141 if (p.get()) {
140 WriteParam(m, p->http_status_code); 142 WriteParam(m, p->http_status_code);
141 WriteParam(m, p->http_status_text); 143 WriteParam(m, p->http_status_text);
142 WriteParam(m, p->request_headers); 144 WriteParam(m, p->request_headers);
143 WriteParam(m, p->response_headers); 145 WriteParam(m, p->response_headers);
144 WriteParam(m, p->request_headers_text); 146 WriteParam(m, p->request_headers_text);
145 WriteParam(m, p->response_headers_text); 147 WriteParam(m, p->response_headers_text);
146 } 148 }
147 } 149 }
148 150
149 bool ParamTraits<scoped_refptr<content::ResourceDevToolsInfo> >::Read( 151 bool ParamTraits<scoped_refptr<content::ResourceDevToolsInfo>>::Read(
150 const Message* m, PickleIterator* iter, param_type* r) { 152 const Message* m,
153 base::PickleIterator* iter,
154 param_type* r) {
151 bool has_object; 155 bool has_object;
152 if (!ReadParam(m, iter, &has_object)) 156 if (!ReadParam(m, iter, &has_object))
153 return false; 157 return false;
154 if (!has_object) 158 if (!has_object)
155 return true; 159 return true;
156 *r = new content::ResourceDevToolsInfo(); 160 *r = new content::ResourceDevToolsInfo();
157 return 161 return
158 ReadParam(m, iter, &(*r)->http_status_code) && 162 ReadParam(m, iter, &(*r)->http_status_code) &&
159 ReadParam(m, iter, &(*r)->http_status_text) && 163 ReadParam(m, iter, &(*r)->http_status_text) &&
160 ReadParam(m, iter, &(*r)->request_headers) && 164 ReadParam(m, iter, &(*r)->request_headers) &&
(...skipping 28 matching lines...) Expand all
189 WriteParam(m, p.connect_timing.dns_end); 193 WriteParam(m, p.connect_timing.dns_end);
190 WriteParam(m, p.connect_timing.connect_start); 194 WriteParam(m, p.connect_timing.connect_start);
191 WriteParam(m, p.connect_timing.connect_end); 195 WriteParam(m, p.connect_timing.connect_end);
192 WriteParam(m, p.connect_timing.ssl_start); 196 WriteParam(m, p.connect_timing.ssl_start);
193 WriteParam(m, p.connect_timing.ssl_end); 197 WriteParam(m, p.connect_timing.ssl_end);
194 WriteParam(m, p.send_start); 198 WriteParam(m, p.send_start);
195 WriteParam(m, p.send_end); 199 WriteParam(m, p.send_end);
196 WriteParam(m, p.receive_headers_end); 200 WriteParam(m, p.receive_headers_end);
197 } 201 }
198 202
199 bool ParamTraits<net::LoadTimingInfo>::Read( 203 bool ParamTraits<net::LoadTimingInfo>::Read(const Message* m,
200 const Message* m, PickleIterator* iter, param_type* r) { 204 base::PickleIterator* iter,
205 param_type* r) {
201 bool has_no_times; 206 bool has_no_times;
202 if (!ReadParam(m, iter, &r->socket_log_id) || 207 if (!ReadParam(m, iter, &r->socket_log_id) ||
203 !ReadParam(m, iter, &r->socket_reused) || 208 !ReadParam(m, iter, &r->socket_reused) ||
204 !ReadParam(m, iter, &has_no_times)) { 209 !ReadParam(m, iter, &has_no_times)) {
205 return false; 210 return false;
206 } 211 }
207 if (has_no_times) 212 if (has_no_times)
208 return true; 213 return true;
209 214
210 return 215 return
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 void ParamTraits<scoped_refptr<content::ResourceRequestBody> >::Write( 266 void ParamTraits<scoped_refptr<content::ResourceRequestBody> >::Write(
262 Message* m, 267 Message* m,
263 const param_type& p) { 268 const param_type& p) {
264 WriteParam(m, p.get() != NULL); 269 WriteParam(m, p.get() != NULL);
265 if (p.get()) { 270 if (p.get()) {
266 WriteParam(m, *p->elements()); 271 WriteParam(m, *p->elements());
267 WriteParam(m, p->identifier()); 272 WriteParam(m, p->identifier());
268 } 273 }
269 } 274 }
270 275
271 bool ParamTraits<scoped_refptr<content::ResourceRequestBody> >::Read( 276 bool ParamTraits<scoped_refptr<content::ResourceRequestBody>>::Read(
272 const Message* m, 277 const Message* m,
273 PickleIterator* iter, 278 base::PickleIterator* iter,
274 param_type* r) { 279 param_type* r) {
275 bool has_object; 280 bool has_object;
276 if (!ReadParam(m, iter, &has_object)) 281 if (!ReadParam(m, iter, &has_object))
277 return false; 282 return false;
278 if (!has_object) 283 if (!has_object)
279 return true; 284 return true;
280 std::vector<storage::DataElement> elements; 285 std::vector<storage::DataElement> elements;
281 if (!ReadParam(m, iter, &elements)) 286 if (!ReadParam(m, iter, &elements))
282 return false; 287 return false;
283 int64 identifier; 288 int64 identifier;
284 if (!ReadParam(m, iter, &identifier)) 289 if (!ReadParam(m, iter, &identifier))
285 return false; 290 return false;
286 *r = new content::ResourceRequestBody; 291 *r = new content::ResourceRequestBody;
287 (*r)->swap_elements(&elements); 292 (*r)->swap_elements(&elements);
288 (*r)->set_identifier(identifier); 293 (*r)->set_identifier(identifier);
289 return true; 294 return true;
290 } 295 }
291 296
292 void ParamTraits<scoped_refptr<content::ResourceRequestBody> >::Log( 297 void ParamTraits<scoped_refptr<content::ResourceRequestBody> >::Log(
293 const param_type& p, std::string* l) { 298 const param_type& p, std::string* l) {
294 l->append("<ResourceRequestBody>"); 299 l->append("<ResourceRequestBody>");
295 } 300 }
296 301
297 } // namespace IPC 302 } // namespace IPC
OLDNEW
« no previous file with comments | « content/common/page_state_serialization_unittest.cc ('k') | content/common/ssl_status_serialization.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698