| 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 downloaded_file_ = std::move(downloaded_file); | 117 downloaded_file_.Bind(std::move(downloaded_file)); |
| 118 Dispatch(ResourceMsg_ReceivedResponse(request_id_, response_head)); | 118 Dispatch(ResourceMsg_ReceivedResponse(request_id_, response_head)); |
| 119 } | 119 } |
| 120 | 120 |
| 121 void URLLoaderClientImpl::OnReceiveRedirect( | 121 void URLLoaderClientImpl::OnReceiveRedirect( |
| 122 const net::RedirectInfo& redirect_info, | 122 const net::RedirectInfo& redirect_info, |
| 123 const ResourceResponseHead& response_head) { | 123 const ResourceResponseHead& response_head) { |
| 124 DCHECK(!has_received_response_); | 124 DCHECK(!has_received_response_); |
| 125 DCHECK(!body_consumer_); | 125 DCHECK(!body_consumer_); |
| 126 Dispatch( | 126 Dispatch( |
| 127 ResourceMsg_ReceivedRedirect(request_id_, redirect_info, response_head)); | 127 ResourceMsg_ReceivedRedirect(request_id_, redirect_info, response_head)); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 deferred_messages_.push_back(message); | 172 deferred_messages_.push_back(message); |
| 173 } else if (deferred_messages_.size() > 0) { | 173 } else if (deferred_messages_.size() > 0) { |
| 174 deferred_messages_.push_back(message); | 174 deferred_messages_.push_back(message); |
| 175 FlushDeferredMessages(); | 175 FlushDeferredMessages(); |
| 176 } else { | 176 } else { |
| 177 resource_dispatcher_->DispatchMessage(message); | 177 resource_dispatcher_->DispatchMessage(message); |
| 178 } | 178 } |
| 179 } | 179 } |
| 180 | 180 |
| 181 } // namespace content | 181 } // namespace content |
| OLD | NEW |