| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "tools/ipc_fuzzer/message_replay/replay_process.h" | 5 #include "tools/ipc_fuzzer/message_replay/replay_process.h" |
| 6 | 6 |
| 7 #include <limits.h> | 7 #include <limits.h> |
| 8 #include <string> | 8 #include <string> |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/posix/global_descriptors.h" | 13 #include "base/posix/global_descriptors.h" |
| 14 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
| 15 #include "content/public/common/content_switches.h" | 15 #include "content/public/common/content_switches.h" |
| 16 #include "content/public/common/mojo_channel_switches.h" | 16 #include "content/public/common/mojo_channel_switches.h" |
| 17 #include "ipc/ipc_descriptors.h" | 17 #include "ipc/ipc_descriptors.h" |
| 18 #include "ipc/ipc_switches.h" | 18 #include "ipc/ipc_switches.h" |
| 19 #include "ipc/mojo/ipc_channel_mojo.h" | 19 #include "ipc/mojo/ipc_channel_mojo.h" |
| 20 #include "third_party/mojo/src/mojo/edk/embedder/configuration.h" | |
| 21 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h" | 20 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h" |
| 22 #include "third_party/mojo/src/mojo/edk/embedder/simple_platform_support.h" | |
| 23 | 21 |
| 24 namespace ipc_fuzzer { | 22 namespace ipc_fuzzer { |
| 25 | 23 |
| 26 // TODO(morrita): content::InitializeMojo() should be used once it becomes | 24 // TODO(morrita): content::InitializeMojo() should be used once it becomes |
| 27 // a public API. See src/content/app/mojo/mojo_init.cc | 25 // a public API. See src/content/app/mojo/mojo_init.cc |
| 28 void InitializeMojo() { | 26 void InitializeMojo() { |
| 29 mojo::embedder::GetConfiguration()->max_message_num_bytes = | 27 mojo::embedder::SetMaxMessageSize(64 * 1024 * 1024); |
| 30 64 * 1024 * 1024; | 28 mojo::embedder::Init(); |
| 31 mojo::embedder::Init(scoped_ptr<mojo::embedder::PlatformSupport>( | |
| 32 new mojo::embedder::SimplePlatformSupport())); | |
| 33 } | 29 } |
| 34 | 30 |
| 35 ReplayProcess::ReplayProcess() | 31 ReplayProcess::ReplayProcess() |
| 36 : io_thread_("Chrome_ChildIOThread"), | 32 : io_thread_("Chrome_ChildIOThread"), |
| 37 shutdown_event_(true, false), | 33 shutdown_event_(true, false), |
| 38 message_index_(0) { | 34 message_index_(0) { |
| 39 } | 35 } |
| 40 | 36 |
| 41 ReplayProcess::~ReplayProcess() { | 37 ReplayProcess::~ReplayProcess() { |
| 42 channel_.reset(); | 38 channel_.reset(); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 return true; | 136 return true; |
| 141 } | 137 } |
| 142 | 138 |
| 143 void ReplayProcess::OnChannelError() { | 139 void ReplayProcess::OnChannelError() { |
| 144 LOG(ERROR) << "Channel error, quitting after " | 140 LOG(ERROR) << "Channel error, quitting after " |
| 145 << message_index_ << " messages"; | 141 << message_index_ << " messages"; |
| 146 base::MessageLoop::current()->Quit(); | 142 base::MessageLoop::current()->Quit(); |
| 147 } | 143 } |
| 148 | 144 |
| 149 } // namespace ipc_fuzzer | 145 } // namespace ipc_fuzzer |
| OLD | NEW |