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

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

Issue 1915053004: mus/chrome: Always wait for the mojo shell. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « chrome/test/base/mojo_test_connector.cc ('k') | content/public/common/content_switches.h » ('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 <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 22 matching lines...) Expand all
33 33
34 } // namespace 34 } // namespace
35 35
36 bool IsRunningInMojoShell() { 36 bool IsRunningInMojoShell() {
37 return mojo_shell_connection_factory || 37 return mojo_shell_connection_factory ||
38 base::CommandLine::ForCurrentProcess()->HasSwitch( 38 base::CommandLine::ForCurrentProcess()->HasSwitch(
39 mojo::edk::PlatformChannelPair::kMojoPlatformChannelHandleSwitch); 39 mojo::edk::PlatformChannelPair::kMojoPlatformChannelHandleSwitch);
40 } 40 }
41 41
42 bool ShouldWaitForShell() { 42 bool ShouldWaitForShell() {
43 return mojo_shell_connection_factory || 43 return mojo_shell_connection_factory || IsRunningInMojoShell();
Ken Rockot(use gerrit already) 2016/04/25 23:29:35 Unfortunately IsRunningInMojoShell is a misnomer,
sadrul 2016/04/26 03:22:04 I was thinking a naive workaround would be to chec
44 (IsRunningInMojoShell() &&
45 base::CommandLine::ForCurrentProcess()->HasSwitch(
46 switches::kWaitForMojoShell));
47 } 44 }
48 45
49 // static 46 // static
50 bool MojoShellConnectionImpl::CreateUsingFactory() { 47 bool MojoShellConnectionImpl::CreateUsingFactory() {
51 if (mojo_shell_connection_factory) { 48 if (mojo_shell_connection_factory) {
52 DCHECK(!lazy_tls_ptr.Pointer()->Get()); 49 DCHECK(!lazy_tls_ptr.Pointer()->Get());
53 mojo_shell_connection_factory->Run(); 50 mojo_shell_connection_factory->Run();
54 DCHECK(lazy_tls_ptr.Pointer()->Get()); 51 DCHECK(lazy_tls_ptr.Pointer()->Get());
55 return true; 52 return true;
56 } 53 }
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 // static 163 // static
167 void MojoShellConnection::Destroy() { 164 void MojoShellConnection::Destroy() {
168 // This joins the shell controller thread. 165 // This joins the shell controller thread.
169 delete Get(); 166 delete Get();
170 lazy_tls_ptr.Pointer()->Set(nullptr); 167 lazy_tls_ptr.Pointer()->Set(nullptr);
171 } 168 }
172 169
173 MojoShellConnection::~MojoShellConnection() {} 170 MojoShellConnection::~MojoShellConnection() {}
174 171
175 } // namespace content 172 } // namespace content
OLDNEW
« no previous file with comments | « chrome/test/base/mojo_test_connector.cc ('k') | content/public/common/content_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698