| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_storage_context.h" | 5 #include "storage/browser/blob/blob_storage_context.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 } | 420 } |
| 421 DCHECK(!item.offset()); | 421 DCHECK(!item.offset()); |
| 422 scoped_ptr<DataElement> element(new DataElement()); | 422 scoped_ptr<DataElement> element(new DataElement()); |
| 423 element->SetToBytes(item.bytes() + offset, | 423 element->SetToBytes(item.bytes() + offset, |
| 424 static_cast<int64>(new_length)); | 424 static_cast<int64>(new_length)); |
| 425 memory_usage_ += new_length; | 425 memory_usage_ += new_length; |
| 426 target_blob_builder->AppendSharedBlobItem(new ShareableBlobDataItem( | 426 target_blob_builder->AppendSharedBlobItem(new ShareableBlobDataItem( |
| 427 target_blob_uuid, new BlobDataItem(element.Pass()))); | 427 target_blob_uuid, new BlobDataItem(element.Pass()))); |
| 428 } break; | 428 } break; |
| 429 case DataElement::TYPE_FILE: { | 429 case DataElement::TYPE_FILE: { |
| 430 DCHECK_NE(item.length(), std::numeric_limits<uint64>::max()) | 430 //DCHECK_NE(item.length(), std::numeric_limits<uint64>::max()) |
| 431 << "We cannot use a section of a file with an unknown length"; | 431 // << "We cannot use a section of a file with an unknown length"; |
| 432 UMA_HISTOGRAM_COUNTS("Storage.BlobItemSize.BlobSlice.File", | 432 UMA_HISTOGRAM_COUNTS("Storage.BlobItemSize.BlobSlice.File", |
| 433 new_length / 1024); | 433 new_length / 1024); |
| 434 scoped_ptr<DataElement> element(new DataElement()); | 434 scoped_ptr<DataElement> element(new DataElement()); |
| 435 element->SetToFilePathRange(item.path(), item.offset() + offset, | 435 element->SetToFilePathRange(item.path(), item.offset() + offset, |
| 436 new_length, | 436 new_length, |
| 437 item.expected_modification_time()); | 437 item.expected_modification_time()); |
| 438 target_blob_builder->AppendSharedBlobItem(new ShareableBlobDataItem( | 438 target_blob_builder->AppendSharedBlobItem(new ShareableBlobDataItem( |
| 439 target_blob_uuid, | 439 target_blob_uuid, |
| 440 new BlobDataItem(element.Pass(), item.file_handle_))); | 440 new BlobDataItem(element.Pass(), item.file_handle_))); |
| 441 } break; | 441 } break; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 467 if (found == blob_map_.end()) | 467 if (found == blob_map_.end()) |
| 468 return false; | 468 return false; |
| 469 return found->second->IsBeingBuilt(); | 469 return found->second->IsBeingBuilt(); |
| 470 } | 470 } |
| 471 | 471 |
| 472 bool BlobStorageContext::IsUrlRegistered(const GURL& blob_url) { | 472 bool BlobStorageContext::IsUrlRegistered(const GURL& blob_url) { |
| 473 return public_blob_urls_.find(blob_url) != public_blob_urls_.end(); | 473 return public_blob_urls_.find(blob_url) != public_blob_urls_.end(); |
| 474 } | 474 } |
| 475 | 475 |
| 476 } // namespace storage | 476 } // namespace storage |
| OLD | NEW |