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

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

Issue 2645713004: 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 119
120 DISALLOW_COPY_AND_ASSIGN(IOThreadContext); 120 DISALLOW_COPY_AND_ASSIGN(IOThreadContext);
121 }; 121 };
122 122
123 ChildConnection::ChildConnection( 123 ChildConnection::ChildConnection(
124 const std::string& service_name, 124 const std::string& service_name,
125 const std::string& instance_id, 125 const std::string& instance_id,
126 const std::string& child_token, 126 const std::string& child_token,
127 service_manager::Connector* connector, 127 service_manager::Connector* connector,
128 scoped_refptr<base::SequencedTaskRunner> io_task_runner) 128 scoped_refptr<base::SequencedTaskRunner> io_task_runner)
129 : context_(new IOThreadContext), 129 : child_token_(child_token),
130 context_(new IOThreadContext),
130 child_identity_(service_name, 131 child_identity_(service_name,
131 service_manager::mojom::kInheritUserID, 132 service_manager::mojom::kInheritUserID,
132 instance_id), 133 instance_id),
133 service_token_(mojo::edk::GenerateRandomToken()), 134 service_token_(mojo::edk::GenerateRandomToken()),
134 weak_factory_(this) { 135 weak_factory_(this) {
135 mojo::ScopedMessagePipeHandle service_pipe = 136 mojo::ScopedMessagePipeHandle service_pipe =
136 mojo::edk::CreateParentMessagePipe(service_token_, child_token); 137 mojo::edk::CreateParentMessagePipe(service_token_, child_token_);
137 138
138 context_->Initialize(child_identity_, connector, std::move(service_pipe), 139 context_->Initialize(child_identity_, connector, std::move(service_pipe),
139 io_task_runner); 140 io_task_runner);
140 remote_interfaces_.Forward( 141 remote_interfaces_.Forward(
141 base::Bind(&CallBinderOnTaskRunner, 142 base::Bind(&CallBinderOnTaskRunner,
142 base::Bind(&IOThreadContext::GetRemoteInterfaceOnIOThread, 143 base::Bind(&IOThreadContext::GetRemoteInterfaceOnIOThread,
143 context_), io_task_runner)); 144 context_), io_task_runner));
144 } 145 }
145 146
146 ChildConnection::~ChildConnection() { 147 ChildConnection::~ChildConnection() {
147 context_->ShutDown(); 148 context_->ShutDown();
149
150 if (process_handle_ == base::kNullProcessHandle) {
151 // The process handle was never set, so we have to assume the process was
152 // not successfully launched. Note that ChildProcessLauncher may also call
153 // call ChildProcessLaunchFailed for the same token, so this is (harmlessly)
154 // redundant in some cases.
155 mojo::edk::ChildProcessLaunchFailed(child_token_);
156 }
148 } 157 }
149 158
150 void ChildConnection::SetProcessHandle(base::ProcessHandle handle) { 159 void ChildConnection::SetProcessHandle(base::ProcessHandle handle) {
160 process_handle_ = handle;
151 context_->SetProcessHandle(handle); 161 context_->SetProcessHandle(handle);
152 } 162 }
153 163
154 } // namespace content 164 } // 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