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

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

Issue 1390513002: Remove base::MessageLoop::{Quit,QuitClosure} functions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Split into small CLs Created 5 years, 2 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 | « testing/gmock_mutant.h ('k') | win8/metro_driver/chrome_app_view.cc » ('j') | 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/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"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 101
102 bool ReplayProcess::OpenTestcase() { 102 bool ReplayProcess::OpenTestcase() {
103 base::FilePath path = 103 base::FilePath path =
104 base::CommandLine::ForCurrentProcess()->GetSwitchValuePath( 104 base::CommandLine::ForCurrentProcess()->GetSwitchValuePath(
105 switches::kIpcFuzzerTestcase); 105 switches::kIpcFuzzerTestcase);
106 return MessageFile::Read(path, &messages_); 106 return MessageFile::Read(path, &messages_);
107 } 107 }
108 108
109 void ReplayProcess::SendNextMessage() { 109 void ReplayProcess::SendNextMessage() {
110 if (message_index_ >= messages_.size()) { 110 if (message_index_ >= messages_.size()) {
111 base::MessageLoop::current()->Quit(); 111 base::MessageLoop::current()->QuitWhenIdle();
112 return; 112 return;
113 } 113 }
114 114
115 // Take next message and release it from vector. 115 // Take next message and release it from vector.
116 IPC::Message* message = messages_[message_index_]; 116 IPC::Message* message = messages_[message_index_];
117 messages_[message_index_++] = NULL; 117 messages_[message_index_++] = NULL;
118 118
119 if (!channel_->Send(message)) { 119 if (!channel_->Send(message)) {
120 LOG(ERROR) << "ChannelProxy::Send() failed after " 120 LOG(ERROR) << "ChannelProxy::Send() failed after "
121 << message_index_ << " messages"; 121 << message_index_ << " messages";
122 base::MessageLoop::current()->Quit(); 122 base::MessageLoop::current()->QuitWhenIdle();
123 } 123 }
124 } 124 }
125 125
126 void ReplayProcess::Run() { 126 void ReplayProcess::Run() {
127 timer_.reset(new base::Timer(false, true)); 127 timer_.reset(new base::Timer(false, true));
128 timer_->Start(FROM_HERE, 128 timer_->Start(FROM_HERE,
129 base::TimeDelta::FromMilliseconds(1), 129 base::TimeDelta::FromMilliseconds(1),
130 base::Bind(&ReplayProcess::SendNextMessage, 130 base::Bind(&ReplayProcess::SendNextMessage,
131 base::Unretained(this))); 131 base::Unretained(this)));
132 base::MessageLoop::current()->Run(); 132 base::MessageLoop::current()->Run();
133 } 133 }
134 134
135 bool ReplayProcess::OnMessageReceived(const IPC::Message& msg) { 135 bool ReplayProcess::OnMessageReceived(const IPC::Message& msg) {
136 return true; 136 return true;
137 } 137 }
138 138
139 void ReplayProcess::OnChannelError() { 139 void ReplayProcess::OnChannelError() {
140 LOG(ERROR) << "Channel error, quitting after " 140 LOG(ERROR) << "Channel error, quitting after "
141 << message_index_ << " messages"; 141 << message_index_ << " messages";
142 base::MessageLoop::current()->Quit(); 142 base::MessageLoop::current()->QuitWhenIdle();
143 } 143 }
144 144
145 } // namespace ipc_fuzzer 145 } // namespace ipc_fuzzer
OLDNEW
« no previous file with comments | « testing/gmock_mutant.h ('k') | win8/metro_driver/chrome_app_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698