summaryrefslogtreecommitdiffstats
path: root/ipc/mojo/ipc_channel_mojo_unittest.cc
diff options
context:
space:
mode:
authorsorin <sorin@chromium.org>2015-04-09 09:24:36 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-09 16:25:23 +0000
commit87a51a7345593c850ed196791c66cc6ab30479a0 (patch)
tree79e91c8c9b3187a3ed55ed693c29c96c68428e7f /ipc/mojo/ipc_channel_mojo_unittest.cc
parentfee15187db2b48bd7da1bf15d8e0f1fc8ee328ec (diff)
downloadchromium_src-87a51a7345593c850ed196791c66cc6ab30479a0.zip
chromium_src-87a51a7345593c850ed196791c66cc6ab30479a0.tar.gz
chromium_src-87a51a7345593c850ed196791c66cc6ab30479a0.tar.bz2
Revert of ChannelMojo: Ensure that it always has ScopedIPCSupport (patchset #1 id:1 of https://codereview.chromium.org/1054253005/)
Reason for revert: It breaks the lkgr bots for various win ASAN, such as: http://build.chromium.org/p/chromium.lkgr/waterfall?builder=Win%20ASan%20Release [17485/19602] CXX obj\content\test\test_support_content.fake_plugin_service.obj FAILED: ninja -t msvc -e environment.x86 -- "..\..\third_party/llvm-build/Release+Asserts/bin/clang-cl" -m32 /nologo /showIncludes /FC @obj\tools\ipc_fuzzer\message_replay\ipc_fuzzer_replay.replay_process.obj.rsp /c ..\..\tools\ipc_fuzzer\message_replay\replay_process.cc /Foobj\tools\ipc_fuzzer\message_replay\ipc_fuzzer_replay.replay_process.obj /Fdobj\tools\ipc_fuzzer\message_replay\ipc_fuzzer_replay.cc.pdb ..\..\tools\ipc_fuzzer\message_replay\replay_process.cc(96,68) : error(clang): too few arguments to function call, expected 3, have 2 IPC::ChannelMojo::CreateClientFactory(nullptr, channel_name), this, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ..\..\ipc/mojo/ipc_channel_mojo.h(80,3) : note(clang): 'CreateClientFactory' declared here static scoped_ptr<ChannelFactory> CreateClientFactory( ^ 1 error generated. clang-cl.exe: warning: falling back to C:\b\depot_tools\win_toolchain\vs2013_files\win8sdk\bin\..\..\VC\bin\amd64_x86\cl.exe clang-cl.exe: error: clang frontend command failed with exit code 2 (use -v to see invocation) ..\..\tools\ipc_fuzzer\message_replay\replay_process.cc(96) : error C2660: 'IPC::ChannelMojo::CreateClientFactory' : function does not take 2 arguments Original issue's description: > ChannelMojo: Ensure that it always has ScopedIPCSupport > > ChannelMojo has ScopedIPCSupport, but it is instantiated only in > in-process mode. This CL lets it always instantiate to make it > clear that ChannelInfo is protected by the ScopedIPCSupport. > It simplifies the relationship between the support object and > the channel, and makes the lifecycle invariant reasonable. > > With this change, we no longer need to protect ChannelMojo with > ScopedIPCSupport on its client side. Now it's built-in. > > Note that this is a speculative fix of fuzzer generated crash, > where Mojo channel related globals are gone before when channel > mojo is being destroyed. > > BUG=473438 > R=viettrungluu@chromium.org, rockot@chromium.org > > Committed: https://crrev.com/808706e71c213c916815e967e3156cae64d12c00 > Cr-Commit-Position: refs/heads/master@{#324308} TBR=rockot@chromium.org,viettrungluu@chromium.org,creis@chromium.org,morrita@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=473438 Review URL: https://codereview.chromium.org/1069943003 Cr-Commit-Position: refs/heads/master@{#324457}
Diffstat (limited to 'ipc/mojo/ipc_channel_mojo_unittest.cc')
-rw-r--r--ipc/mojo/ipc_channel_mojo_unittest.cc19
1 files changed, 14 insertions, 5 deletions
diff --git a/ipc/mojo/ipc_channel_mojo_unittest.cc b/ipc/mojo/ipc_channel_mojo_unittest.cc
index bf70b7f..356d3b3 100644
--- a/ipc/mojo/ipc_channel_mojo_unittest.cc
+++ b/ipc/mojo/ipc_channel_mojo_unittest.cc
@@ -66,9 +66,12 @@ class ListenerThatExpectsOK : public IPC::Listener {
class ChannelClient {
public:
explicit ChannelClient(IPC::Listener* listener, const char* name) {
- channel_ = IPC::ChannelMojo::Create(NULL, main_message_loop_.task_runner(),
+ ipc_support_.reset(
+ new IPC::ScopedIPCSupport(main_message_loop_.task_runner()));
+ channel_ = IPC::ChannelMojo::Create(NULL,
IPCTestBase::GetChannelName(name),
- IPC::Channel::MODE_CLIENT, listener);
+ IPC::Channel::MODE_CLIENT,
+ listener);
}
void Connect() {
@@ -87,6 +90,7 @@ class ChannelClient {
private:
base::MessageLoopForIO main_message_loop_;
+ scoped_ptr<IPC::ScopedIPCSupport> ipc_support_;
scoped_ptr<IPC::ChannelMojo> channel_;
};
@@ -94,17 +98,22 @@ class IPCChannelMojoTestBase : public IPCTestBase {
public:
void InitWithMojo(const std::string& test_client_name) {
Init(test_client_name);
+ ipc_support_.reset(new IPC::ScopedIPCSupport(task_runner()));
}
void TearDown() override {
// Make sure Mojo IPC support is properly shutdown on the I/O loop before
// TearDown continues.
+ ipc_support_.reset();
base::RunLoop run_loop;
task_runner()->PostTask(FROM_HERE, run_loop.QuitClosure());
run_loop.Run();
IPCTestBase::TearDown();
}
+
+ private:
+ scoped_ptr<IPC::ScopedIPCSupport> ipc_support_;
};
class IPCChannelMojoTest : public IPCChannelMojoTestBase {
@@ -114,7 +123,7 @@ class IPCChannelMojoTest : public IPCChannelMojoTestBase {
base::SequencedTaskRunner* runner) override {
host_.reset(new IPC::ChannelMojoHost(task_runner()));
return IPC::ChannelMojo::CreateServerFactory(host_->channel_delegate(),
- task_runner(), handle);
+ handle);
}
bool DidStartClient() override {
@@ -222,7 +231,7 @@ class IPCChannelMojoErrorTest : public IPCChannelMojoTestBase {
base::SequencedTaskRunner* runner) override {
host_.reset(new IPC::ChannelMojoHost(task_runner()));
return IPC::ChannelMojo::CreateServerFactory(host_->channel_delegate(),
- task_runner(), handle);
+ handle);
}
bool DidStartClient() override {
@@ -556,7 +565,7 @@ class IPCChannelMojoDeadHandleTest : public IPCChannelMojoTestBase {
base::SequencedTaskRunner* runner) override {
host_.reset(new IPC::ChannelMojoHost(task_runner()));
return IPC::ChannelMojo::CreateServerFactory(host_->channel_delegate(),
- task_runner(), handle);
+ handle);
}
virtual bool DidStartClient() override {