Chromium Code Reviews| 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 "webkit/browser/blob/blob_storage_context.h" | 5 #include "webkit/browser/blob/blob_storage_context.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 136 // list of Data, File, and FileSystem items. Aggregated TYPE_BLOB items | 136 // list of Data, File, and FileSystem items. Aggregated TYPE_BLOB items |
| 137 // are expanded into the primitive constituent types. | 137 // are expanded into the primitive constituent types. |
| 138 // 1) The Data item is denoted by the raw data and length. | 138 // 1) The Data item is denoted by the raw data and length. |
| 139 // 2) The File item is denoted by the file path, the range and the expected | 139 // 2) The File item is denoted by the file path, the range and the expected |
| 140 // modification time. | 140 // modification time. |
| 141 // 3) The FileSystem File item is denoted by the FileSystem URL, the range | 141 // 3) The FileSystem File item is denoted by the FileSystem URL, the range |
| 142 // and the expected modification time. | 142 // and the expected modification time. |
| 143 // 4) The Blob items are expanded. | 143 // 4) The Blob items are expanded. |
| 144 // TODO(michaeln): Would be nice to avoid copying Data items when expanding. | 144 // TODO(michaeln): Would be nice to avoid copying Data items when expanding. |
| 145 | 145 |
| 146 DCHECK(item.length() > 0); | |
|
michaeln
2014/07/31 19:31:22
These DCHECK's are here because higher level logic
| |
| 147 switch (item.type()) { | 146 switch (item.type()) { |
| 148 case BlobData::Item::TYPE_BYTES: | 147 case BlobData::Item::TYPE_BYTES: |
| 149 DCHECK(!item.offset()); | 148 DCHECK(!item.offset()); |
| 150 exceeded_memory = !AppendBytesItem(target_blob_data, | 149 exceeded_memory = !AppendBytesItem(target_blob_data, |
| 151 item.bytes(), | 150 item.bytes(), |
| 152 static_cast<int64>(item.length())); | 151 static_cast<int64>(item.length())); |
| 153 break; | 152 break; |
| 154 case BlobData::Item::TYPE_FILE: | 153 case BlobData::Item::TYPE_FILE: |
| 155 AppendFileItem(target_blob_data, | 154 AppendFileItem(target_blob_data, |
| 156 item.path(), | 155 item.path(), |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 316 if (found == blob_map_.end()) | 315 if (found == blob_map_.end()) |
| 317 return false; | 316 return false; |
| 318 return found->second.flags & BEING_BUILT; | 317 return found->second.flags & BEING_BUILT; |
| 319 } | 318 } |
| 320 | 319 |
| 321 bool BlobStorageContext::IsUrlRegistered(const GURL& blob_url) { | 320 bool BlobStorageContext::IsUrlRegistered(const GURL& blob_url) { |
| 322 return public_blob_urls_.find(blob_url) != public_blob_urls_.end(); | 321 return public_blob_urls_.find(blob_url) != public_blob_urls_.end(); |
| 323 } | 322 } |
| 324 | 323 |
| 325 } // namespace webkit_blob | 324 } // namespace webkit_blob |
| OLD | NEW |