| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |