| 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 "webkit/blob/blob_url_request_job.h" | 5 #include "webkit/blob/blob_url_request_job.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/file_util_proxy.h" | 9 #include "base/file_util_proxy.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 } | 232 } |
| 233 | 233 |
| 234 DCHECK_LT(index, blob_data_->items().size()); | 234 DCHECK_LT(index, blob_data_->items().size()); |
| 235 const BlobData::Item& item = blob_data_->items().at(index); | 235 const BlobData::Item& item = blob_data_->items().at(index); |
| 236 DCHECK(item.type == BlobData::TYPE_FILE); | 236 DCHECK(item.type == BlobData::TYPE_FILE); |
| 237 | 237 |
| 238 // If item length is -1, we need to use the file size being resolved | 238 // If item length is -1, we need to use the file size being resolved |
| 239 // in the real time. | 239 // in the real time. |
| 240 int64 item_length = static_cast<int64>(item.length); | 240 int64 item_length = static_cast<int64>(item.length); |
| 241 if (item_length == -1) | 241 if (item_length == -1) |
| 242 item_length = result; | 242 item_length = result - item.offset; |
| 243 | 243 |
| 244 // Cache the size and add it to the total size. | 244 // Cache the size and add it to the total size. |
| 245 DCHECK_LT(index, item_length_list_.size()); | 245 DCHECK_LT(index, item_length_list_.size()); |
| 246 item_length_list_[index] = item_length; | 246 item_length_list_[index] = item_length; |
| 247 total_size_ += item_length; | 247 total_size_ += item_length; |
| 248 | 248 |
| 249 if (--pending_get_file_info_count_ == 0) | 249 if (--pending_get_file_info_count_ == 0) |
| 250 DidCountSize(net::OK); | 250 DidCountSize(net::OK); |
| 251 } | 251 } |
| 252 | 252 |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 file_thread_proxy_, | 530 file_thread_proxy_, |
| 531 item.file_path, | 531 item.file_path, |
| 532 item.offset, | 532 item.offset, |
| 533 item.expected_modification_time); | 533 item.expected_modification_time); |
| 534 } | 534 } |
| 535 DCHECK(index_to_reader_[index]); | 535 DCHECK(index_to_reader_[index]); |
| 536 return index_to_reader_[index]; | 536 return index_to_reader_[index]; |
| 537 } | 537 } |
| 538 | 538 |
| 539 } // namespace webkit_blob | 539 } // namespace webkit_blob |
| OLD | NEW |