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

Side by Side Diff: net/test/spawner_communicator.cc

Issue 10299002: Stop refcounting URLRequestContext. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Initialize to NULL Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « net/test/spawner_communicator.h ('k') | net/url_request/url_request.h » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "net/test/spawner_communicator.h" 5 #include "net/test/spawner_communicator.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "base/supports_user_data.h" 10 #include "base/supports_user_data.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 this)); 166 this));
167 DCHECK(cur_request_.get()); 167 DCHECK(cur_request_.get());
168 int current_request_id = ++next_id_; 168 int current_request_id = ++next_id_;
169 SpawnerRequestData* data = new SpawnerRequestData(current_request_id, 169 SpawnerRequestData* data = new SpawnerRequestData(current_request_id,
170 result_code, 170 result_code,
171 data_received); 171 data_received);
172 DCHECK(data); 172 DCHECK(data);
173 cur_request_->SetUserData(this, data); 173 cur_request_->SetUserData(this, data);
174 174
175 // Build the URLRequest. 175 // Build the URLRequest.
176 scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext()); 176 context_.reset(new TestURLRequestContext);
177 cur_request_->set_context(context); 177 cur_request_->set_context(context_.get());
178 if (post_data.empty()) { 178 if (post_data.empty()) {
179 cur_request_->set_method("GET"); 179 cur_request_->set_method("GET");
180 } else { 180 } else {
181 cur_request_->set_method("POST"); 181 cur_request_->set_method("POST");
182 cur_request_->AppendBytesToUpload(post_data.c_str(), post_data.size()); 182 cur_request_->AppendBytesToUpload(post_data.c_str(), post_data.size());
183 net::HttpRequestHeaders headers; 183 net::HttpRequestHeaders headers;
184 headers.SetHeader(net::HttpRequestHeaders::kContentType, 184 headers.SetHeader(net::HttpRequestHeaders::kContentType,
185 "application/json"); 185 "application/json");
186 cur_request_->SetExtraRequestHeaders(headers); 186 cur_request_->SetExtraRequestHeaders(headers);
187 } 187 }
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 std::string server_return_data; 357 std::string server_return_data;
358 int result_code; 358 int result_code;
359 SendCommandAndWaitForResult("kill", "", &result_code, &server_return_data); 359 SendCommandAndWaitForResult("kill", "", &result_code, &server_return_data);
360 if (OK != result_code || server_return_data != "killed") 360 if (OK != result_code || server_return_data != "killed")
361 return false; 361 return false;
362 Shutdown(); 362 Shutdown();
363 return true; 363 return true;
364 } 364 }
365 365
366 } // namespace net 366 } // namespace net
367
OLDNEW
« no previous file with comments | « net/test/spawner_communicator.h ('k') | net/url_request/url_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698