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

Side by Side Diff: mojo/public/cpp/bindings/lib/router.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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/lib/router.h" 5 #include "mojo/public/cpp/bindings/lib/router.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 // We assume ownership of |responder|. 164 // We assume ownership of |responder|.
165 async_responders_[request_id] = base::WrapUnique(responder); 165 async_responders_[request_id] = base::WrapUnique(responder);
166 return true; 166 return true;
167 } 167 }
168 168
169 SyncCallRestrictions::AssertSyncCallAllowed(); 169 SyncCallRestrictions::AssertSyncCallAllowed();
170 170
171 bool response_received = false; 171 bool response_received = false;
172 std::unique_ptr<MessageReceiver> sync_responder(responder); 172 std::unique_ptr<MessageReceiver> sync_responder(responder);
173 sync_responses_.insert(std::make_pair( 173 sync_responses_.insert(std::make_pair(
174 request_id, base::WrapUnique(new SyncResponseInfo(&response_received)))); 174 request_id, base::MakeUnique<SyncResponseInfo>(&response_received)));
175 175
176 base::WeakPtr<Router> weak_self = weak_factory_.GetWeakPtr(); 176 base::WeakPtr<Router> weak_self = weak_factory_.GetWeakPtr();
177 connector_.SyncWatch(&response_received); 177 connector_.SyncWatch(&response_received);
178 // Make sure that this instance hasn't been destroyed. 178 // Make sure that this instance hasn't been destroyed.
179 if (weak_self) { 179 if (weak_self) {
180 DCHECK(base::ContainsKey(sync_responses_, request_id)); 180 DCHECK(base::ContainsKey(sync_responses_, request_id));
181 auto iter = sync_responses_.find(request_id); 181 auto iter = sync_responses_.find(request_id);
182 DCHECK_EQ(&response_received, iter->second->response_received); 182 DCHECK_EQ(&response_received, iter->second->response_received);
183 if (response_received) { 183 if (response_received) {
184 std::unique_ptr<Message> response = std::move(iter->second->response); 184 std::unique_ptr<Message> response = std::move(iter->second->response);
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 314
315 encountered_error_ = true; 315 encountered_error_ = true;
316 if (!error_handler_.is_null()) 316 if (!error_handler_.is_null())
317 error_handler_.Run(); 317 error_handler_.Run();
318 } 318 }
319 319
320 // ---------------------------------------------------------------------------- 320 // ----------------------------------------------------------------------------
321 321
322 } // namespace internal 322 } // namespace internal
323 } // namespace mojo 323 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/lib/interface_endpoint_client.cc ('k') | mojo/public/cpp/bindings/tests/multiplex_router_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698