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 "content/common/service_manager/child_connection.h" | 5 #include "content/common/service_manager/child_connection.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 std::unique_ptr<service_manager::Connector> connector_; | 108 std::unique_ptr<service_manager::Connector> connector_; |
109 service_manager::Identity child_identity_; | 109 service_manager::Identity child_identity_; |
110 // ServiceManagerConnection in the child monitors the lifetime of this pipe. | 110 // ServiceManagerConnection in the child monitors the lifetime of this pipe. |
111 mojom::ChildPtr child_; | 111 mojom::ChildPtr child_; |
112 service_manager::mojom::PIDReceiverPtr pid_receiver_; | 112 service_manager::mojom::PIDReceiverPtr pid_receiver_; |
113 | 113 |
114 DISALLOW_COPY_AND_ASSIGN(IOThreadContext); | 114 DISALLOW_COPY_AND_ASSIGN(IOThreadContext); |
115 }; | 115 }; |
116 | 116 |
117 ChildConnection::ChildConnection( | 117 ChildConnection::ChildConnection( |
118 const std::string& service_name, | 118 const service_manager::Identity& child_identity, |
119 const std::string& instance_id, | |
120 mojo::edk::PendingProcessConnection* process_connection, | 119 mojo::edk::PendingProcessConnection* process_connection, |
121 service_manager::Connector* connector, | 120 service_manager::Connector* connector, |
122 scoped_refptr<base::SequencedTaskRunner> io_task_runner) | 121 scoped_refptr<base::SequencedTaskRunner> io_task_runner) |
123 : context_(new IOThreadContext), | 122 : context_(new IOThreadContext), |
124 child_identity_(service_name, | 123 child_identity_(child_identity), |
125 service_manager::mojom::kInheritUserID, | |
126 instance_id), | |
127 weak_factory_(this) { | 124 weak_factory_(this) { |
128 context_->Initialize(child_identity_, connector, | 125 context_->Initialize(child_identity_, connector, |
129 process_connection->CreateMessagePipe(&service_token_), | 126 process_connection->CreateMessagePipe(&service_token_), |
130 io_task_runner); | 127 io_task_runner); |
131 } | 128 } |
132 | 129 |
133 ChildConnection::~ChildConnection() { | 130 ChildConnection::~ChildConnection() { |
134 context_->ShutDown(); | 131 context_->ShutDown(); |
135 } | 132 } |
136 | 133 |
137 void ChildConnection::BindInterface( | 134 void ChildConnection::BindInterface( |
138 const std::string& interface_name, | 135 const std::string& interface_name, |
139 mojo::ScopedMessagePipeHandle interface_pipe) { | 136 mojo::ScopedMessagePipeHandle interface_pipe) { |
140 context_->BindInterface(interface_name, std::move(interface_pipe)); | 137 context_->BindInterface(interface_name, std::move(interface_pipe)); |
141 } | 138 } |
142 | 139 |
143 void ChildConnection::SetProcessHandle(base::ProcessHandle handle) { | 140 void ChildConnection::SetProcessHandle(base::ProcessHandle handle) { |
144 process_handle_ = handle; | 141 process_handle_ = handle; |
145 context_->SetProcessHandle(handle); | 142 context_->SetProcessHandle(handle); |
146 } | 143 } |
147 | 144 |
148 } // namespace content | 145 } // namespace content |
OLD | NEW |