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

Side by Side Diff: content/child/blob_storage/blob_consolidation.h

Issue 1234813004: [BlobAsync] Asynchronous Blob Construction Final Patch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@blob-protocol-change
Patch Set: comments Created 4 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 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 CONTENT_CHILD_BLOB_STORAGE_BLOB_CONSOLIDATION_H_ 5 #ifndef CONTENT_CHILD_BLOB_STORAGE_BLOB_CONSOLIDATION_H_
6 #define CONTENT_CHILD_BLOB_STORAGE_BLOB_CONSOLIDATION_H_ 6 #define CONTENT_CHILD_BLOB_STORAGE_BLOB_CONSOLIDATION_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <set>
11 #include <string> 12 #include <string>
12 #include <vector> 13 #include <vector>
13 14
14 #include "base/logging.h" 15 #include "base/logging.h"
15 #include "base/macros.h" 16 #include "base/macros.h"
16 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
17 #include "content/common/content_export.h" 18 #include "content/common/content_export.h"
18 #include "storage/common/data_element.h" 19 #include "storage/common/data_element.h"
19 #include "third_party/WebKit/public/platform/WebThreadSafeData.h" 20 #include "third_party/WebKit/public/platform/WebThreadSafeData.h"
20 21
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 uint64_t length, 77 uint64_t length,
77 double expected_modification_time); 78 double expected_modification_time);
78 79
79 // These are the resulting consolidated items, constructed from the Add* 80 // These are the resulting consolidated items, constructed from the Add*
80 // methods. This configuration is used to describe the data to the browser, 81 // methods. This configuration is used to describe the data to the browser,
81 // even though one consolidated memory items can contain multiple data parts. 82 // even though one consolidated memory items can contain multiple data parts.
82 const std::vector<ConsolidatedItem>& consolidated_items() const { 83 const std::vector<ConsolidatedItem>& consolidated_items() const {
83 return consolidated_items_; 84 return consolidated_items_;
84 } 85 }
85 86
87 // These are all of the blobs referenced in the construction of this blob.
88 const std::set<std::string> referenced_blobs() const {
89 return referenced_blobs_;
90 }
91
86 size_t total_memory() const { return total_memory_; } 92 size_t total_memory() const { return total_memory_; }
87 93
88 // Reads memory from the given item into the given buffer. Returns: 94 // Reads memory from the given item into the given buffer. Returns:
89 // * ReadStatus::ERROR if the state or arguments are invalid (see error log), 95 // * ReadStatus::ERROR if the state or arguments are invalid (see error log),
90 // * ReadStatus::ERROR_WRONG_TYPE if the item at the index isn't memory, 96 // * ReadStatus::ERROR_WRONG_TYPE if the item at the index isn't memory,
91 // * ReadStatus::ERROR_OUT_OF_BOUNDS if index, offset, or size are invalid, 97 // * ReadStatus::ERROR_OUT_OF_BOUNDS if index, offset, or size are invalid,
92 // * ReadStatus::DONE if the memory has been successfully read. 98 // * ReadStatus::DONE if the memory has been successfully read.
93 // Precondition: memory_out must be a valid pointer to memory with a size of 99 // Precondition: memory_out must be a valid pointer to memory with a size of
94 // at least consolidated_size. 100 // at least consolidated_size.
95 ReadStatus ReadMemory(size_t consolidated_item_index, 101 ReadStatus ReadMemory(size_t consolidated_item_index,
96 size_t consolidated_offset, 102 size_t consolidated_offset,
97 size_t consolidated_size, 103 size_t consolidated_size,
98 void* memory_out); 104 void* memory_out);
99 105
100 private: 106 private:
101 size_t total_memory_; 107 size_t total_memory_;
108 std::set<std::string> referenced_blobs_;
102 std::vector<ConsolidatedItem> consolidated_items_; 109 std::vector<ConsolidatedItem> consolidated_items_;
103 110
104 DISALLOW_COPY_AND_ASSIGN(BlobConsolidation); 111 DISALLOW_COPY_AND_ASSIGN(BlobConsolidation);
105 }; 112 };
106 113
107 } // namespace content 114 } // namespace content
108 #endif // CONTENT_CHILD_BLOB_STORAGE_BLOB_CONSOLIDATION_H_ 115 #endif // CONTENT_CHILD_BLOB_STORAGE_BLOB_CONSOLIDATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698