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

Side by Side Diff: mojo/public/cpp/bindings/lib/interface_endpoint_client.cc

Issue 2258523003: 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 | mojo/public/cpp/bindings/lib/router.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 "mojo/public/cpp/bindings/interface_endpoint_client.h" 5 #include "mojo/public/cpp/bindings/interface_endpoint_client.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 // We assume ownership of |responder|. 228 // We assume ownership of |responder|.
229 async_responders_[request_id] = base::WrapUnique(responder); 229 async_responders_[request_id] = base::WrapUnique(responder);
230 return true; 230 return true;
231 } 231 }
232 232
233 SyncCallRestrictions::AssertSyncCallAllowed(); 233 SyncCallRestrictions::AssertSyncCallAllowed();
234 234
235 bool response_received = false; 235 bool response_received = false;
236 std::unique_ptr<MessageReceiver> sync_responder(responder); 236 std::unique_ptr<MessageReceiver> sync_responder(responder);
237 sync_responses_.insert(std::make_pair( 237 sync_responses_.insert(std::make_pair(
238 request_id, base::WrapUnique(new SyncResponseInfo(&response_received)))); 238 request_id, base::MakeUnique<SyncResponseInfo>(&response_received)));
239 239
240 base::WeakPtr<InterfaceEndpointClient> weak_self = 240 base::WeakPtr<InterfaceEndpointClient> weak_self =
241 weak_ptr_factory_.GetWeakPtr(); 241 weak_ptr_factory_.GetWeakPtr();
242 controller_->SyncWatch(&response_received); 242 controller_->SyncWatch(&response_received);
243 // Make sure that this instance hasn't been destroyed. 243 // Make sure that this instance hasn't been destroyed.
244 if (weak_self) { 244 if (weak_self) {
245 DCHECK(base::ContainsKey(sync_responses_, request_id)); 245 DCHECK(base::ContainsKey(sync_responses_, request_id));
246 auto iter = sync_responses_.find(request_id); 246 auto iter = sync_responses_.find(request_id);
247 DCHECK_EQ(&response_received, iter->second->response_received); 247 DCHECK_EQ(&response_received, iter->second->response_received);
248 if (response_received) { 248 if (response_received) {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 return responder->Accept(message); 306 return responder->Accept(message);
307 } else { 307 } else {
308 if (!incoming_receiver_) 308 if (!incoming_receiver_)
309 return false; 309 return false;
310 310
311 return incoming_receiver_->Accept(message); 311 return incoming_receiver_->Accept(message);
312 } 312 }
313 } 313 }
314 314
315 } // namespace mojo 315 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | mojo/public/cpp/bindings/lib/router.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698