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

Side by Side Diff: sync/internal_api/http_bridge.cc

Issue 1117703002: Adjust URLFetcher::Create API so that object is returned as scoped_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unneeded Pass() calls Created 5 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "sync/internal_api/public/http_bridge.h" 5 #include "sync/internal_api/public/http_bridge.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "net/base/load_flags.h" 10 #include "net/base/load_flags.h"
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 295
296 // Start the timer on the network thread (the same thread progress is made 296 // Start the timer on the network thread (the same thread progress is made
297 // on, and on which the url fetcher lives). 297 // on, and on which the url fetcher lives).
298 DCHECK(!fetch_state_.http_request_timeout_timer.get()); 298 DCHECK(!fetch_state_.http_request_timeout_timer.get());
299 fetch_state_.http_request_timeout_timer.reset(new base::Timer(false, false)); 299 fetch_state_.http_request_timeout_timer.reset(new base::Timer(false, false));
300 fetch_state_.http_request_timeout_timer->Start( 300 fetch_state_.http_request_timeout_timer->Start(
301 FROM_HERE, base::TimeDelta::FromSeconds(kMaxHttpRequestTimeSeconds), 301 FROM_HERE, base::TimeDelta::FromSeconds(kMaxHttpRequestTimeSeconds),
302 base::Bind(&HttpBridge::OnURLFetchTimedOut, this)); 302 base::Bind(&HttpBridge::OnURLFetchTimedOut, this));
303 303
304 DCHECK(context_getter_for_request_.get()); 304 DCHECK(context_getter_for_request_.get());
305 fetch_state_.url_poster = net::URLFetcher::Create( 305 fetch_state_.url_poster =
306 url_for_request_, net::URLFetcher::POST, this); 306 net::URLFetcher::Create(url_for_request_, net::URLFetcher::POST, this)
307 .release();
307 fetch_state_.url_poster->SetRequestContext(context_getter_for_request_.get()); 308 fetch_state_.url_poster->SetRequestContext(context_getter_for_request_.get());
308 fetch_state_.url_poster->SetUploadData(content_type_, request_content_); 309 fetch_state_.url_poster->SetUploadData(content_type_, request_content_);
309 fetch_state_.url_poster->SetExtraRequestHeaders(extra_headers_); 310 fetch_state_.url_poster->SetExtraRequestHeaders(extra_headers_);
310 fetch_state_.url_poster->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES); 311 fetch_state_.url_poster->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES);
311 fetch_state_.start_time = base::Time::Now(); 312 fetch_state_.start_time = base::Time::Now();
312 313
313 fetch_state_.url_poster->Start(); 314 fetch_state_.url_poster->Start();
314 } 315 }
315 316
316 int HttpBridge::GetResponseContentLength() const { 317 int HttpBridge::GetResponseContentLength() const {
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 int64 sane_time_ms = 0; 486 int64 sane_time_ms = 0;
486 if (base::StringToInt64(sane_time_str, &sane_time_ms)) { 487 if (base::StringToInt64(sane_time_str, &sane_time_ms)) {
487 network_time_update_callback_.Run( 488 network_time_update_callback_.Run(
488 base::Time::FromJsTime(sane_time_ms), 489 base::Time::FromJsTime(sane_time_ms),
489 base::TimeDelta::FromMilliseconds(1), 490 base::TimeDelta::FromMilliseconds(1),
490 fetch_state_.end_time - fetch_state_.start_time); 491 fetch_state_.end_time - fetch_state_.start_time);
491 } 492 }
492 } 493 }
493 494
494 } // namespace syncer 495 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/attachments/attachment_uploader_impl.cc ('k') | sync/test/accounts_client/test_accounts_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698