| 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 "services/shell/service_manager.h" | 5 #include "services/shell/service_manager.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 pid_ = base::Process::Current().Pid(); | 130 pid_ = base::Process::Current().Pid(); |
| 131 } | 131 } |
| 132 DCHECK_NE(mojom::kInvalidInstanceID, id_); | 132 DCHECK_NE(mojom::kInvalidInstanceID, id_); |
| 133 } | 133 } |
| 134 | 134 |
| 135 ~Instance() override { | 135 ~Instance() override { |
| 136 if (parent_) | 136 if (parent_) |
| 137 parent_->RemoveChild(this); | 137 parent_->RemoveChild(this); |
| 138 // |children_| will be modified during destruction. | 138 // |children_| will be modified during destruction. |
| 139 std::set<Instance*> children = children_; | 139 std::set<Instance*> children = children_; |
| 140 for (auto child : children) | 140 for (auto* child : children) |
| 141 service_manager_->OnInstanceError(child); | 141 service_manager_->OnInstanceError(child); |
| 142 | 142 |
| 143 // Shutdown all bindings before we close the runner. This way the process | 143 // Shutdown all bindings before we close the runner. This way the process |
| 144 // should see the pipes closed and exit, as well as waking up any potential | 144 // should see the pipes closed and exit, as well as waking up any potential |
| 145 // sync/WaitForIncomingResponse(). | 145 // sync/WaitForIncomingResponse(). |
| 146 service_.reset(); | 146 service_.reset(); |
| 147 if (pid_receiver_binding_.is_bound()) | 147 if (pid_receiver_binding_.is_bound()) |
| 148 pid_receiver_binding_.Close(); | 148 pid_receiver_binding_.Close(); |
| 149 connectors_.CloseAllBindings(); | 149 connectors_.CloseAllBindings(); |
| 150 service_manager_bindings_.CloseAllBindings(); | 150 service_manager_bindings_.CloseAllBindings(); |
| (...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 // Now that the instance has a Service, we can connect to it. | 798 // Now that the instance has a Service, we can connect to it. |
| 799 bool connected = instance->ConnectToService(¶ms); | 799 bool connected = instance->ConnectToService(¶ms); |
| 800 DCHECK(connected); | 800 DCHECK(connected); |
| 801 } | 801 } |
| 802 | 802 |
| 803 base::WeakPtr<ServiceManager> ServiceManager::GetWeakPtr() { | 803 base::WeakPtr<ServiceManager> ServiceManager::GetWeakPtr() { |
| 804 return weak_ptr_factory_.GetWeakPtr(); | 804 return weak_ptr_factory_.GetWeakPtr(); |
| 805 } | 805 } |
| 806 | 806 |
| 807 } // namespace shell | 807 } // namespace shell |
| OLD | NEW |