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

Side by Side Diff: storage/browser/blob/blob_data_item.h

Issue 2448353002: [BlobAsync] Moving async handling into BlobStorageContext & quota out. (Closed)
Patch Set: hopefully fixed android/windows compile, and comments Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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 #ifndef STORAGE_BROWSER_BLOB_BLOB_DATA_ITEM_H_ 5 #ifndef STORAGE_BROWSER_BLOB_BLOB_DATA_ITEM_H_
6 #define STORAGE_BROWSER_BLOB_BLOB_DATA_ITEM_H_ 6 #define STORAGE_BROWSER_BLOB_BLOB_DATA_ITEM_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <ostream> 11 #include <ostream>
12 #include <string> 12 #include <string>
13 13
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "storage/browser/storage_browser_export.h" 15 #include "storage/browser/storage_browser_export.h"
16 #include "storage/common/data_element.h" 16 #include "storage/common/data_element.h"
17 17
18 namespace disk_cache { 18 namespace disk_cache {
19 class Entry; 19 class Entry;
20 } 20 }
21 21
22 namespace storage { 22 namespace storage {
23 class BlobDataBuilder; 23 class BlobDataBuilder;
24 class BlobMemoryController; 24 class BlobMemoryController;
25 class BlobStorageContext; 25 class BlobStorageContext;
26 class DataElement;
26 27
27 // Ref counted blob item. This class owns the backing data of the blob item. The 28 // Ref counted blob item. This class owns the backing data of the blob item. The
28 // backing data is immutable, and cannot change after creation. The purpose of 29 // backing data is immutable, and cannot change after creation. The purpose of
29 // this class is to allow the resource to stick around in the snapshot even 30 // this class is to allow the resource to stick around in the snapshot even
30 // after the resource was swapped in the blob (either to disk or to memory) by 31 // after the resource was swapped in the blob (either to disk or to memory) by
31 // the BlobStorageContext. 32 // the BlobStorageContext.
32 class STORAGE_EXPORT BlobDataItem : public base::RefCounted<BlobDataItem> { 33 class STORAGE_EXPORT BlobDataItem : public base::RefCounted<BlobDataItem> {
33 public: 34 public:
34 // The DataHandle class is used to persist resources that are needed for 35 // The DataHandle class is used to persist resources that are needed for
35 // reading this BlobDataItem. This object will stay around while any reads are 36 // reading this BlobDataItem. This object will stay around while any reads are
(...skipping 25 matching lines...) Expand all
61 disk_cache::Entry* disk_cache_entry() const { return disk_cache_entry_; } 62 disk_cache::Entry* disk_cache_entry() const { return disk_cache_entry_; }
62 int disk_cache_stream_index() const { return disk_cache_stream_index_; } 63 int disk_cache_stream_index() const { return disk_cache_stream_index_; }
63 int disk_cache_side_stream_index() const { 64 int disk_cache_side_stream_index() const {
64 return disk_cache_side_stream_index_; 65 return disk_cache_side_stream_index_;
65 } 66 }
66 67
67 private: 68 private:
68 friend class BlobDataBuilder; 69 friend class BlobDataBuilder;
69 friend class BlobMemoryController; 70 friend class BlobMemoryController;
70 friend class BlobStorageContext; 71 friend class BlobStorageContext;
72 friend struct BlobSlice;
71 friend class base::RefCounted<BlobDataItem>; 73 friend class base::RefCounted<BlobDataItem>;
72 friend STORAGE_EXPORT void PrintTo(const BlobDataItem& x, ::std::ostream* os); 74 friend STORAGE_EXPORT void PrintTo(const BlobDataItem& x, ::std::ostream* os);
73 75
74 explicit BlobDataItem(std::unique_ptr<DataElement> item); 76 explicit BlobDataItem(std::unique_ptr<DataElement> item);
75 BlobDataItem(std::unique_ptr<DataElement> item, 77 BlobDataItem(std::unique_ptr<DataElement> item,
76 const scoped_refptr<DataHandle>& data_handle); 78 const scoped_refptr<DataHandle>& data_handle);
77 BlobDataItem(std::unique_ptr<DataElement> item, 79 BlobDataItem(std::unique_ptr<DataElement> item,
78 const scoped_refptr<DataHandle>& data_handle, 80 const scoped_refptr<DataHandle>& data_handle,
79 disk_cache::Entry* entry, 81 disk_cache::Entry* entry,
80 int disk_cache_stream_index, 82 int disk_cache_stream_index,
(...skipping 10 matching lines...) Expand all
91 int disk_cache_stream_index_; // For TYPE_DISK_CACHE_ENTRY. 93 int disk_cache_stream_index_; // For TYPE_DISK_CACHE_ENTRY.
92 int disk_cache_side_stream_index_; // For TYPE_DISK_CACHE_ENTRY. 94 int disk_cache_side_stream_index_; // For TYPE_DISK_CACHE_ENTRY.
93 }; 95 };
94 96
95 STORAGE_EXPORT bool operator==(const BlobDataItem& a, const BlobDataItem& b); 97 STORAGE_EXPORT bool operator==(const BlobDataItem& a, const BlobDataItem& b);
96 STORAGE_EXPORT bool operator!=(const BlobDataItem& a, const BlobDataItem& b); 98 STORAGE_EXPORT bool operator!=(const BlobDataItem& a, const BlobDataItem& b);
97 99
98 } // namespace storage 100 } // namespace storage
99 101
100 #endif // STORAGE_BROWSER_BLOB_BLOB_DATA_ITEM_H_ 102 #endif // STORAGE_BROWSER_BLOB_BLOB_DATA_ITEM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698