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

Side by Side Diff: content/app/mojo/mojo_init.cc

Issue 1554443003: Stop linking in the old Mojo EDK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge and fix new flaky test Created 4 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/app/BUILD.gn ('k') | content/browser/browser_child_process_host_impl.cc » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/app/mojo/mojo_init.h" 5 #include "content/app/mojo/mojo_init.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/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "content/public/common/content_switches.h" 10 #include "content/public/common/content_switches.h"
11 #include "ipc/ipc_channel.h" 11 #include "ipc/ipc_channel.h"
12 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h" 12 #include "mojo/edk/embedder/embedder.h"
13 13
14 #if defined(MOJO_SHELL_CLIENT) 14 #if defined(MOJO_SHELL_CLIENT)
15 #include "content/common/mojo/mojo_shell_connection_impl.h" 15 #include "content/common/mojo/mojo_shell_connection_impl.h"
16 #endif 16 #endif
17 17
18 namespace content { 18 namespace content {
19 19
20 namespace { 20 namespace {
21 21
22 class MojoInitializer { 22 class MojoInitializer {
23 public: 23 public:
24 MojoInitializer() { 24 MojoInitializer() {
25 const base::CommandLine& command_line = 25 const base::CommandLine& command_line =
26 *base::CommandLine::ForCurrentProcess(); 26 *base::CommandLine::ForCurrentProcess();
27 std::string process_type = 27 std::string process_type =
28 command_line.GetSwitchValueASCII(switches::kProcessType); 28 command_line.GetSwitchValueASCII(switches::kProcessType);
29 if (process_type.empty() && !command_line.HasSwitch("use-old-edk")) { 29 bool initialize_as_parent = process_type.empty();
30 base::CommandLine::ForCurrentProcess()->AppendSwitch( 30 #if defined(MOJO_SHELL_CLIENT)
31 "use-new-edk"); 31 if (IsRunningInMojoShell())
32 initialize_as_parent = false;
33 #endif
34 if (initialize_as_parent) {
35 mojo::edk::PreInitializeParentProcess();
36 } else {
37 mojo::edk::PreInitializeChildProcess();
32 } 38 }
33 39
34 if (command_line.HasSwitch("use-new-edk")) { 40 mojo::edk::SetMaxMessageSize(IPC::Channel::kMaximumMessageSize);
35 bool initialize_as_parent = process_type.empty(); 41 mojo::edk::Init();
36 #if defined(MOJO_SHELL_CLIENT)
37 if (IsRunningInMojoShell())
38 initialize_as_parent = false;
39 #endif
40 if (initialize_as_parent) {
41 mojo::embedder::PreInitializeParentProcess();
42 } else {
43 mojo::embedder::PreInitializeChildProcess();
44 }
45 }
46
47 mojo::embedder::SetMaxMessageSize(IPC::Channel::kMaximumMessageSize);
48 mojo::embedder::Init();
49 } 42 }
50 }; 43 };
51 44
52 base::LazyInstance<MojoInitializer>::Leaky mojo_initializer; 45 base::LazyInstance<MojoInitializer>::Leaky mojo_initializer;
53 46
54 } // namespace 47 } // namespace
55 48
56 void InitializeMojo() { 49 void InitializeMojo() {
57 mojo_initializer.Get(); 50 mojo_initializer.Get();
58 } 51 }
59 52
60 } // namespace content 53 } // namespace content
OLDNEW
« no previous file with comments | « content/app/BUILD.gn ('k') | content/browser/browser_child_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698