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

Side by Side Diff: components/update_client/request_sender.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/update_client/request_sender.h" 5 #include "components/update_client/request_sender.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 28 matching lines...) Expand all
39 cur_url_ = urls_.begin(); 39 cur_url_ = urls_.begin();
40 40
41 SendInternal(); 41 SendInternal();
42 } 42 }
43 43
44 void RequestSender::SendInternal() { 44 void RequestSender::SendInternal() {
45 DCHECK(cur_url_ != urls_.end()); 45 DCHECK(cur_url_ != urls_.end());
46 DCHECK(cur_url_->is_valid()); 46 DCHECK(cur_url_->is_valid());
47 DCHECK(thread_checker_.CalledOnValidThread()); 47 DCHECK(thread_checker_.CalledOnValidThread());
48 48
49 url_fetcher_.reset(SendProtocolRequest(*cur_url_, request_string_, this, 49 url_fetcher_ = SendProtocolRequest(*cur_url_, request_string_, this,
50 config_.RequestContext())); 50 config_.RequestContext());
51 } 51 }
52 52
53 void RequestSender::OnURLFetchComplete(const net::URLFetcher* source) { 53 void RequestSender::OnURLFetchComplete(const net::URLFetcher* source) {
54 DCHECK(thread_checker_.CalledOnValidThread()); 54 DCHECK(thread_checker_.CalledOnValidThread());
55 if (GetFetchError(*source) == 0) { 55 if (GetFetchError(*source) == 0) {
56 request_sender_callback_.Run(source); 56 request_sender_callback_.Run(source);
57 return; 57 return;
58 } 58 }
59 59
60 if (++cur_url_ != urls_.end() && 60 if (++cur_url_ != urls_.end() &&
61 base::ThreadTaskRunnerHandle::Get()->PostTask( 61 base::ThreadTaskRunnerHandle::Get()->PostTask(
62 FROM_HERE, 62 FROM_HERE,
63 base::Bind(&RequestSender::SendInternal, base::Unretained(this)))) { 63 base::Bind(&RequestSender::SendInternal, base::Unretained(this)))) {
64 return; 64 return;
65 } 65 }
66 66
67 request_sender_callback_.Run(source); 67 request_sender_callback_.Run(source);
68 } 68 }
69 69
70 } // namespace update_client 70 } // namespace update_client
OLDNEW
« no previous file with comments | « components/translate/core/browser/translate_url_fetcher.cc ('k') | components/update_client/url_fetcher_downloader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698