| OLD | NEW |
| 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 "google_apis/drive/request_sender.h" | 5 #include "google_apis/drive/request_sender.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/sequenced_task_runner.h" | 10 #include "base/sequenced_task_runner.h" |
| 11 #include "google_apis/drive/auth_service.h" | 11 #include "google_apis/drive/auth_service.h" |
| 12 #include "google_apis/drive/base_requests.h" | 12 #include "google_apis/drive/base_requests.h" |
| 13 #include "net/url_request/url_request_context_getter.h" | 13 #include "net/url_request/url_request_context_getter.h" |
| 14 | 14 |
| 15 namespace google_apis { | 15 namespace google_apis { |
| 16 | 16 |
| 17 RequestSender::RequestSender( | 17 RequestSender::RequestSender( |
| 18 AuthServiceInterface* auth_service, | 18 AuthServiceInterface* auth_service, |
| 19 net::URLRequestContextGetter* url_request_context_getter, | 19 net::URLRequestContextGetter* url_request_context_getter, |
| 20 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner, | 20 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner, |
| 21 const std::string& custom_user_agent) | 21 const std::string& custom_user_agent, |
| 22 const net::NetworkTrafficAnnotationTag& traffic_annotation) |
| 22 : auth_service_(auth_service), | 23 : auth_service_(auth_service), |
| 23 url_request_context_getter_(url_request_context_getter), | 24 url_request_context_getter_(url_request_context_getter), |
| 24 blocking_task_runner_(blocking_task_runner), | 25 blocking_task_runner_(blocking_task_runner), |
| 25 custom_user_agent_(custom_user_agent), | 26 custom_user_agent_(custom_user_agent), |
| 26 weak_ptr_factory_(this) { | 27 traffic_annotation_(traffic_annotation), |
| 27 } | 28 weak_ptr_factory_(this) {} |
| 28 | 29 |
| 29 RequestSender::~RequestSender() { | 30 RequestSender::~RequestSender() { |
| 30 DCHECK(thread_checker_.CalledOnValidThread()); | 31 DCHECK(thread_checker_.CalledOnValidThread()); |
| 31 } | 32 } |
| 32 | 33 |
| 33 base::Closure RequestSender::StartRequestWithAuthRetry( | 34 base::Closure RequestSender::StartRequestWithAuthRetry( |
| 34 std::unique_ptr<AuthenticatedRequestInterface> request) { | 35 std::unique_ptr<AuthenticatedRequestInterface> request) { |
| 35 DCHECK(thread_checker_.CalledOnValidThread()); | 36 DCHECK(thread_checker_.CalledOnValidThread()); |
| 36 | 37 |
| 37 AuthenticatedRequestInterface* request_ptr = request.get(); | 38 AuthenticatedRequestInterface* request_ptr = request.get(); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 // Various BatchUpload tests in DriveApiRequestsTest will commit requests | 110 // Various BatchUpload tests in DriveApiRequestsTest will commit requests |
| 110 // using this RequestSender without actually starting them on it. In that | 111 // using this RequestSender without actually starting them on it. In that |
| 111 // case, there's nothing to be done, so just return. | 112 // case, there's nothing to be done, so just return. |
| 112 return; | 113 return; |
| 113 } | 114 } |
| 114 | 115 |
| 115 in_flight_requests_.erase(it); | 116 in_flight_requests_.erase(it); |
| 116 } | 117 } |
| 117 | 118 |
| 118 } // namespace google_apis | 119 } // namespace google_apis |
| OLD | NEW |