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

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: added shared memory test, and fixed memory leak Created 4 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 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 uint64_t length, 76 uint64_t length,
76 double expected_modification_time); 77 double expected_modification_time);
77 78
78 // These are the resulting consolidated items, constructed from the Add* 79 // These are the resulting consolidated items, constructed from the Add*
79 // methods. This configuration is used to describe the data to the browser, 80 // methods. This configuration is used to describe the data to the browser,
80 // even though one consolidated memory items can contain multiple data parts. 81 // even though one consolidated memory items can contain multiple data parts.
81 const std::vector<ConsolidatedItem>& consolidated_items() const { 82 const std::vector<ConsolidatedItem>& consolidated_items() const {
82 return consolidated_items_; 83 return consolidated_items_;
83 } 84 }
84 85
86 // These are all of the blobs referenced in the construction of this blob.
87 const std::set<std::string> referenced_blobs() const {
88 return referenced_blobs_;
89 }
90
85 size_t total_memory() const { return total_memory_; } 91 size_t total_memory() const { return total_memory_; }
86 92
87 // Reads memory from the given item into the given buffer. Returns: 93 // Reads memory from the given item into the given buffer. Returns:
88 // * ReadStatus::ERROR if the state or arguments are invalid (see error log), 94 // * ReadStatus::ERROR if the state or arguments are invalid (see error log),
89 // * ReadStatus::ERROR_WRONG_TYPE if the item at the index isn't memory, 95 // * ReadStatus::ERROR_WRONG_TYPE if the item at the index isn't memory,
90 // * ReadStatus::ERROR_OUT_OF_BOUNDS if index, offset, or size are invalid, 96 // * ReadStatus::ERROR_OUT_OF_BOUNDS if index, offset, or size are invalid,
91 // * ReadStatus::DONE if the memory has been successfully read. 97 // * ReadStatus::DONE if the memory has been successfully read.
92 // Precondition: memory_out must be a valid pointer to memory with a size of 98 // Precondition: memory_out must be a valid pointer to memory with a size of
93 // at least consolidated_size. 99 // at least consolidated_size.
94 ReadStatus ReadMemory(size_t consolidated_item_index, 100 ReadStatus ReadMemory(size_t consolidated_item_index,
95 size_t consolidated_offset, 101 size_t consolidated_offset,
96 size_t consolidated_size, 102 size_t consolidated_size,
97 void* memory_out); 103 void* memory_out);
98 104
99 private: 105 private:
100 size_t total_memory_; 106 size_t total_memory_;
107 std::set<std::string> referenced_blobs_;
101 std::vector<ConsolidatedItem> consolidated_items_; 108 std::vector<ConsolidatedItem> consolidated_items_;
102 109
103 DISALLOW_COPY_AND_ASSIGN(BlobConsolidation); 110 DISALLOW_COPY_AND_ASSIGN(BlobConsolidation);
104 }; 111 };
105 112
106 } // namespace content 113 } // namespace content
107 #endif // CONTENT_CHILD_BLOB_STORAGE_BLOB_CONSOLIDATION_H_ 114 #endif // CONTENT_CHILD_BLOB_STORAGE_BLOB_CONSOLIDATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698