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

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

Issue 1676913002: [mojo] Delete third_party/mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: let's try that again Created 4 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 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
14 #if defined(MOJO_SHELL_CLIENT)
15 #include "content/common/mojo/mojo_shell_connection_impl.h"
16 #endif
17 13
18 namespace content { 14 namespace content {
19 15
20 namespace { 16 namespace {
21 17
22 class MojoInitializer { 18 class MojoInitializer {
23 public: 19 public:
24 MojoInitializer() { 20 MojoInitializer() {
25 const base::CommandLine& command_line = 21 mojo::edk::SetMaxMessageSize(IPC::Channel::kMaximumMessageSize);
26 *base::CommandLine::ForCurrentProcess(); 22 mojo::edk::Init();
27 std::string process_type =
28 command_line.GetSwitchValueASCII(switches::kProcessType);
29 if (process_type.empty() && !command_line.HasSwitch("use-old-edk")) {
30 base::CommandLine::ForCurrentProcess()->AppendSwitch(
31 "use-new-edk");
32 }
33
34 if (command_line.HasSwitch("use-new-edk")) {
35 bool initialize_as_parent = process_type.empty();
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 } 23 }
50 }; 24 };
51 25
52 base::LazyInstance<MojoInitializer>::Leaky mojo_initializer; 26 base::LazyInstance<MojoInitializer>::Leaky mojo_initializer;
53 27
54 } // namespace 28 } // namespace
55 29
56 void InitializeMojo() { 30 void InitializeMojo() {
57 mojo_initializer.Get(); 31 mojo_initializer.Get();
58 } 32 }
59 33
60 } // namespace content 34 } // 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