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

Unified Diff: storage/browser/blob/blob_slice.h

Issue 2055053003: [BlobAsync] Disk support for blob storage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added back transport controller test, small cleanups Created 4 years, 6 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
Index: storage/browser/blob/blob_slice.h
diff --git a/storage/browser/blob/blob_slice.h b/storage/browser/blob/blob_slice.h
new file mode 100644
index 0000000000000000000000000000000000000000..33076f3826fba451f22a2ef095a19dd1753a4295
--- /dev/null
+++ b/storage/browser/blob/blob_slice.h
@@ -0,0 +1,69 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef STORAGE_BROWSER_BLOB_BLOB_SLICE_H_
+#define STORAGE_BROWSER_BLOB_BLOB_SLICE_H_
+
+#include <stddef.h>
+
+#include <string>
+#include <vector>
+
+#include "base/macros.h"
+#include "storage/browser/blob/internal_blob_data.h"
+#include "storage/browser/blob/shareable_blob_data_item.h"
+
+namespace storage {
+
+class BlobSlice {
+ public:
+ BlobSlice();
+ BlobSlice(const InternalBlobData& source,
+ uint64_t offset,
+ uint64_t size,
+ bool done_building);
+ BlobSlice(BlobSlice&&);
+ ~BlobSlice();
+
+ bool done_building() { return done_building_; }
+
+ size_t copying_memory_size() { return copying_memory_size_; }
+
+ // If our first item is a new memory item, where we are a slice of the item
+ // in the original blob. See first_item_slice_offset() and first_item_index().
+ bool has_sliced_first_memory_item() { return has_sliced_first_memory_item_; }
michaeln 2016/07/07 20:05:21 the names of these members confused me at first, t
+ // If our last item is a new memory item, where we are a slice of the item
+ // in the original blob.
+ bool has_sliced_last_memory_item() { return has_sliced_last_memory_item_; }
+
+ size_t first_item_slice_offset() { return first_item_slice_offset_; }
+ size_t first_item_index() { return first_item_index_; }
+ size_t last_item_index() { return last_item_index_; }
+
+ const std::vector<scoped_refptr<ShareableBlobDataItem>>& items() {
+ return items_;
+ }
+
+ private:
+ void BinarySearch(const InternalBlobData& source_blob,
+ uint64_t blob_offset,
+ size_t* item_index,
+ uint64_t* offset_in_item);
+
+ size_t copying_memory_size_ = 0;
+ bool done_building_ = true;
+
+ bool has_sliced_first_memory_item_ = false;
+ bool has_sliced_last_memory_item_ = false;
+ size_t first_item_slice_offset_ = 0;
+ size_t first_item_index_ = 0;
+ size_t last_item_index_ = 0;
+
+ std::vector<scoped_refptr<ShareableBlobDataItem>> items_;
+
+ DISALLOW_COPY_AND_ASSIGN(BlobSlice);
+};
+
+} // namespace storage
+#endif // STORAGE_BROWSER_BLOB_BLOB_SLICE_H_

Powered by Google App Engine
This is Rietveld 408576698