OLD | NEW |
---|---|
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading | 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading |
6 | 6 |
7 #include "chrome/common/resource_dispatcher.h" | 7 #include "chrome/common/resource_dispatcher.h" |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
273 // Make sure any deferred messages are dispatched before we dispatch more. | 273 // Make sure any deferred messages are dispatched before we dispatch more. |
274 if (!request_info.deferred_message_queue.empty()) | 274 if (!request_info.deferred_message_queue.empty()) |
275 FlushDeferredMessages(request_id); | 275 FlushDeferredMessages(request_id); |
276 | 276 |
277 DispatchMessage(message); | 277 DispatchMessage(message); |
278 return true; | 278 return true; |
279 } | 279 } |
280 | 280 |
281 void ResourceDispatcher::OnDownloadProgress( | 281 void ResourceDispatcher::OnDownloadProgress( |
282 int request_id, int64 position, int64 size) { | 282 int request_id, int64 position, int64 size) { |
283 // TODO(hclam): delegate this message to | 283 PendingRequestList::iterator it = pending_requests_.find(request_id); |
284 // ResourceLoaderBridge::Peer::OnDownloadProgress and send an ACK message | 284 if (it == pending_requests_.end()) { |
285 // back to ResourceDispatcherHost. | 285 DLOG(WARNING) << "Got download progress for a nonexistant or " |
Erik does not do reviews
2009/03/04 17:55:44
should this be a DCHECK?
Alpha Left Google
2009/03/05 00:32:06
I guess browser process can accidentally send reso
| |
286 " finished requests"; | |
287 return; | |
288 } | |
289 | |
290 PendingRequestInfo& request_info = it->second; | |
291 | |
292 RESOURCE_LOG("Dispatching download progress for " << | |
Erik does not do reviews
2009/03/04 17:55:44
this log macro looks different than our normal sty
Alpha Left Google
2009/03/05 00:32:06
It looks strange to me too, but seems the whole fi
| |
293 request_info.peer->GetURLForDebugging()); | |
294 request_info.peer->OnDownloadProgress(position, size); | |
Erik does not do reviews
2009/03/04 17:55:44
is request_info.peer guaranteed to be non-null? D
Alpha Left Google
2009/03/05 00:32:06
This assumption is made throughout this file too.
| |
295 | |
296 // Send the ACK message back. | |
297 IPC::Message::Sender* sender = message_sender(); | |
298 if (sender) | |
Erik does not do reviews
2009/03/04 17:55:44
Since the contents of the if wrap to multiple line
Alpha Left Google
2009/03/05 00:32:06
Done.
| |
299 sender->Send( | |
300 new ViewHostMsg_DownloadProgress_ACK(MSG_ROUTING_NONE, request_id)); | |
286 } | 301 } |
287 | 302 |
288 void ResourceDispatcher::OnUploadProgress( | 303 void ResourceDispatcher::OnUploadProgress( |
289 int request_id, int64 position, int64 size) { | 304 int request_id, int64 position, int64 size) { |
290 PendingRequestList::iterator it = pending_requests_.find(request_id); | 305 PendingRequestList::iterator it = pending_requests_.find(request_id); |
291 if (it == pending_requests_.end()) { | 306 if (it == pending_requests_.end()) { |
292 // this might happen for kill()ed requests on the webkit end, so perhaps | 307 // this might happen for kill()ed requests on the webkit end, so perhaps |
293 // it shouldn't be a warning... | 308 // it shouldn't be a warning... |
294 DLOG(WARNING) << "Got upload progress for a nonexistant or " | 309 DLOG(WARNING) << "Got upload progress for a nonexistant or " |
295 "finished request"; | 310 "finished request"; |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
521 case ViewMsg_Resource_RequestComplete::ID: | 536 case ViewMsg_Resource_RequestComplete::ID: |
522 return true; | 537 return true; |
523 | 538 |
524 default: | 539 default: |
525 break; | 540 break; |
526 } | 541 } |
527 | 542 |
528 return false; | 543 return false; |
529 } | 544 } |
530 | 545 |
OLD | NEW |