diff options
author | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-05 07:41:14 +0000 |
---|---|---|
committer | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-05 07:41:14 +0000 |
commit | 8b7ec052680f7756e5eee535c3028cf3835fc0e1 (patch) | |
tree | c4c65aa1ca15ff82bf5294db95d7d590b63a617e /chrome/common | |
parent | 4fcbbc7fd228382b4154ad8ad7b973741e68a058 (diff) | |
download | chromium_src-8b7ec052680f7756e5eee535c3028cf3835fc0e1.zip chromium_src-8b7ec052680f7756e5eee535c3028cf3835fc0e1.tar.gz chromium_src-8b7ec052680f7756e5eee535c3028cf3835fc0e1.tar.bz2 |
Implementation of ResourceDispatcher::OnDownloadProgress
Implemented ResourceDispatcher::OnDownloadProgress to handle
ViewMsg_DownloadProgress IPC message, implementation is a clone of
ResourceDispatcher::OnUploadProgress because they have identical behavior.
Review URL: http://codereview.chromium.org/39104
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10975 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r-- | chrome/common/resource_dispatcher.cc | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/chrome/common/resource_dispatcher.cc b/chrome/common/resource_dispatcher.cc index 709efed..cd78b0e 100644 --- a/chrome/common/resource_dispatcher.cc +++ b/chrome/common/resource_dispatcher.cc @@ -280,9 +280,25 @@ bool ResourceDispatcher::OnMessageReceived(const IPC::Message& message) { void ResourceDispatcher::OnDownloadProgress( int request_id, int64 position, int64 size) { - // TODO(hclam): delegate this message to - // ResourceLoaderBridge::Peer::OnDownloadProgress and send an ACK message - // back to ResourceDispatcherHost. + PendingRequestList::iterator it = pending_requests_.find(request_id); + if (it == pending_requests_.end()) { + DLOG(WARNING) << "Got download progress for a nonexistant or " + " finished requests"; + return; + } + + PendingRequestInfo& request_info = it->second; + + RESOURCE_LOG("Dispatching download progress for " << + request_info.peer->GetURLForDebugging()); + request_info.peer->OnDownloadProgress(position, size); + + // Send the ACK message back. + IPC::Message::Sender* sender = message_sender(); + if (sender) { + sender->Send( + new ViewHostMsg_DownloadProgress_ACK(MSG_ROUTING_NONE, request_id)); + } } void ResourceDispatcher::OnUploadProgress( |