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_data.h" | 5 #include "webkit/blob/blob_data.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 items_.back().SetToFilePathRange(file_path, offset, length, | 29 items_.back().SetToFilePathRange(file_path, offset, length, |
30 expected_modification_time); | 30 expected_modification_time); |
31 } | 31 } |
32 | 32 |
33 void BlobData::AppendBlob(const GURL& blob_url, uint64 offset, uint64 length) { | 33 void BlobData::AppendBlob(const GURL& blob_url, uint64 offset, uint64 length) { |
34 DCHECK(length > 0); | 34 DCHECK(length > 0); |
35 items_.push_back(Item()); | 35 items_.push_back(Item()); |
36 items_.back().SetToBlobUrlRange(blob_url, offset, length); | 36 items_.back().SetToBlobUrlRange(blob_url, offset, length); |
37 } | 37 } |
38 | 38 |
| 39 void BlobData::AppendFileSystemFile( |
| 40 const GURL& url, uint64 offset, |
| 41 uint64 length, |
| 42 const base::Time& expected_modification_time) { |
| 43 DCHECK(length > 0); |
| 44 items_.push_back(Item()); |
| 45 items_.back().SetToFileSystemUrlRange(url, offset, length, |
| 46 expected_modification_time); |
| 47 } |
| 48 |
39 int64 BlobData::GetMemoryUsage() const { | 49 int64 BlobData::GetMemoryUsage() const { |
40 int64 memory = 0; | 50 int64 memory = 0; |
41 for (std::vector<Item>::const_iterator iter = items_.begin(); | 51 for (std::vector<Item>::const_iterator iter = items_.begin(); |
42 iter != items_.end(); ++iter) { | 52 iter != items_.end(); ++iter) { |
43 if (iter->type() == Item::TYPE_BYTES) | 53 if (iter->type() == Item::TYPE_BYTES) |
44 memory += iter->length(); | 54 memory += iter->length(); |
45 } | 55 } |
46 return memory; | 56 return memory; |
47 } | 57 } |
48 | 58 |
49 } // namespace webkit_blob | 59 } // namespace webkit_blob |
OLD | NEW |