OLD | NEW |
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/browser/appcache/appcache_response.h" | 5 #include "content/browser/appcache/appcache_response.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 | 277 |
278 // Also return the size of the response body | 278 // Also return the size of the response body |
279 DCHECK(entry_); | 279 DCHECK(entry_); |
280 info_buffer_->response_data_size = | 280 info_buffer_->response_data_size = |
281 entry_->GetSize(kResponseContentIndex); | 281 entry_->GetSize(kResponseContentIndex); |
282 | 282 |
283 int64_t metadata_size = entry_->GetSize(kResponseMetadataIndex); | 283 int64_t metadata_size = entry_->GetSize(kResponseMetadataIndex); |
284 if (metadata_size > 0) { | 284 if (metadata_size > 0) { |
285 reading_metadata_size_ = metadata_size; | 285 reading_metadata_size_ = metadata_size; |
286 info_buffer_->http_info->metadata = new net::IOBufferWithSize( | 286 info_buffer_->http_info->metadata = new net::IOBufferWithSize( |
287 base::CheckedNumeric<size_t>(metadata_size).ValueOrDie()); | 287 base::checked_cast<size_t>(metadata_size)); |
288 ReadRaw(kResponseMetadataIndex, 0, | 288 ReadRaw(kResponseMetadataIndex, 0, |
289 info_buffer_->http_info->metadata.get(), metadata_size); | 289 info_buffer_->http_info->metadata.get(), metadata_size); |
290 return; | 290 return; |
291 } | 291 } |
292 } else { | 292 } else { |
293 read_position_ += result; | 293 read_position_ += result; |
294 } | 294 } |
295 } | 295 } |
296 InvokeUserCompletionCallback(result); | 296 InvokeUserCompletionCallback(result); |
297 } | 297 } |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 } | 486 } |
487 WriteRaw(kResponseMetadataIndex, 0, buffer_.get(), write_amount_); | 487 WriteRaw(kResponseMetadataIndex, 0, buffer_.get(), write_amount_); |
488 } | 488 } |
489 | 489 |
490 void AppCacheResponseMetadataWriter::OnIOComplete(int result) { | 490 void AppCacheResponseMetadataWriter::OnIOComplete(int result) { |
491 DCHECK(result < 0 || write_amount_ == result); | 491 DCHECK(result < 0 || write_amount_ == result); |
492 InvokeUserCompletionCallback(result); | 492 InvokeUserCompletionCallback(result); |
493 } | 493 } |
494 | 494 |
495 } // namespace content | 495 } // namespace content |
OLD | NEW |