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

Side by Side Diff: content/common/mojo/mojo_shell_connection_impl.cc

Issue 1461243002: [OLD ATTEMPT, DO NOT REVIEW] mustash: Enable connections to mus from the Chrome renderer Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Ben's comments Created 5 years 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/BUILD.gn ('k') | content/common/render_process_client.mojom » ('j') | 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/mojo/mojo_shell_connection_impl.h" 5 #include "content/common/mojo/mojo_shell_connection_impl.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/stl_util.h"
9 #include "base/threading/thread_local.h" 10 #include "base/threading/thread_local.h"
10 #include "mojo/application/public/cpp/application_delegate.h" 11 #include "mojo/application/public/cpp/application_delegate.h"
11 #include "mojo/application/public/cpp/application_impl.h" 12 #include "mojo/application/public/cpp/application_impl.h"
12 #include "mojo/converters/network/network_type_converters.h" 13 #include "mojo/converters/network/network_type_converters.h"
13 #include "mojo/runner/child/runner_connection.h" 14 #include "mojo/runner/child/runner_connection.h"
14 15
15 namespace content { 16 namespace content {
16 namespace { 17 namespace {
17 using MojoShellConnectionPtr = 18 using MojoShellConnectionPtr =
18 base::ThreadLocalPointer<MojoShellConnectionImpl>; 19 base::ThreadLocalPointer<MojoShellConnectionImpl>;
(...skipping 18 matching lines...) Expand all
37 // static 38 // static
38 void MojoShellConnectionImpl::CreateWithMessagePipe( 39 void MojoShellConnectionImpl::CreateWithMessagePipe(
39 mojo::ScopedMessagePipeHandle handle) { 40 mojo::ScopedMessagePipeHandle handle) {
40 DCHECK(!lazy_tls_ptr.Pointer()->Get()); 41 DCHECK(!lazy_tls_ptr.Pointer()->Get());
41 MojoShellConnectionImpl* connection = new MojoShellConnectionImpl; 42 MojoShellConnectionImpl* connection = new MojoShellConnectionImpl;
42 lazy_tls_ptr.Pointer()->Set(connection); 43 lazy_tls_ptr.Pointer()->Set(connection);
43 connection->WaitForShell(handle.Pass()); 44 connection->WaitForShell(handle.Pass());
44 } 45 }
45 46
46 MojoShellConnectionImpl::MojoShellConnectionImpl() : initialized_(false) {} 47 MojoShellConnectionImpl::MojoShellConnectionImpl() : initialized_(false) {}
47 MojoShellConnectionImpl::~MojoShellConnectionImpl() {} 48 MojoShellConnectionImpl::~MojoShellConnectionImpl() {
49 STLDeleteElements(&listeners_);
50 }
48 51
49 void MojoShellConnectionImpl::WaitForShell( 52 void MojoShellConnectionImpl::WaitForShell(
50 mojo::ScopedMessagePipeHandle handle) { 53 mojo::ScopedMessagePipeHandle handle) {
51 mojo::InterfaceRequest<mojo::Application> application_request; 54 mojo::InterfaceRequest<mojo::Application> application_request;
52 runner_connection_.reset(mojo::runner::RunnerConnection::ConnectToRunner( 55 runner_connection_.reset(mojo::runner::RunnerConnection::ConnectToRunner(
53 &application_request, handle.Pass())); 56 &application_request, handle.Pass()));
54 application_impl_.reset(new mojo::ApplicationImpl( 57 application_impl_.reset(new mojo::ApplicationImpl(
55 this, application_request.Pass())); 58 this, application_request.Pass()));
56 application_impl_->WaitForInitialize(); 59 application_impl_->WaitForInitialize();
57 } 60 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // static 96 // static
94 void MojoShellConnection::Destroy() { 97 void MojoShellConnection::Destroy() {
95 // This joins the shell controller thread. 98 // This joins the shell controller thread.
96 delete Get(); 99 delete Get();
97 lazy_tls_ptr.Pointer()->Set(nullptr); 100 lazy_tls_ptr.Pointer()->Set(nullptr);
98 } 101 }
99 102
100 MojoShellConnection::~MojoShellConnection() {} 103 MojoShellConnection::~MojoShellConnection() {}
101 104
102 } // namespace content 105 } // namespace content
OLDNEW
« no previous file with comments | « content/common/BUILD.gn ('k') | content/common/render_process_client.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698