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

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

Issue 2339933004: [BlobStorage] BlobMemoryController & tests (Closed)
Patch Set: format and hopefully windows fix Created 4 years, 2 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <algorithm> 8 #include <algorithm>
9 9
10 #include "base/numerics/safe_math.h" 10 #include "base/numerics/safe_math.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 request.browser_item_offset = 0; 54 request.browser_item_offset = 0;
55 request.message.request_number = requests->size(); 55 request.message.request_number = requests->size();
56 request.message.transport_strategy = IPCBlobItemRequestStrategy::FILE; 56 request.message.transport_strategy = IPCBlobItemRequestStrategy::FILE;
57 request.message.renderer_item_index = element_index; 57 request.message.renderer_item_index = element_index;
58 request.message.renderer_item_offset = element_offset; 58 request.message.renderer_item_offset = element_offset;
59 request.message.size = size; 59 request.message.size = size;
60 request.message.handle_index = segment_index; 60 request.message.handle_index = segment_index;
61 request.message.handle_offset = segment_offset; 61 request.message.handle_offset = segment_offset;
62 62
63 requests->push_back(request); 63 requests->push_back(request);
64 builder->AppendFutureFile(segment_offset, size); 64 builder->AppendFutureFile(segment_offset, size, segment_index);
65 current_item_index++; 65 current_item_index++;
66 } 66 }
67 67
68 void VisitNonBytesSegment(const DataElement& element, size_t element_index) { 68 void VisitNonBytesSegment(const DataElement& element, size_t element_index) {
69 builder->AppendIPCDataElement(element); 69 builder->AppendIPCDataElement(element);
70 current_item_index++; 70 current_item_index++;
71 } 71 }
72 72
73 void Done() {} 73 void Done() {}
74 74
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 bool has_extra_segment = (total_memory_size % max_segment_size) > 0; 290 bool has_extra_segment = (total_memory_size % max_segment_size) > 0;
291 segment_sizes->reserve(total_max_segments + (has_extra_segment ? 1 : 0)); 291 segment_sizes->reserve(total_max_segments + (has_extra_segment ? 1 : 0));
292 segment_sizes->insert(segment_sizes->begin(), total_max_segments, 292 segment_sizes->insert(segment_sizes->begin(), total_max_segments,
293 max_segment_size); 293 max_segment_size);
294 if (has_extra_segment) { 294 if (has_extra_segment) {
295 segment_sizes->push_back(total_memory_size % max_segment_size); 295 segment_sizes->push_back(total_memory_size % max_segment_size);
296 } 296 }
297 } 297 }
298 298
299 } // namespace storage 299 } // namespace storage
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698