| Index: net/test/spawned_test_server/spawner_communicator.cc
|
| diff --git a/net/test/spawned_test_server/spawner_communicator.cc b/net/test/spawned_test_server/spawner_communicator.cc
|
| index d7736b8d77bbad55e46c0513e058dbc6643172bb..0e939c0dd0926700db05901d7572851abc66a054 100644
|
| --- a/net/test/spawned_test_server/spawner_communicator.cc
|
| +++ b/net/test/spawned_test_server/spawner_communicator.cc
|
| @@ -26,8 +26,8 @@ namespace {
|
|
|
| GURL GenerateSpawnerCommandURL(const std::string& command, uint16 port) {
|
| // Always performs HTTP request for sending command to the spawner server.
|
| - return GURL(base::StringPrintf("%s:%u/%s", "http://127.0.0.1", port,
|
| - command.c_str()));
|
| + return GURL(base::StringPrintf(
|
| + "%s:%u/%s", "http://127.0.0.1", port, command.c_str()));
|
| }
|
|
|
| int kBufferSize = 2048;
|
| @@ -104,7 +104,8 @@ SpawnerCommunicator::SpawnerCommunicator(uint16 port)
|
| port_(port),
|
| next_id_(0),
|
| weak_factory_(this),
|
| - is_running_(false) {}
|
| + is_running_(false) {
|
| +}
|
|
|
| SpawnerCommunicator::~SpawnerCommunicator() {
|
| DCHECK(!is_running_);
|
| @@ -154,9 +155,14 @@ void SpawnerCommunicator::SendCommandAndWaitForResult(
|
| // Since the method will be blocked until SpawnerCommunicator gets result
|
| // from the spawner server or timed-out. It's safe to use base::Unretained
|
| // when using base::Bind.
|
| - io_thread_.message_loop()->PostTask(FROM_HERE, base::Bind(
|
| - &SpawnerCommunicator::SendCommandAndWaitForResultOnIOThread,
|
| - base::Unretained(this), command, post_data, result_code, data_received));
|
| + io_thread_.message_loop()->PostTask(
|
| + FROM_HERE,
|
| + base::Bind(&SpawnerCommunicator::SendCommandAndWaitForResultOnIOThread,
|
| + base::Unretained(this),
|
| + command,
|
| + post_data,
|
| + result_code,
|
| + data_received));
|
| WaitForResponse();
|
| }
|
|
|
| @@ -176,9 +182,8 @@ void SpawnerCommunicator::SendCommandAndWaitForResultOnIOThread(
|
| GenerateSpawnerCommandURL(command, port_), DEFAULT_PRIORITY, this, NULL);
|
| DCHECK(cur_request_);
|
| int current_request_id = ++next_id_;
|
| - SpawnerRequestData* data = new SpawnerRequestData(current_request_id,
|
| - result_code,
|
| - data_received);
|
| + SpawnerRequestData* data =
|
| + new SpawnerRequestData(current_request_id, result_code, data_received);
|
| DCHECK(data);
|
| cur_request_->SetUserData(this, data);
|
|
|
| @@ -188,8 +193,8 @@ void SpawnerCommunicator::SendCommandAndWaitForResultOnIOThread(
|
| cur_request_->set_method("POST");
|
| scoped_ptr<UploadElementReader> reader(
|
| UploadOwnedBytesElementReader::CreateWithString(post_data));
|
| - cur_request_->set_upload(make_scoped_ptr(
|
| - UploadDataStream::CreateWithReader(reader.Pass(), 0)));
|
| + cur_request_->set_upload(
|
| + make_scoped_ptr(UploadDataStream::CreateWithReader(reader.Pass(), 0)));
|
| net::HttpRequestHeaders headers;
|
| headers.SetHeader(net::HttpRequestHeaders::kContentType,
|
| "application/json");
|
| @@ -330,8 +335,8 @@ bool SpawnerCommunicator::StartServer(const std::string& arguments,
|
| // on remote machine.
|
| std::string server_return_data;
|
| int result_code;
|
| - SendCommandAndWaitForResult("start", arguments, &result_code,
|
| - &server_return_data);
|
| + SendCommandAndWaitForResult(
|
| + "start", arguments, &result_code, &server_return_data);
|
| if (OK != result_code || server_return_data.empty())
|
| return false;
|
|
|
|
|