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/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 "content/public/common/mojo_channel_switches.h" |
16 #include "ipc/ipc_descriptors.h" | 17 #include "ipc/ipc_descriptors.h" |
17 #include "ipc/ipc_switches.h" | 18 #include "ipc/ipc_switches.h" |
18 #include "ipc/mojo/ipc_channel_mojo.h" | 19 #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/configuration.h" |
20 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h" | 21 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h" |
21 #include "third_party/mojo/src/mojo/edk/embedder/simple_platform_support.h" | 22 #include "third_party/mojo/src/mojo/edk/embedder/simple_platform_support.h" |
22 | 23 |
23 namespace ipc_fuzzer { | 24 namespace ipc_fuzzer { |
24 | 25 |
25 // TODO(morrita): content::InitializeMojo() should be used once it becomes | 26 // TODO(morrita): content::InitializeMojo() should be used once it becomes |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 std::string channel_name = | 83 std::string channel_name = |
83 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 84 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
84 switches::kProcessChannelID); | 85 switches::kProcessChannelID); |
85 | 86 |
86 // TODO(morrita): As the adoption of ChannelMojo spreads, this | 87 // TODO(morrita): As the adoption of ChannelMojo spreads, this |
87 // criteria has to be updated. | 88 // criteria has to be updated. |
88 std::string process_type = | 89 std::string process_type = |
89 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 90 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
90 switches::kProcessType); | 91 switches::kProcessType); |
91 bool should_use_mojo = process_type == switches::kRendererProcess && | 92 bool should_use_mojo = process_type == switches::kRendererProcess && |
92 IPC::ChannelMojo::ShouldBeUsed(); | 93 content::ShouldUseMojoChannel(); |
93 if (should_use_mojo) { | 94 if (should_use_mojo) { |
94 channel_ = IPC::ChannelProxy::Create( | 95 channel_ = IPC::ChannelProxy::Create( |
95 IPC::ChannelMojo::CreateClientFactory(channel_name), this, | 96 IPC::ChannelMojo::CreateClientFactory(channel_name), this, |
96 io_thread_.message_loop_proxy()); | 97 io_thread_.message_loop_proxy()); |
97 } else { | 98 } else { |
98 channel_ = | 99 channel_ = |
99 IPC::ChannelProxy::Create(channel_name, IPC::Channel::MODE_CLIENT, this, | 100 IPC::ChannelProxy::Create(channel_name, IPC::Channel::MODE_CLIENT, this, |
100 io_thread_.message_loop_proxy()); | 101 io_thread_.message_loop_proxy()); |
101 } | 102 } |
102 } | 103 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 return true; | 139 return true; |
139 } | 140 } |
140 | 141 |
141 void ReplayProcess::OnChannelError() { | 142 void ReplayProcess::OnChannelError() { |
142 LOG(ERROR) << "Channel error, quitting after " | 143 LOG(ERROR) << "Channel error, quitting after " |
143 << message_index_ << " messages"; | 144 << message_index_ << " messages"; |
144 base::MessageLoop::current()->Quit(); | 145 base::MessageLoop::current()->Quit(); |
145 } | 146 } |
146 | 147 |
147 } // namespace ipc_fuzzer | 148 } // namespace ipc_fuzzer |
OLD | NEW |