| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "content/child/url_loader_client_impl.h" | 5 #include "content/child/url_loader_client_impl.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
| 9 #include "content/child/resource_dispatcher.h" | 9 #include "content/child/resource_dispatcher.h" |
| 10 #include "content/child/url_response_body_consumer.h" | 10 #include "content/child/url_response_body_consumer.h" |
| 11 #include "content/common/resource_messages.h" | 11 #include "content/common/resource_messages.h" |
| 12 #include "mojo/public/cpp/bindings/associated_group.h" | |
| 13 #include "net/url_request/redirect_info.h" | 12 #include "net/url_request/redirect_info.h" |
| 14 | 13 |
| 15 namespace content { | 14 namespace content { |
| 16 | 15 |
| 17 URLLoaderClientImpl::URLLoaderClientImpl( | 16 URLLoaderClientImpl::URLLoaderClientImpl( |
| 18 int request_id, | 17 int request_id, |
| 19 ResourceDispatcher* resource_dispatcher, | 18 ResourceDispatcher* resource_dispatcher, |
| 20 scoped_refptr<base::SingleThreadTaskRunner> task_runner) | 19 scoped_refptr<base::SingleThreadTaskRunner> task_runner) |
| 21 : binding_(this), | 20 : binding_(this), |
| 22 request_id_(request_id), | 21 request_id_(request_id), |
| 23 resource_dispatcher_(resource_dispatcher), | 22 resource_dispatcher_(resource_dispatcher), |
| 24 task_runner_(std::move(task_runner)), | 23 task_runner_(std::move(task_runner)), |
| 25 weak_factory_(this) {} | 24 weak_factory_(this) {} |
| 26 | 25 |
| 27 URLLoaderClientImpl::~URLLoaderClientImpl() { | 26 URLLoaderClientImpl::~URLLoaderClientImpl() { |
| 28 if (body_consumer_) | 27 if (body_consumer_) |
| 29 body_consumer_->Cancel(); | 28 body_consumer_->Cancel(); |
| 30 } | 29 } |
| 31 | 30 |
| 32 void URLLoaderClientImpl::Bind( | 31 void URLLoaderClientImpl::Bind( |
| 33 mojom::URLLoaderClientAssociatedPtrInfo* client_ptr_info, | 32 mojom::URLLoaderClientAssociatedPtrInfo* client_ptr_info) { |
| 34 mojo::AssociatedGroup* associated_group) { | 33 binding_.Bind(client_ptr_info); |
| 35 binding_.Bind(client_ptr_info, associated_group); | |
| 36 } | 34 } |
| 37 | 35 |
| 38 void URLLoaderClientImpl::SetDefersLoading() { | 36 void URLLoaderClientImpl::SetDefersLoading() { |
| 39 is_deferred_ = true; | 37 is_deferred_ = true; |
| 40 if (body_consumer_) | 38 if (body_consumer_) |
| 41 body_consumer_->SetDefersLoading(); | 39 body_consumer_->SetDefersLoading(); |
| 42 } | 40 } |
| 43 | 41 |
| 44 void URLLoaderClientImpl::UnsetDefersLoading() { | 42 void URLLoaderClientImpl::UnsetDefersLoading() { |
| 45 is_deferred_ = false; | 43 is_deferred_ = false; |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 178 |
| 181 void URLLoaderClientImpl::OnUploadProgress(int64_t current_position, | 179 void URLLoaderClientImpl::OnUploadProgress(int64_t current_position, |
| 182 int64_t total_size, | 180 int64_t total_size, |
| 183 const base::Closure& ack_callback) { | 181 const base::Closure& ack_callback) { |
| 184 Dispatch( | 182 Dispatch( |
| 185 ResourceMsg_UploadProgress(request_id_, current_position, total_size)); | 183 ResourceMsg_UploadProgress(request_id_, current_position, total_size)); |
| 186 ack_callback.Run(); | 184 ack_callback.Run(); |
| 187 } | 185 } |
| 188 | 186 |
| 189 } // namespace content | 187 } // namespace content |
| OLD | NEW |