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/shared_memory_received_data_factory.cc

Issue 2254173002: 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
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 "content/child/shared_memory_received_data_factory.h" 5 #include "content/child/shared_memory_received_data_factory.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 std::unique_ptr<RequestPeer::ReceivedData> 69 std::unique_ptr<RequestPeer::ReceivedData>
70 SharedMemoryReceivedDataFactory::Create(int offset, 70 SharedMemoryReceivedDataFactory::Create(int offset,
71 int length, 71 int length,
72 int encoded_data_length, 72 int encoded_data_length,
73 int encoded_body_length) { 73 int encoded_body_length) {
74 const char* start = static_cast<char*>(memory_->memory()); 74 const char* start = static_cast<char*>(memory_->memory());
75 const char* payload = start + offset; 75 const char* payload = start + offset;
76 TicketId id = id_++; 76 TicketId id = id_++;
77 77
78 return base::WrapUnique(new SharedMemoryReceivedData( 78 return base::MakeUnique<SharedMemoryReceivedData>(
79 payload, length, encoded_data_length, encoded_body_length, this, id)); 79 payload, length, encoded_data_length, encoded_body_length, this, id);
80 } 80 }
81 81
82 void SharedMemoryReceivedDataFactory::Stop() { 82 void SharedMemoryReceivedDataFactory::Stop() {
83 is_stopped_ = true; 83 is_stopped_ = true;
84 released_tickets_.clear(); 84 released_tickets_.clear();
85 message_sender_ = nullptr; 85 message_sender_ = nullptr;
86 } 86 }
87 87
88 class SharedMemoryReceivedDataFactory::TicketComparator final { 88 class SharedMemoryReceivedDataFactory::TicketComparator final {
89 public: 89 public:
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 SendAck(count); 129 SendAck(count);
130 } 130 }
131 131
132 void SharedMemoryReceivedDataFactory::SendAck(size_t count) { 132 void SharedMemoryReceivedDataFactory::SendAck(size_t count) {
133 for (size_t i = 0; i < count; ++i) { 133 for (size_t i = 0; i < count; ++i) {
134 message_sender_->Send(new ResourceHostMsg_DataReceived_ACK(request_id_)); 134 message_sender_->Send(new ResourceHostMsg_DataReceived_ACK(request_id_));
135 } 135 }
136 } 136 }
137 137
138 } // namespace content 138 } // namespace content
OLDNEW
« no previous file with comments | « content/child/shared_memory_data_consumer_handle_unittest.cc ('k') | content/child/url_response_body_consumer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698