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

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

Issue 1853333003: [BlobAsync] Faster shortcuttin, make renderer controller leaky & alive. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Disabling fast shutdown when transfering blobs 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 #include "storage/browser/blob/blob_async_builder_host.h" 5 #include "storage/browser/blob/blob_async_builder_host.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 return BlobTransportResult::DONE; 89 return BlobTransportResult::DONE;
90 } 90 }
91 91
92 BlobTransportResult BlobAsyncBuilderHost::StartBuildingBlob( 92 BlobTransportResult BlobAsyncBuilderHost::StartBuildingBlob(
93 const std::string& uuid, 93 const std::string& uuid,
94 const std::vector<DataElement>& elements, 94 const std::vector<DataElement>& elements,
95 size_t memory_available, 95 size_t memory_available,
96 BlobStorageContext* context, 96 BlobStorageContext* context,
97 const RequestMemoryCallback& request_memory) { 97 const RequestMemoryCallback& request_memory) {
98 DCHECK(context); 98 DCHECK(context);
99 if (async_blob_map_.find(uuid) == async_blob_map_.end()) {
100 return BlobTransportResult::BAD_IPC;
101 }
102 99
103 // Step 1: Get the sizes. 100 // Step 1: Get the sizes.
104 size_t shortcut_memory_size_bytes = 0; 101 size_t shortcut_memory_size_bytes = 0;
105 uint64_t total_memory_size_bytes = 0; 102 uint64_t total_memory_size_bytes = 0;
106 if (!CalculateBlobMemorySize(elements, &shortcut_memory_size_bytes, 103 if (!CalculateBlobMemorySize(elements, &shortcut_memory_size_bytes,
107 &total_memory_size_bytes)) { 104 &total_memory_size_bytes)) {
108 CancelBuildingBlob(uuid, IPCBlobCreationCancelCode::UNKNOWN, context); 105 CancelBuildingBlob(uuid, IPCBlobCreationCancelCode::UNKNOWN, context);
109 return BlobTransportResult::BAD_IPC; 106 return BlobTransportResult::BAD_IPC;
110 } 107 }
111 108
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 state->num_fulfilled_requests++; 261 state->num_fulfilled_requests++;
265 } 262 }
266 return ContinueBlobMemoryRequests(uuid, context); 263 return ContinueBlobMemoryRequests(uuid, context);
267 } 264 }
268 265
269 void BlobAsyncBuilderHost::CancelBuildingBlob(const std::string& uuid, 266 void BlobAsyncBuilderHost::CancelBuildingBlob(const std::string& uuid,
270 IPCBlobCreationCancelCode code, 267 IPCBlobCreationCancelCode code,
271 BlobStorageContext* context) { 268 BlobStorageContext* context) {
272 DCHECK(context); 269 DCHECK(context);
273 auto state_it = async_blob_map_.find(uuid); 270 auto state_it = async_blob_map_.find(uuid);
274 if (state_it == async_blob_map_.end()) { 271 DCHECK(state_it != async_blob_map_.end());
275 return;
276 }
277 // We can have the blob dereferenced by the renderer, but have it still being 272 // We can have the blob dereferenced by the renderer, but have it still being
278 // 'built'. In this case, it's destructed in the context, but we still have 273 // 'built'. In this case, it's destructed in the context, but we still have
279 // it in our map. Hence we make sure the context has the entry before 274 // it in our map. Hence we make sure the context has the entry before
280 // calling cancel. 275 // calling cancel.
281 if (context->registry().HasEntry(uuid)) 276 if (context->registry().HasEntry(uuid))
282 context->CancelPendingBlob(uuid, code); 277 context->CancelPendingBlob(uuid, code);
283 async_blob_map_.erase(state_it); 278 async_blob_map_.erase(state_it);
284 } 279 }
285 280
286 void BlobAsyncBuilderHost::CancelAll(BlobStorageContext* context) { 281 void BlobAsyncBuilderHost::CancelAll(BlobStorageContext* context) {
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 if (state->num_referenced_blobs_building > 0) { 426 if (state->num_referenced_blobs_building > 0) {
432 // We wait until referenced blobs are done. 427 // We wait until referenced blobs are done.
433 return; 428 return;
434 } 429 }
435 } 430 }
436 context->CompletePendingBlob(state->data_builder); 431 context->CompletePendingBlob(state->data_builder);
437 async_blob_map_.erase(state->data_builder.uuid()); 432 async_blob_map_.erase(state->data_builder.uuid());
438 } 433 }
439 434
440 } // namespace storage 435 } // namespace storage
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698