| 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/common/blob/blob_data.h" | 5 #include "webkit/common/blob/blob_data.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 void BlobData::AppendFileSystemFile( | 43 void BlobData::AppendFileSystemFile( |
| 44 const GURL& url, uint64 offset, | 44 const GURL& url, uint64 offset, |
| 45 uint64 length, | 45 uint64 length, |
| 46 const base::Time& expected_modification_time) { | 46 const base::Time& expected_modification_time) { |
| 47 DCHECK(length > 0); | 47 DCHECK(length > 0); |
| 48 items_.push_back(Item()); | 48 items_.push_back(Item()); |
| 49 items_.back().SetToFileSystemUrlRange(url, offset, length, | 49 items_.back().SetToFileSystemUrlRange(url, offset, length, |
| 50 expected_modification_time); | 50 expected_modification_time); |
| 51 } | 51 } |
| 52 | 52 |
| 53 #if defined(OS_ANDROID) |
| 54 void BlobData::AppendContentUrlFile( |
| 55 const GURL& url, uint64 offset, uint64 length, |
| 56 const base::Time& expected_modification_time) { |
| 57 DCHECK_GT(length, 0ul); |
| 58 items_.push_back(Item()); |
| 59 items_.back().SetToContentUrlRange(url, offset, length, |
| 60 expected_modification_time); |
| 61 } |
| 62 #endif |
| 63 |
| 53 int64 BlobData::GetMemoryUsage() const { | 64 int64 BlobData::GetMemoryUsage() const { |
| 54 int64 memory = 0; | 65 int64 memory = 0; |
| 55 for (std::vector<Item>::const_iterator iter = items_.begin(); | 66 for (std::vector<Item>::const_iterator iter = items_.begin(); |
| 56 iter != items_.end(); ++iter) { | 67 iter != items_.end(); ++iter) { |
| 57 if (iter->type() == Item::TYPE_BYTES) | 68 if (iter->type() == Item::TYPE_BYTES) |
| 58 memory += iter->length(); | 69 memory += iter->length(); |
| 59 } | 70 } |
| 60 return memory; | 71 return memory; |
| 61 } | 72 } |
| 62 | 73 |
| 63 } // namespace webkit_blob | 74 } // namespace webkit_blob |
| OLD | NEW |