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

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

Issue 2254183002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « no previous file | storage/browser/fileapi/isolated_file_system_backend.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 std::unique_ptr<BlobDataHandle> handle = 101 std::unique_ptr<BlobDataHandle> handle =
102 context->GetBlobDataFromUUID(referenced_uuid); 102 context->GetBlobDataFromUUID(referenced_uuid);
103 if (!handle || handle->IsBroken()) { 103 if (!handle || handle->IsBroken()) {
104 // We cancel the blob right away, and don't bother storing our state. 104 // We cancel the blob right away, and don't bother storing our state.
105 context->CancelPendingBlob( 105 context->CancelPendingBlob(
106 uuid, IPCBlobCreationCancelCode::REFERENCED_BLOB_BROKEN); 106 uuid, IPCBlobCreationCancelCode::REFERENCED_BLOB_BROKEN);
107 return BlobTransportResult::CANCEL_REFERENCED_BLOB_BROKEN; 107 return BlobTransportResult::CANCEL_REFERENCED_BLOB_BROKEN;
108 } 108 }
109 handles.emplace_back(std::move(handle)); 109 handles.emplace_back(std::move(handle));
110 } 110 }
111 async_blob_map_[uuid] = base::WrapUnique( 111 async_blob_map_[uuid] = base::MakeUnique<BlobBuildingState>(
112 new BlobBuildingState(uuid, referenced_blob_uuids, &handles)); 112 uuid, referenced_blob_uuids, &handles);
113 return BlobTransportResult::DONE; 113 return BlobTransportResult::DONE;
114 } 114 }
115 115
116 BlobTransportResult BlobAsyncBuilderHost::StartBuildingBlob( 116 BlobTransportResult BlobAsyncBuilderHost::StartBuildingBlob(
117 const std::string& uuid, 117 const std::string& uuid,
118 const std::vector<DataElement>& elements, 118 const std::vector<DataElement>& elements,
119 size_t memory_available, 119 size_t memory_available,
120 BlobStorageContext* context, 120 BlobStorageContext* context,
121 const RequestMemoryCallback& request_memory) { 121 const RequestMemoryCallback& request_memory) {
122 DCHECK(context); 122 DCHECK(context);
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 break; 397 break;
398 } 398 }
399 if (stop_accumulating) { 399 if (stop_accumulating) {
400 break; 400 break;
401 } 401 }
402 } 402 }
403 DCHECK(!requests.empty()); 403 DCHECK(!requests.empty());
404 404
405 state->request_memory_callback.Run( 405 state->request_memory_callback.Run(
406 std::move(byte_requests), std::move(shared_memory), 406 std::move(byte_requests), std::move(shared_memory),
407 base::WrapUnique(new std::vector<base::File>())); 407 base::MakeUnique<std::vector<base::File>>());
408 return BlobTransportResult::PENDING_RESPONSES; 408 return BlobTransportResult::PENDING_RESPONSES;
409 } 409 }
410 410
411 void BlobAsyncBuilderHost::ReferencedBlobFinished( 411 void BlobAsyncBuilderHost::ReferencedBlobFinished(
412 const std::string& owning_blob_uuid, 412 const std::string& owning_blob_uuid,
413 base::WeakPtr<BlobStorageContext> context, 413 base::WeakPtr<BlobStorageContext> context,
414 bool construction_success, 414 bool construction_success,
415 IPCBlobCreationCancelCode reason) { 415 IPCBlobCreationCancelCode reason) {
416 if (!context) { 416 if (!context) {
417 return; 417 return;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 if (state->num_referenced_blobs_building > 0) { 456 if (state->num_referenced_blobs_building > 0) {
457 // We wait until referenced blobs are done. 457 // We wait until referenced blobs are done.
458 return; 458 return;
459 } 459 }
460 } 460 }
461 context->CompletePendingBlob(state->data_builder); 461 context->CompletePendingBlob(state->data_builder);
462 async_blob_map_.erase(state->data_builder.uuid()); 462 async_blob_map_.erase(state->data_builder.uuid());
463 } 463 }
464 464
465 } // namespace storage 465 } // namespace storage
OLDNEW
« no previous file with comments | « no previous file | storage/browser/fileapi/isolated_file_system_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698