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 "storage/browser/blob/blob_url_request_job.h" | 5 #include "storage/browser/blob/blob_url_request_job.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
327 NotifyFailure(net::ERR_FAILED); | 327 NotifyFailure(net::ERR_FAILED); |
328 return false; | 328 return false; |
329 } | 329 } |
330 | 330 |
331 // Compute the bytes to read for current item. | 331 // Compute the bytes to read for current item. |
332 int bytes_to_read = ComputeBytesToRead(); | 332 int bytes_to_read = ComputeBytesToRead(); |
333 | 333 |
334 // If nothing to read for current item, advance to next item. | 334 // If nothing to read for current item, advance to next item. |
335 if (bytes_to_read == 0) { | 335 if (bytes_to_read == 0) { |
336 AdvanceItem(); | 336 AdvanceItem(); |
337 return ReadItem(); | 337 return true; |
michaeln
2015/03/06 22:31:38
nice!
cmumford
2015/03/09 20:05:48
Yeah, that was easy huh?
| |
338 } | 338 } |
339 | 339 |
340 // Do the reading. | 340 // Do the reading. |
341 const BlobDataItem& item = *items.at(current_item_index_); | 341 const BlobDataItem& item = *items.at(current_item_index_); |
342 if (item.type() == DataElement::TYPE_BYTES) | 342 if (item.type() == DataElement::TYPE_BYTES) |
343 return ReadBytesItem(item, bytes_to_read); | 343 return ReadBytesItem(item, bytes_to_read); |
344 if (IsFileType(item.type())) { | 344 if (IsFileType(item.type())) { |
345 return ReadFileItem(GetFileStreamReader(current_item_index_), | 345 return ReadFileItem(GetFileStreamReader(current_item_index_), |
346 bytes_to_read); | 346 bytes_to_read); |
347 } | 347 } |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
601 .release(); | 601 .release(); |
602 break; | 602 break; |
603 default: | 603 default: |
604 NOTREACHED(); | 604 NOTREACHED(); |
605 } | 605 } |
606 DCHECK(reader); | 606 DCHECK(reader); |
607 index_to_reader_[index] = reader; | 607 index_to_reader_[index] = reader; |
608 } | 608 } |
609 | 609 |
610 } // namespace storage | 610 } // namespace storage |
OLD | NEW |