OLD | NEW |
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/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
8 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "content/public/common/content_switches.h" |
9 #include "ipc/ipc_channel.h" | 11 #include "ipc/ipc_channel.h" |
10 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h" | 12 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h" |
11 | 13 |
12 namespace content { | 14 namespace content { |
13 | 15 |
14 namespace { | 16 namespace { |
15 | 17 |
16 class MojoInitializer { | 18 class MojoInitializer { |
17 public: | 19 public: |
18 MojoInitializer() { | 20 MojoInitializer() { |
| 21 #if defined(OS_WIN) |
| 22 const base::CommandLine& command_line = |
| 23 *base::CommandLine::ForCurrentProcess(); |
| 24 if (command_line.HasSwitch("use-new-edk")) { |
| 25 std::string process_type = |
| 26 command_line.GetSwitchValueASCII(switches::kProcessType); |
| 27 if (process_type.empty()) { |
| 28 mojo::embedder::PreInitializeParentProcess(); |
| 29 } else { |
| 30 mojo::embedder::PreInitializeChildProcess(); |
| 31 } |
| 32 } |
| 33 #endif |
| 34 |
19 mojo::embedder::SetMaxMessageSize(IPC::Channel::kMaximumMessageSize); | 35 mojo::embedder::SetMaxMessageSize(IPC::Channel::kMaximumMessageSize); |
20 mojo::embedder::Init(); | 36 mojo::embedder::Init(); |
21 } | 37 } |
22 }; | 38 }; |
23 | 39 |
24 base::LazyInstance<MojoInitializer>::Leaky mojo_initializer; | 40 base::LazyInstance<MojoInitializer>::Leaky mojo_initializer; |
25 | 41 |
26 } // namespace | 42 } // namespace |
27 | 43 |
28 void InitializeMojo() { | 44 void InitializeMojo() { |
29 mojo_initializer.Get(); | 45 mojo_initializer.Get(); |
30 } | 46 } |
31 | 47 |
32 } // namespace content | 48 } // namespace content |
OLD | NEW |