| OLD | NEW |
| 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 "content/common/mojo/service_registry_impl.h" | 5 #include "content/common/mojo/service_registry_impl.h" |
| 6 | 6 |
| 7 #include "mojo/common/common_type_converters.h" | 7 #include "mojo/common/common_type_converters.h" |
| 8 | 8 |
| 9 namespace content { | 9 namespace content { |
| 10 | 10 |
| 11 ServiceRegistryImpl::ServiceRegistryImpl() | 11 ServiceRegistryImpl::ServiceRegistryImpl() |
| 12 : binding_(this), weak_factory_(this) { | 12 : binding_(this), weak_factory_(this) { |
| 13 binding_.set_error_handler(this); | 13 binding_.set_connection_error_handler( |
| 14 base::Bind(&ServiceRegistryImpl::OnConnectionError, |
| 15 base::Unretained(this))); |
| 14 } | 16 } |
| 15 | 17 |
| 16 ServiceRegistryImpl::~ServiceRegistryImpl() { | 18 ServiceRegistryImpl::~ServiceRegistryImpl() { |
| 17 while (!pending_connects_.empty()) { | 19 while (!pending_connects_.empty()) { |
| 18 mojo::CloseRaw(pending_connects_.front().second); | 20 mojo::CloseRaw(pending_connects_.front().second); |
| 19 pending_connects_.pop(); | 21 pending_connects_.pop(); |
| 20 } | 22 } |
| 21 } | 23 } |
| 22 | 24 |
| 23 void ServiceRegistryImpl::Bind( | 25 void ServiceRegistryImpl::Bind( |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 return; | 79 return; |
| 78 | 80 |
| 79 it->second.Run(client_handle.Pass()); | 81 it->second.Run(client_handle.Pass()); |
| 80 } | 82 } |
| 81 | 83 |
| 82 void ServiceRegistryImpl::OnConnectionError() { | 84 void ServiceRegistryImpl::OnConnectionError() { |
| 83 binding_.Close(); | 85 binding_.Close(); |
| 84 } | 86 } |
| 85 | 87 |
| 86 } // namespace content | 88 } // namespace content |
| OLD | NEW |