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