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

Unified Diff: content/common/service_manager/child_connection.cc

Issue 2680973006: Mojo EDK: Add safe process connection API (Closed)
Patch Set: . Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/service_manager/child_connection.h ('k') | content/public/common/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/service_manager/child_connection.cc
diff --git a/content/common/service_manager/child_connection.cc b/content/common/service_manager/child_connection.cc
index 58cca53960fae04781cad0cda99d5b9e71f808e6..42faac05185213e5473761b1163261909b696a9a 100644
--- a/content/common/service_manager/child_connection.cc
+++ b/content/common/service_manager/child_connection.cc
@@ -123,20 +123,16 @@ class ChildConnection::IOThreadContext
ChildConnection::ChildConnection(
const std::string& service_name,
const std::string& instance_id,
- const std::string& child_token,
+ mojo::edk::PendingProcessConnection* process_connection,
service_manager::Connector* connector,
scoped_refptr<base::SequencedTaskRunner> io_task_runner)
- : child_token_(child_token),
- context_(new IOThreadContext),
+ : context_(new IOThreadContext),
child_identity_(service_name,
service_manager::mojom::kInheritUserID,
instance_id),
- service_token_(mojo::edk::GenerateRandomToken()),
weak_factory_(this) {
- mojo::ScopedMessagePipeHandle service_pipe =
- mojo::edk::CreateParentMessagePipe(service_token_, child_token_);
-
- context_->Initialize(child_identity_, connector, std::move(service_pipe),
+ context_->Initialize(child_identity_, connector,
+ process_connection->CreateMessagePipe(&service_token_),
io_task_runner);
remote_interfaces_.Forward(
base::Bind(&CallBinderOnTaskRunner,
@@ -146,14 +142,6 @@ ChildConnection::ChildConnection(
ChildConnection::~ChildConnection() {
context_->ShutDown();
-
- if (process_handle_ == base::kNullProcessHandle) {
- // The process handle was never set, so we have to assume the process was
- // not successfully launched. Note that ChildProcessLauncher may also call
- // call ChildProcessLaunchFailed for the same token, so this is (harmlessly)
- // redundant in some cases.
- mojo::edk::ChildProcessLaunchFailed(child_token_);
- }
}
void ChildConnection::SetProcessHandle(base::ProcessHandle handle) {
« no previous file with comments | « content/common/service_manager/child_connection.h ('k') | content/public/common/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698