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

Side by Side Diff: content/common/resource_messages.cc

Issue 1108083002: Create blobs from Disk Cache entries. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: first pass michaeln remediation... 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 {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 WriteParam(m, p.expected_modification_time()); 49 WriteParam(m, p.expected_modification_time());
50 break; 50 break;
51 } 51 }
52 case storage::DataElement::TYPE_FILE_FILESYSTEM: { 52 case storage::DataElement::TYPE_FILE_FILESYSTEM: {
53 WriteParam(m, p.filesystem_url()); 53 WriteParam(m, p.filesystem_url());
54 WriteParam(m, p.offset()); 54 WriteParam(m, p.offset());
55 WriteParam(m, p.length()); 55 WriteParam(m, p.length());
56 WriteParam(m, p.expected_modification_time()); 56 WriteParam(m, p.expected_modification_time());
57 break; 57 break;
58 } 58 }
59 default: { 59 case storage::DataElement::TYPE_BLOB: {
60 DCHECK(p.type() == storage::DataElement::TYPE_BLOB);
61 WriteParam(m, p.blob_uuid()); 60 WriteParam(m, p.blob_uuid());
62 WriteParam(m, p.offset()); 61 WriteParam(m, p.offset());
63 WriteParam(m, p.length()); 62 WriteParam(m, p.length());
64 break; 63 break;
65 } 64 }
65 case storage::DataElement::TYPE_DISK_CACHE_ENTRY: // Can't be sent via IPC.
66 NOTREACHED();
67 break;
68 case storage::DataElement::TYPE_UNKNOWN:
69 NOTREACHED();
70 break;
66 } 71 }
67 } 72 }
68 73
69 bool ParamTraits<storage::DataElement>::Read(const Message* m, 74 bool ParamTraits<storage::DataElement>::Read(const Message* m,
70 base::PickleIterator* iter, 75 base::PickleIterator* iter,
71 param_type* r) { 76 param_type* r) {
72 int type; 77 int type;
73 if (!ReadParam(m, iter, &type)) 78 if (!ReadParam(m, iter, &type))
74 return false; 79 return false;
75 switch (type) { 80 switch (type) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 return false; 112 return false;
108 if (!ReadParam(m, iter, &length)) 113 if (!ReadParam(m, iter, &length))
109 return false; 114 return false;
110 if (!ReadParam(m, iter, &expected_modification_time)) 115 if (!ReadParam(m, iter, &expected_modification_time))
111 return false; 116 return false;
112 r->SetToFileSystemUrlRange(file_system_url, offset, length, 117 r->SetToFileSystemUrlRange(file_system_url, offset, length,
113 expected_modification_time); 118 expected_modification_time);
114 break; 119 break;
115 } 120 }
116 default: { 121 default: {
117 DCHECK(type == storage::DataElement::TYPE_BLOB); 122 DCHECK(type == storage::DataElement::TYPE_BLOB);
Tom Sepez 2015/06/15 15:53:06 You should handle the other types in this switch,
gavinp 2015/06/15 20:10:59 See mmenke and me's comment in your review of anot
118 std::string blob_uuid; 123 std::string blob_uuid;
119 uint64 offset, length; 124 uint64 offset, length;
120 if (!ReadParam(m, iter, &blob_uuid)) 125 if (!ReadParam(m, iter, &blob_uuid))
121 return false; 126 return false;
122 if (!ReadParam(m, iter, &offset)) 127 if (!ReadParam(m, iter, &offset))
123 return false; 128 return false;
124 if (!ReadParam(m, iter, &length)) 129 if (!ReadParam(m, iter, &length))
125 return false; 130 return false;
126 r->SetToBlobRange(blob_uuid, offset, length); 131 r->SetToBlobRange(blob_uuid, offset, length);
127 break; 132 break;
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 (*r)->set_identifier(identifier); 298 (*r)->set_identifier(identifier);
294 return true; 299 return true;
295 } 300 }
296 301
297 void ParamTraits<scoped_refptr<content::ResourceRequestBody> >::Log( 302 void ParamTraits<scoped_refptr<content::ResourceRequestBody> >::Log(
298 const param_type& p, std::string* l) { 303 const param_type& p, std::string* l) {
299 l->append("<ResourceRequestBody>"); 304 l->append("<ResourceRequestBody>");
300 } 305 }
301 306
302 } // namespace IPC 307 } // namespace IPC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698