| 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" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 if (has_completion_message) { | 105 if (has_completion_message) { |
| 106 DCHECK_GT(messages.size(), 0u); | 106 DCHECK_GT(messages.size(), 0u); |
| 107 DCHECK_EQ(messages.back().type(), | 107 DCHECK_EQ(messages.back().type(), |
| 108 static_cast<uint32_t>(ResourceMsg_RequestComplete::ID)); | 108 static_cast<uint32_t>(ResourceMsg_RequestComplete::ID)); |
| 109 Dispatch(messages.back()); | 109 Dispatch(messages.back()); |
| 110 } | 110 } |
| 111 } | 111 } |
| 112 | 112 |
| 113 void URLLoaderClientImpl::OnReceiveResponse( | 113 void URLLoaderClientImpl::OnReceiveResponse( |
| 114 const ResourceResponseHead& response_head, | 114 const ResourceResponseHead& response_head, |
| 115 mojom::DownloadedTempFilePtr downloaded_file) { | 115 mojom::DownloadedTempFileAssociatedPtrInfo downloaded_file) { |
| 116 has_received_response_ = true; | 116 has_received_response_ = true; |
| 117 if (body_consumer_) | 117 if (body_consumer_) |
| 118 body_consumer_->Start(); | 118 body_consumer_->Start(); |
| 119 downloaded_file_ = std::move(downloaded_file); | 119 downloaded_file_.Bind(std::move(downloaded_file)); |
| 120 Dispatch(ResourceMsg_ReceivedResponse(request_id_, response_head)); | 120 Dispatch(ResourceMsg_ReceivedResponse(request_id_, response_head)); |
| 121 } | 121 } |
| 122 | 122 |
| 123 void URLLoaderClientImpl::OnReceiveRedirect( | 123 void URLLoaderClientImpl::OnReceiveRedirect( |
| 124 const net::RedirectInfo& redirect_info, | 124 const net::RedirectInfo& redirect_info, |
| 125 const ResourceResponseHead& response_head) { | 125 const ResourceResponseHead& response_head) { |
| 126 DCHECK(!has_received_response_); | 126 DCHECK(!has_received_response_); |
| 127 DCHECK(!body_consumer_); | 127 DCHECK(!body_consumer_); |
| 128 Dispatch( | 128 Dispatch( |
| 129 ResourceMsg_ReceivedRedirect(request_id_, redirect_info, response_head)); | 129 ResourceMsg_ReceivedRedirect(request_id_, redirect_info, response_head)); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 deferred_messages_.push_back(message); | 168 deferred_messages_.push_back(message); |
| 169 } else if (deferred_messages_.size() > 0) { | 169 } else if (deferred_messages_.size() > 0) { |
| 170 deferred_messages_.push_back(message); | 170 deferred_messages_.push_back(message); |
| 171 FlushDeferredMessages(); | 171 FlushDeferredMessages(); |
| 172 } else { | 172 } else { |
| 173 resource_dispatcher_->DispatchMessage(message); | 173 resource_dispatcher_->DispatchMessage(message); |
| 174 } | 174 } |
| 175 } | 175 } |
| 176 | 176 |
| 177 } // namespace content | 177 } // namespace content |
| OLD | NEW |