Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(396)

Unified Diff: storage/browser/blob/blob_data_builder.cc

Issue 895933007: [Storage] Blob items are now shared between blobs. Ready for disk swap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup and added one more histogram Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « storage/browser/blob/blob_data_builder.h ('k') | storage/browser/blob/blob_data_item.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: storage/browser/blob/blob_data_builder.cc
diff --git a/storage/browser/blob/blob_data_builder.cc b/storage/browser/blob/blob_data_builder.cc
index 120bc44bbe492f44289e13411c7832e041802841..38b3923504d4d1283724d31c7ce70926cc1831e0 100644
--- a/storage/browser/blob/blob_data_builder.cc
+++ b/storage/browser/blob/blob_data_builder.cc
@@ -2,7 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <storage/browser/blob/blob_data_builder.h>
+#include "storage/browser/blob/blob_data_builder.h"
+
#include "base/time/time.h"
namespace storage {
@@ -20,8 +21,8 @@ void BlobDataBuilder::AppendData(const char* data, size_t length) {
}
void BlobDataBuilder::AppendFile(const base::FilePath& file_path,
- uint64 offset,
- uint64 length,
+ uint64_t offset,
+ uint64_t length,
const base::Time& expected_modification_time) {
DCHECK(length > 0);
scoped_ptr<DataElement> element(new DataElement());
@@ -32,8 +33,8 @@ void BlobDataBuilder::AppendFile(const base::FilePath& file_path,
void BlobDataBuilder::AppendFile(
const base::FilePath& file_path,
- uint64 offset,
- uint64 length,
+ uint64_t offset,
+ uint64_t length,
const base::Time& expected_modification_time,
scoped_refptr<ShareableFileReference> shareable_file) {
DCHECK(length > 0);
@@ -44,18 +45,24 @@ void BlobDataBuilder::AppendFile(
}
void BlobDataBuilder::AppendBlob(const std::string& uuid,
- uint64 offset,
- uint64 length) {
+ uint64_t offset,
+ uint64_t length) {
DCHECK_GT(length, 0ul);
scoped_ptr<DataElement> element(new DataElement());
element->SetToBlobRange(uuid, offset, length);
items_.push_back(new BlobDataItem(element.Pass()));
}
+void BlobDataBuilder::AppendBlob(const std::string& uuid) {
+ scoped_ptr<DataElement> element(new DataElement());
+ element->SetToBlob(uuid);
+ items_.push_back(new BlobDataItem(element.Pass()));
+}
+
void BlobDataBuilder::AppendFileSystemFile(
const GURL& url,
- uint64 offset,
- uint64 length,
+ uint64_t offset,
+ uint64_t length,
const base::Time& expected_modification_time) {
DCHECK(length > 0);
scoped_ptr<DataElement> element(new DataElement());
@@ -64,19 +71,4 @@ void BlobDataBuilder::AppendFileSystemFile(
items_.push_back(new BlobDataItem(element.Pass()));
}
-size_t BlobDataBuilder::GetMemoryUsage() const {
- int64 memory = 0;
- for (const auto& data_item : items_) {
- if (data_item->type() == DataElement::TYPE_BYTES)
- memory += data_item->length();
- }
- return memory;
-}
-
-scoped_ptr<BlobDataSnapshot> BlobDataBuilder::BuildSnapshot() {
- return scoped_ptr<BlobDataSnapshot>(new BlobDataSnapshot(uuid_, content_type_,
- content_disposition_,
- items_)).Pass();
-}
-
} // namespace storage
« no previous file with comments | « storage/browser/blob/blob_data_builder.h ('k') | storage/browser/blob/blob_data_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698