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

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

Issue 1846363002: [BlobAsync] Adding better error reporting and some new tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed switch statement Created 4 years, 8 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 STORAGE_BROWSER_BLOB_BLOB_ASYNC_BUILDER_HOST_H_ 5 #ifndef STORAGE_BROWSER_BLOB_BLOB_ASYNC_BUILDER_HOST_H_
6 #define STORAGE_BROWSER_BLOB_BLOB_ASYNC_BUILDER_HOST_H_ 6 #define STORAGE_BROWSER_BLOB_BLOB_ASYNC_BUILDER_HOST_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // the blob, or from the DispatcherHost (Renderer). If the blob isn't being 102 // the blob, or from the DispatcherHost (Renderer). If the blob isn't being
103 // built then we do nothing. 103 // built then we do nothing.
104 // Note: if the blob isn't in the context (renderer dereferenced it before we 104 // Note: if the blob isn't in the context (renderer dereferenced it before we
105 // finished constructing), then we don't bother touching the context. 105 // finished constructing), then we don't bother touching the context.
106 void CancelBuildingBlob(const std::string& uuid, 106 void CancelBuildingBlob(const std::string& uuid,
107 IPCBlobCreationCancelCode code, 107 IPCBlobCreationCancelCode code,
108 BlobStorageContext* context); 108 BlobStorageContext* context);
109 109
110 // This clears this object of pending construction. It also handles marking 110 // This clears this object of pending construction. It also handles marking
111 // blobs that haven't been fully constructed as broken in the context if there 111 // blobs that haven't been fully constructed as broken in the context if there
112 // are any references being held by anyone. 112 // are any references being held by anyone. We know that they're being used
113 // by someone else if they still exist in the context.
113 void CancelAll(BlobStorageContext* context); 114 void CancelAll(BlobStorageContext* context);
114 115
115 size_t blob_building_count() const { return async_blob_map_.size(); } 116 size_t blob_building_count() const { return async_blob_map_.size(); }
116 117
117 bool IsBeingBuilt(const std::string& key) const { 118 bool IsBeingBuilt(const std::string& key) const {
118 return async_blob_map_.find(key) != async_blob_map_.end(); 119 return async_blob_map_.find(key) != async_blob_map_.end();
119 } 120 }
120 121
121 // For testing use only. Must be called before StartBuildingBlob. 122 // For testing use only. Must be called before StartBuildingBlob.
122 void SetMemoryConstantsForTesting(size_t max_ipc_memory_size, 123 void SetMemoryConstantsForTesting(size_t max_ipc_memory_size,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 171
171 // This is the 'main loop' of our memory requests to the renderer. 172 // This is the 'main loop' of our memory requests to the renderer.
172 BlobTransportResult ContinueBlobMemoryRequests(const std::string& uuid, 173 BlobTransportResult ContinueBlobMemoryRequests(const std::string& uuid,
173 BlobStorageContext* context); 174 BlobStorageContext* context);
174 175
175 // This is our callback for when we want to finish the blob and we're waiting 176 // This is our callback for when we want to finish the blob and we're waiting
176 // for blobs we reference to be built. When the last callback occurs, we 177 // for blobs we reference to be built. When the last callback occurs, we
177 // complete the blob and erase our internal state. 178 // complete the blob and erase our internal state.
178 void ReferencedBlobFinished(const std::string& uuid, 179 void ReferencedBlobFinished(const std::string& uuid,
179 base::WeakPtr<BlobStorageContext> context, 180 base::WeakPtr<BlobStorageContext> context,
180 bool construction_success); 181 bool construction_success,
182 IPCBlobCreationCancelCode reason);
181 183
182 // This finishes creating the blob in the context, decrements blob references 184 // This finishes creating the blob in the context, decrements blob references
183 // that we were holding during construction, and erases our state. 185 // that we were holding during construction, and erases our state.
184 void FinishBuildingBlob(BlobBuildingState* state, 186 void FinishBuildingBlob(BlobBuildingState* state,
185 BlobStorageContext* context); 187 BlobStorageContext* context);
186 188
187 AsyncBlobMap async_blob_map_; 189 AsyncBlobMap async_blob_map_;
188 190
189 // Here for testing. 191 // Here for testing.
190 size_t max_ipc_memory_size_ = kBlobStorageIPCThresholdBytes; 192 size_t max_ipc_memory_size_ = kBlobStorageIPCThresholdBytes;
191 size_t max_shared_memory_size_ = kBlobStorageMaxSharedMemoryBytes; 193 size_t max_shared_memory_size_ = kBlobStorageMaxSharedMemoryBytes;
192 uint64_t max_file_size_ = kBlobStorageMaxFileSizeBytes; 194 uint64_t max_file_size_ = kBlobStorageMaxFileSizeBytes;
193 195
194 base::WeakPtrFactory<BlobAsyncBuilderHost> ptr_factory_; 196 base::WeakPtrFactory<BlobAsyncBuilderHost> ptr_factory_;
195 197
196 DISALLOW_COPY_AND_ASSIGN(BlobAsyncBuilderHost); 198 DISALLOW_COPY_AND_ASSIGN(BlobAsyncBuilderHost);
197 }; 199 };
198 200
199 } // namespace storage 201 } // namespace storage
200 #endif // STORAGE_BROWSER_BLOB_BLOB_ASYNC_BUILDER_HOST_H_ 202 #endif // STORAGE_BROWSER_BLOB_BLOB_ASYNC_BUILDER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698