OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef STORAGE_BROWSER_BLOB_BLOB_SLICE_H_ |
| 6 #define STORAGE_BROWSER_BLOB_BLOB_SLICE_H_ |
| 7 |
| 8 #include <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
| 11 #include <string> |
| 12 #include <vector> |
| 13 |
| 14 #include "base/macros.h" |
| 15 #include "base/memory/ref_counted.h" |
| 16 #include "storage/browser/storage_browser_export.h" |
| 17 |
| 18 namespace storage { |
| 19 class InternalBlobData; |
| 20 class ShareableBlobDataItem; |
| 21 |
| 22 // Here we try to handle the cases where the slice partially intersects with |
| 23 // either a data item (which we want to copy instead of share when it's partial |
| 24 // intersection) or a 'future file item', which isn't populated yet in the |
| 25 // source blob so we need to copy it over later when it's completed. |
| 26 struct STORAGE_EXPORT BlobSlice { |
| 27 BlobSlice(const InternalBlobData& source, |
| 28 uint64_t slice_offset, |
| 29 uint64_t slice_size); |
| 30 ~BlobSlice(); |
| 31 |
| 32 // The is the amount of memory we'll be copying from the source blob, as we |
| 33 // can't share a partial data item. This can happen on the first and/or last |
| 34 // item our slice is intersecting. |
| 35 size_t copying_memory_size = 0; |
| 36 |
| 37 size_t first_item_slice_offset = 0; |
| 38 // Populated if our first slice item is a temporary item that we'll copy to |
| 39 // later from this |first_source_item|, at offset |first_item_slice_offset|. |
| 40 scoped_refptr<ShareableBlobDataItem> first_source_item; |
| 41 // Populated if our last slice item is a temporary item that we'll copy to |
| 42 // later from this |last_source_item|. |
| 43 scoped_refptr<ShareableBlobDataItem> last_source_item; |
| 44 |
| 45 std::vector<scoped_refptr<ShareableBlobDataItem>> dest_items; |
| 46 }; |
| 47 |
| 48 } // namespace storage |
| 49 #endif // STORAGE_BROWSER_BLOB_BLOB_SLICE_H_ |
OLD | NEW |