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

Side by Side Diff: ppapi/proxy/vpn_provider_resource.cc

Issue 2254973004: 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 | « ppapi/proxy/video_encoder_resource.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "ppapi/proxy/vpn_provider_resource.h" 5 #include "ppapi/proxy/vpn_provider_resource.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "ppapi/c/pp_errors.h" 9 #include "ppapi/c/pp_errors.h"
10 #include "ppapi/proxy/dispatch_reply_message.h" 10 #include "ppapi/proxy/dispatch_reply_message.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 params.TakeAllSharedMemoryHandles(&shm_handles); 200 params.TakeAllSharedMemoryHandles(&shm_handles);
201 std::unique_ptr<base::SharedMemory> send_shm( 201 std::unique_ptr<base::SharedMemory> send_shm(
202 new base::SharedMemory(shm_handles[0], false)); 202 new base::SharedMemory(shm_handles[0], false));
203 std::unique_ptr<base::SharedMemory> receive_shm( 203 std::unique_ptr<base::SharedMemory> receive_shm(
204 new base::SharedMemory(shm_handles[1], false)); 204 new base::SharedMemory(shm_handles[1], false));
205 size_t buffer_size = queue_size * max_packet_size; 205 size_t buffer_size = queue_size * max_packet_size;
206 if (!send_shm->Map(buffer_size) || !receive_shm->Map(buffer_size)) { 206 if (!send_shm->Map(buffer_size) || !receive_shm->Map(buffer_size)) {
207 NOTREACHED(); 207 NOTREACHED();
208 return; 208 return;
209 } 209 }
210 send_packet_buffer_ = base::WrapUnique(new ppapi::VpnProviderSharedBuffer( 210 send_packet_buffer_ = base::MakeUnique<ppapi::VpnProviderSharedBuffer>(
211 queue_size, max_packet_size, std::move(send_shm))); 211 queue_size, max_packet_size, std::move(send_shm));
212 recv_packet_buffer_ = base::WrapUnique(new ppapi::VpnProviderSharedBuffer( 212 recv_packet_buffer_ = base::MakeUnique<ppapi::VpnProviderSharedBuffer>(
213 queue_size, max_packet_size, std::move(receive_shm))); 213 queue_size, max_packet_size, std::move(receive_shm));
214 214
215 bound_ = (result == PP_OK); 215 bound_ = (result == PP_OK);
216 } 216 }
217 217
218 scoped_refptr<TrackedCallback> callback; 218 scoped_refptr<TrackedCallback> callback;
219 callback.swap(bind_callback_); 219 callback.swap(bind_callback_);
220 callback->Run(params.result() ? params.result() : result); 220 callback->Run(params.result() ? params.result() : result);
221 } 221 }
222 222
223 void VpnProviderResource::OnPluginMsgSendPacketReply( 223 void VpnProviderResource::OnPluginMsgSendPacketReply(
(...skipping 20 matching lines...) Expand all
244 if (!receive_packet_callback_var_) 244 if (!receive_packet_callback_var_)
245 return; 245 return;
246 246
247 *receive_packet_callback_var_ = received_packets_.front()->GetPPVar(); 247 *receive_packet_callback_var_ = received_packets_.front()->GetPPVar();
248 received_packets_.pop(); 248 received_packets_.pop();
249 receive_packet_callback_var_ = nullptr; 249 receive_packet_callback_var_ = nullptr;
250 } 250 }
251 251
252 } // namespace proxy 252 } // namespace proxy
253 } // namespace ppapi 253 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/video_encoder_resource.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698