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

Side by Side Diff: content/common/service_manager/child_connection.cc

Issue 2644843007: Always notify Mojo EDK of incomplete content child process launch (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « content/common/service_manager/child_connection.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 120
121 DISALLOW_COPY_AND_ASSIGN(IOThreadContext); 121 DISALLOW_COPY_AND_ASSIGN(IOThreadContext);
122 }; 122 };
123 123
124 ChildConnection::ChildConnection( 124 ChildConnection::ChildConnection(
125 const std::string& service_name, 125 const std::string& service_name,
126 const std::string& instance_id, 126 const std::string& instance_id,
127 const std::string& child_token, 127 const std::string& child_token,
128 service_manager::Connector* connector, 128 service_manager::Connector* connector,
129 scoped_refptr<base::SequencedTaskRunner> io_task_runner) 129 scoped_refptr<base::SequencedTaskRunner> io_task_runner)
130 : context_(new IOThreadContext), 130 : child_token_(child_token),
131 context_(new IOThreadContext),
131 child_identity_(service_name, 132 child_identity_(service_name,
132 service_manager::mojom::kInheritUserID, 133 service_manager::mojom::kInheritUserID,
133 instance_id), 134 instance_id),
134 service_token_(mojo::edk::GenerateRandomToken()), 135 service_token_(mojo::edk::GenerateRandomToken()),
135 weak_factory_(this) { 136 weak_factory_(this) {
136 mojo::ScopedMessagePipeHandle service_pipe = 137 mojo::ScopedMessagePipeHandle service_pipe =
137 mojo::edk::CreateParentMessagePipe(service_token_, child_token); 138 mojo::edk::CreateParentMessagePipe(service_token_, child_token_);
138 139
139 context_->Initialize(child_identity_, connector, std::move(service_pipe), 140 context_->Initialize(child_identity_, connector, std::move(service_pipe),
140 io_task_runner); 141 io_task_runner);
141 remote_interfaces_.Forward( 142 remote_interfaces_.Forward(
142 base::Bind(&CallBinderOnTaskRunner, 143 base::Bind(&CallBinderOnTaskRunner,
143 base::Bind(&IOThreadContext::GetRemoteInterfaceOnIOThread, 144 base::Bind(&IOThreadContext::GetRemoteInterfaceOnIOThread,
144 context_), io_task_runner)); 145 context_), io_task_runner));
145 } 146 }
146 147
147 ChildConnection::~ChildConnection() { 148 ChildConnection::~ChildConnection() {
148 context_->ShutDown(); 149 context_->ShutDown();
150
151 if (process_handle_ == base::kNullProcessHandle) {
152 // The process handle was never set, so we have to assume the process was
153 // not successfully launched. Note that ChildProcessLauncher may also call
154 // call ChildProcessLaunchFailed for the same token, so this is (harmlessly)
155 // redundant in some cases.
156 mojo::edk::ChildProcessLaunchFailed(child_token_);
157 }
149 } 158 }
150 159
151 void ChildConnection::SetProcessHandle(base::ProcessHandle handle) { 160 void ChildConnection::SetProcessHandle(base::ProcessHandle handle) {
161 process_handle_ = handle;
152 context_->SetProcessHandle(handle); 162 context_->SetProcessHandle(handle);
153 } 163 }
154 164
155 } // namespace content 165 } // namespace content
OLDNEW
« no previous file with comments | « content/common/service_manager/child_connection.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698