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

Unified Diff: content/child/resource_dispatcher.cc

Issue 2566943002: Dispatch transfer size update notification on mojo-loading (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
« no previous file with comments | « content/child/resource_dispatcher.h ('k') | content/common/url_loader.mojom » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/resource_dispatcher.cc
diff --git a/content/child/resource_dispatcher.cc b/content/child/resource_dispatcher.cc
index bdabb9f8a05407a1f4f7d43f6e3d2f171d3f0cd3..fcd3270b4047120ff2e2716c104423268019aad7 100644
--- a/content/child/resource_dispatcher.cc
+++ b/content/child/resource_dispatcher.cc
@@ -114,6 +114,11 @@ class URLLoaderClientImpl final : public mojom::URLLoaderClient {
ResourceMsg_DataDownloaded(request_id_, data_len, encoded_data_len));
}
+ void OnTransferSizeUpdated(int32_t transfer_size_diff) override {
+ resource_dispatcher_->OnTransferSizeUpdated(request_id_,
+ transfer_size_diff);
+ }
+
void OnStartLoadingResponseBody(
mojo::ScopedDataPipeConsumerHandle body) override {
DCHECK(!body_consumer_);
@@ -549,12 +554,11 @@ void ResourceDispatcher::Cancel(int request_id) {
}
void ResourceDispatcher::SetDefersLoading(int request_id, bool value) {
- PendingRequestMap::iterator it = pending_requests_.find(request_id);
- if (it == pending_requests_.end()) {
+ PendingRequestInfo* request_info = GetPendingRequestInfo(request_id);
+ if (!request_info) {
DLOG(ERROR) << "unknown request";
return;
}
- PendingRequestInfo* request_info = it->second.get();
if (value) {
request_info->is_deferred = value;
} else if (request_info->is_deferred) {
@@ -576,6 +580,18 @@ void ResourceDispatcher::DidChangePriority(int request_id,
request_id, new_priority, intra_priority_value));
}
+void ResourceDispatcher::OnTransferSizeUpdated(int request_id,
+ int32_t transfer_size_diff) {
+ DCHECK_GT(transfer_size_diff, 0);
+ PendingRequestInfo* request_info = GetPendingRequestInfo(request_id);
+ if (!request_info)
+ return;
+
+ // TODO(yhirano): Consider using int64_t in
+ // RequestPeer::OnTransferSizeUpdated.
+ request_info->peer->OnTransferSizeUpdated(transfer_size_diff);
+}
+
ResourceDispatcher::PendingRequestInfo::PendingRequestInfo(
std::unique_ptr<RequestPeer> peer,
ResourceType resource_type,
« no previous file with comments | « content/child/resource_dispatcher.h ('k') | content/common/url_loader.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698