Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1018)

Unified Diff: content/child/resource_dispatcher.cc

Issue 2540023003: Dispatch encoded_data_length separately in content/child (Closed)
Patch Set: fix Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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));

Powered by Google App Engine
This is Rietveld 408576698