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

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

Issue 2378253002: BlobDispatcherHost: don't rely on NOTREACHED() checks in ParamTraits::Read (Closed)
Patch Set: notreached Created 4 years, 2 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 | « content/browser/blob_storage/blob_dispatcher_host.cc ('k') | no next file » | 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 "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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 int type; 138 int type;
139 if (!ReadParam(m, iter, &type)) 139 if (!ReadParam(m, iter, &type))
140 return false; 140 return false;
141 switch (type) { 141 switch (type) {
142 case storage::DataElement::TYPE_BYTES: { 142 case storage::DataElement::TYPE_BYTES: {
143 const char* data; 143 const char* data;
144 int len; 144 int len;
145 if (!iter->ReadData(&data, &len)) 145 if (!iter->ReadData(&data, &len))
146 return false; 146 return false;
147 r->SetToBytes(data, len); 147 r->SetToBytes(data, len);
148 break; 148 return true;
149 } 149 }
150 case storage::DataElement::TYPE_BYTES_DESCRIPTION: { 150 case storage::DataElement::TYPE_BYTES_DESCRIPTION: {
151 uint64_t length; 151 uint64_t length;
152 if (!ReadParam(m, iter, &length)) 152 if (!ReadParam(m, iter, &length))
153 return false; 153 return false;
154 r->SetToBytesDescription(length); 154 r->SetToBytesDescription(length);
155 break; 155 return true;
156 } 156 }
157 case storage::DataElement::TYPE_FILE: { 157 case storage::DataElement::TYPE_FILE: {
158 base::FilePath file_path; 158 base::FilePath file_path;
159 uint64_t offset, length; 159 uint64_t offset, length;
160 base::Time expected_modification_time; 160 base::Time expected_modification_time;
161 if (!ReadParam(m, iter, &file_path)) 161 if (!ReadParam(m, iter, &file_path))
162 return false; 162 return false;
163 if (!ReadParam(m, iter, &offset)) 163 if (!ReadParam(m, iter, &offset))
164 return false; 164 return false;
165 if (!ReadParam(m, iter, &length)) 165 if (!ReadParam(m, iter, &length))
166 return false; 166 return false;
167 if (!ReadParam(m, iter, &expected_modification_time)) 167 if (!ReadParam(m, iter, &expected_modification_time))
168 return false; 168 return false;
169 r->SetToFilePathRange(file_path, offset, length, 169 r->SetToFilePathRange(file_path, offset, length,
170 expected_modification_time); 170 expected_modification_time);
171 break; 171 return true;
172 } 172 }
173 case storage::DataElement::TYPE_FILE_FILESYSTEM: { 173 case storage::DataElement::TYPE_FILE_FILESYSTEM: {
174 GURL file_system_url; 174 GURL file_system_url;
175 uint64_t offset, length; 175 uint64_t offset, length;
176 base::Time expected_modification_time; 176 base::Time expected_modification_time;
177 if (!ReadParam(m, iter, &file_system_url)) 177 if (!ReadParam(m, iter, &file_system_url))
178 return false; 178 return false;
179 if (!ReadParam(m, iter, &offset)) 179 if (!ReadParam(m, iter, &offset))
180 return false; 180 return false;
181 if (!ReadParam(m, iter, &length)) 181 if (!ReadParam(m, iter, &length))
182 return false; 182 return false;
183 if (!ReadParam(m, iter, &expected_modification_time)) 183 if (!ReadParam(m, iter, &expected_modification_time))
184 return false; 184 return false;
185 r->SetToFileSystemUrlRange(file_system_url, offset, length, 185 r->SetToFileSystemUrlRange(file_system_url, offset, length,
186 expected_modification_time); 186 expected_modification_time);
187 break; 187 return true;
188 } 188 }
189 case storage::DataElement::TYPE_BLOB: { 189 case storage::DataElement::TYPE_BLOB: {
190 std::string blob_uuid; 190 std::string blob_uuid;
191 uint64_t offset, length; 191 uint64_t offset, length;
192 if (!ReadParam(m, iter, &blob_uuid)) 192 if (!ReadParam(m, iter, &blob_uuid))
193 return false; 193 return false;
194 if (!ReadParam(m, iter, &offset)) 194 if (!ReadParam(m, iter, &offset))
195 return false; 195 return false;
196 if (!ReadParam(m, iter, &length)) 196 if (!ReadParam(m, iter, &length))
197 return false; 197 return false;
198 r->SetToBlobRange(blob_uuid, offset, length); 198 r->SetToBlobRange(blob_uuid, offset, length);
199 break; 199 return true;
200 } 200 }
201 case storage::DataElement::TYPE_DISK_CACHE_ENTRY: { 201 case storage::DataElement::TYPE_DISK_CACHE_ENTRY: {
202 NOTREACHED() << "Can't be sent by IPC."; 202 NOTREACHED() << "Can't be sent by IPC.";
203 break; 203 return false;
204 } 204 }
205 case storage::DataElement::TYPE_UNKNOWN: { 205 case storage::DataElement::TYPE_UNKNOWN: {
206 NOTREACHED(); 206 NOTREACHED();
207 break; 207 return false;
208 } 208 }
209 } 209 }
210 return true; 210 return false;
211 } 211 }
212 212
213 void ParamTraits<storage::DataElement>::Log(const param_type& p, 213 void ParamTraits<storage::DataElement>::Log(const param_type& p,
214 std::string* l) { 214 std::string* l) {
215 l->append("<storage::DataElement>"); 215 l->append("<storage::DataElement>");
216 } 216 }
217 217
218 void ParamTraits<scoped_refptr<content::ResourceDevToolsInfo>>::GetSize( 218 void ParamTraits<scoped_refptr<content::ResourceDevToolsInfo>>::GetSize(
219 base::PickleSizer* s, const param_type& p) { 219 base::PickleSizer* s, const param_type& p) {
220 GetParamSize(s, p.get() != NULL); 220 GetParamSize(s, p.get() != NULL);
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 return true; 474 return true;
475 } 475 }
476 476
477 void ParamTraits<scoped_refptr<net::ct::SignedCertificateTimestamp>>::Log( 477 void ParamTraits<scoped_refptr<net::ct::SignedCertificateTimestamp>>::Log(
478 const param_type& p, 478 const param_type& p,
479 std::string* l) { 479 std::string* l) {
480 l->append("<SignedCertificateTimestamp>"); 480 l->append("<SignedCertificateTimestamp>");
481 } 481 }
482 482
483 } // namespace IPC 483 } // namespace IPC
OLDNEW
« no previous file with comments | « content/browser/blob_storage/blob_dispatcher_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698