| 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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 // 3) The FileSystem File item is denoted by the FileSystem URL, the range | 302 // 3) The FileSystem File item is denoted by the FileSystem URL, the range |
| 303 // and the expected modification time. | 303 // and the expected modification time. |
| 304 // 4) The Blob item is denoted by the source blob and an offset and size. | 304 // 4) The Blob item is denoted by the source blob and an offset and size. |
| 305 // Internal items that are fully used by the new blob (not cut by the | 305 // Internal items that are fully used by the new blob (not cut by the |
| 306 // offset or size) are shared between the blobs. Otherwise, the relevant | 306 // offset or size) are shared between the blobs. Otherwise, the relevant |
| 307 // portion of the item is copied. | 307 // portion of the item is copied. |
| 308 | 308 |
| 309 const DataElement& data_element = blob_item->data_element(); | 309 const DataElement& data_element = blob_item->data_element(); |
| 310 uint64 length = data_element.length(); | 310 uint64 length = data_element.length(); |
| 311 uint64 offset = data_element.offset(); | 311 uint64 offset = data_element.offset(); |
| 312 DCHECK_GT(length, 0u); | |
| 313 UMA_HISTOGRAM_COUNTS("Storage.Blob.StorageSizeBeforeAppend", | 312 UMA_HISTOGRAM_COUNTS("Storage.Blob.StorageSizeBeforeAppend", |
| 314 memory_usage_ / 1024); | 313 memory_usage_ / 1024); |
| 315 switch (data_element.type()) { | 314 switch (data_element.type()) { |
| 316 case DataElement::TYPE_BYTES: | 315 case DataElement::TYPE_BYTES: |
| 317 UMA_HISTOGRAM_COUNTS("Storage.BlobItemSize.Bytes", length / 1024); | 316 UMA_HISTOGRAM_COUNTS("Storage.BlobItemSize.Bytes", length / 1024); |
| 318 DCHECK(!offset); | 317 DCHECK(!offset); |
| 319 if (memory_usage_ + length > kMaxMemoryUsage) { | 318 if (memory_usage_ + length > kMaxMemoryUsage) { |
| 320 exceeded_memory = true; | 319 exceeded_memory = true; |
| 321 break; | 320 break; |
| 322 } | 321 } |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 if (found == blob_map_.end()) | 466 if (found == blob_map_.end()) |
| 468 return false; | 467 return false; |
| 469 return found->second->IsBeingBuilt(); | 468 return found->second->IsBeingBuilt(); |
| 470 } | 469 } |
| 471 | 470 |
| 472 bool BlobStorageContext::IsUrlRegistered(const GURL& blob_url) { | 471 bool BlobStorageContext::IsUrlRegistered(const GURL& blob_url) { |
| 473 return public_blob_urls_.find(blob_url) != public_blob_urls_.end(); | 472 return public_blob_urls_.find(blob_url) != public_blob_urls_.end(); |
| 474 } | 473 } |
| 475 | 474 |
| 476 } // namespace storage | 475 } // namespace storage |
| OLD | NEW |