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

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

Issue 2230863002: mojo: Use stl utilities from the base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::WrapUnique(new 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(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);
185 ignore_result(sync_responder->Accept(response.get())); 185 ignore_result(sync_responder->Accept(response.get()));
186 } 186 }
187 sync_responses_.erase(iter); 187 sync_responses_.erase(iter);
188 } 188 }
189 189
190 // Return true means that we take ownership of |responder|. 190 // Return true means that we take ownership of |responder|.
(...skipping 123 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/multiplex_router.cc ('k') | mojo/public/cpp/bindings/lib/sync_handle_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698