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

Side by Side Diff: tools/ipc_fuzzer/replay/replay_process.cc

Issue 867903006: IPC Fuzzer: Initialize mojo in the replay process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | « tools/ipc_fuzzer/replay/DEPS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/replay/replay_process.h" 5 #include "tools/ipc_fuzzer/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 "ipc/ipc_descriptors.h" 16 #include "ipc/ipc_descriptors.h"
17 #include "ipc/ipc_switches.h" 17 #include "ipc/ipc_switches.h"
18 #include "ipc/mojo/ipc_channel_mojo.h" 18 #include "ipc/mojo/ipc_channel_mojo.h"
19 #include "third_party/mojo/src/mojo/edk/embedder/configuration.h"
20 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h"
21 #include "third_party/mojo/src/mojo/edk/embedder/simple_platform_support.h"
19 22
20 namespace ipc_fuzzer { 23 namespace ipc_fuzzer {
21 24
25 void InitializeMojo() {
inferno 2015/01/30 20:42:21 Why do we need to duplicate this. can we not call
26 mojo::embedder::GetConfiguration()->max_message_num_bytes =
27 64 * 1024 * 1024;
28 mojo::embedder::Init(scoped_ptr<mojo::embedder::PlatformSupport>(
29 new mojo::embedder::SimplePlatformSupport()));
30 }
31
22 ReplayProcess::ReplayProcess() 32 ReplayProcess::ReplayProcess()
23 : io_thread_("Chrome_ChildIOThread"), 33 : io_thread_("Chrome_ChildIOThread"),
24 shutdown_event_(true, false), 34 shutdown_event_(true, false),
25 message_index_(0) { 35 message_index_(0) {
26 } 36 }
27 37
28 ReplayProcess::~ReplayProcess() { 38 ReplayProcess::~ReplayProcess() {
29 channel_.reset(); 39 channel_.reset();
30 40
31 // Signal this event before shutting down the service process. That way all 41 // Signal this event before shutting down the service process. That way all
(...skipping 21 matching lines...) Expand all
53 63
54 io_thread_.StartWithOptions( 64 io_thread_.StartWithOptions(
55 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); 65 base::Thread::Options(base::MessageLoop::TYPE_IO, 0));
56 66
57 #if defined(OS_POSIX) 67 #if defined(OS_POSIX)
58 base::GlobalDescriptors* g_fds = base::GlobalDescriptors::GetInstance(); 68 base::GlobalDescriptors* g_fds = base::GlobalDescriptors::GetInstance();
59 g_fds->Set(kPrimaryIPCChannel, 69 g_fds->Set(kPrimaryIPCChannel,
60 kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor); 70 kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor);
61 #endif 71 #endif
62 72
73 InitializeMojo();
74
63 return true; 75 return true;
64 } 76 }
65 77
66 void ReplayProcess::OpenChannel() { 78 void ReplayProcess::OpenChannel() {
67 std::string channel_name = 79 std::string channel_name =
68 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 80 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
69 switches::kProcessChannelID); 81 switches::kProcessChannelID);
70 82
71 // TODO(morrita): As the adoption of ChannelMojo spreads, this 83 // TODO(morrita): As the adoption of ChannelMojo spreads, this
72 // criteria has to be updated. 84 // criteria has to be updated.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 return true; 135 return true;
124 } 136 }
125 137
126 void ReplayProcess::OnChannelError() { 138 void ReplayProcess::OnChannelError() {
127 LOG(ERROR) << "Channel error, quitting after " 139 LOG(ERROR) << "Channel error, quitting after "
128 << message_index_ << " messages"; 140 << message_index_ << " messages";
129 base::MessageLoop::current()->Quit(); 141 base::MessageLoop::current()->Quit();
130 } 142 }
131 143
132 } // namespace ipc_fuzzer 144 } // namespace ipc_fuzzer
OLDNEW
« no previous file with comments | « tools/ipc_fuzzer/replay/DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698