Index: content/child/resource_dispatcher.cc |
diff --git a/content/child/resource_dispatcher.cc b/content/child/resource_dispatcher.cc |
index f8f9126c4a63ae5fcdb4dfa4bd48e858a5dc4b34..1f1cf3e8f5a576156444be7905759d19cb6f3c28 100644 |
--- a/content/child/resource_dispatcher.cc |
+++ b/content/child/resource_dispatcher.cc |
@@ -331,7 +331,12 @@ void ResourceDispatcher::OnReceivedInlinedDataChunk( |
DCHECK(!request_info->buffer.get()); |
request_info->peer->OnReceivedData( |
- base::MakeUnique<content::FixedReceivedData>(data, encoded_data_length)); |
+ base::MakeUnique<content::FixedReceivedData>(data)); |
+ |
+ // Get the request info again as the client callback may modify the info. |
+ request_info = GetPendingRequestInfo(request_id); |
+ if (request_info && encoded_data_length > 0) |
+ request_info->peer->OnTransferSizeUpdated(encoded_data_length); |
} |
void ResourceDispatcher::OnReceivedData(int request_id, |
@@ -360,13 +365,17 @@ void ResourceDispatcher::OnReceivedData(int request_id, |
} |
std::unique_ptr<RequestPeer::ReceivedData> data = |
- request_info->received_data_factory->Create(data_offset, data_length, |
- encoded_data_length); |
+ request_info->received_data_factory->Create(data_offset, data_length); |
// |data| takes care of ACKing. |
send_ack = false; |
request_info->peer->OnReceivedData(std::move(data)); |
} |
+ // Get the request info again as the client callback may modify the info. |
+ request_info = GetPendingRequestInfo(request_id); |
+ if (request_info && encoded_data_length > 0) |
+ request_info->peer->OnTransferSizeUpdated(encoded_data_length); |
+ |
// Acknowledge the reception of this data. |
if (send_ack) |
message_sender_->Send(new ResourceHostMsg_DataReceived_ACK(request_id)); |