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

Side by Side Diff: chrome/common/resource_dispatcher.cc

Issue 27168: IPC messages and changes to ResourceLoaderBridge to support resource loading for media (Closed)
Patch Set: add mac/linux build and fixed unit test failures Created 11 years, 9 months 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 unified diff | Download patch
« no previous file with comments | « chrome/common/resource_dispatcher.h ('k') | net/base/load_flags.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 return true; 268 return true;
269 } 269 }
270 // Make sure any deferred messages are dispatched before we dispatch more. 270 // Make sure any deferred messages are dispatched before we dispatch more.
271 if (!request_info.deferred_message_queue.empty()) 271 if (!request_info.deferred_message_queue.empty())
272 FlushDeferredMessages(request_id); 272 FlushDeferredMessages(request_id);
273 273
274 DispatchMessage(message); 274 DispatchMessage(message);
275 return true; 275 return true;
276 } 276 }
277 277
278 void ResourceDispatcher::OnDownloadProgress(
279 int request_id, int64 position, int64 size) {
280 // TODO(hclam): delegate this message to
281 // ResourceLoaderBridge::Peer::OnDownloadProgress and send an ACK message
282 // back to ResourceDispatcherHost.
283 }
284
278 void ResourceDispatcher::OnUploadProgress( 285 void ResourceDispatcher::OnUploadProgress(
279 const IPC::Message& message, int request_id, int64 position, int64 size) { 286 const IPC::Message& message, int request_id, int64 position, int64 size) {
280 PendingRequestList::iterator it = pending_requests_.find(request_id); 287 PendingRequestList::iterator it = pending_requests_.find(request_id);
281 if (it == pending_requests_.end()) { 288 if (it == pending_requests_.end()) {
282 // this might happen for kill()ed requests on the webkit end, so perhaps 289 // this might happen for kill()ed requests on the webkit end, so perhaps
283 // it shouldn't be a warning... 290 // it shouldn't be a warning...
284 DLOG(WARNING) << "Got upload progress for a nonexistant or " 291 DLOG(WARNING) << "Got upload progress for a nonexistant or "
285 "finished request"; 292 "finished request";
286 return; 293 return;
287 } 294 }
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 request_info.is_deferred = false; 453 request_info.is_deferred = false;
447 MessageLoop::current()->PostTask(FROM_HERE, 454 MessageLoop::current()->PostTask(FROM_HERE,
448 method_factory_.NewRunnableMethod( 455 method_factory_.NewRunnableMethod(
449 &ResourceDispatcher::FlushDeferredMessages, request_id)); 456 &ResourceDispatcher::FlushDeferredMessages, request_id));
450 } 457 }
451 } 458 }
452 459
453 void ResourceDispatcher::DispatchMessage(const IPC::Message& message) { 460 void ResourceDispatcher::DispatchMessage(const IPC::Message& message) {
454 IPC_BEGIN_MESSAGE_MAP(ResourceDispatcher, message) 461 IPC_BEGIN_MESSAGE_MAP(ResourceDispatcher, message)
455 IPC_MESSAGE_HANDLER(ViewMsg_Resource_UploadProgress, OnUploadProgress) 462 IPC_MESSAGE_HANDLER(ViewMsg_Resource_UploadProgress, OnUploadProgress)
463 IPC_MESSAGE_HANDLER(ViewMsg_Resource_DownloadProgress, OnDownloadProgress)
456 IPC_MESSAGE_HANDLER(ViewMsg_Resource_ReceivedResponse, OnReceivedResponse) 464 IPC_MESSAGE_HANDLER(ViewMsg_Resource_ReceivedResponse, OnReceivedResponse)
457 IPC_MESSAGE_HANDLER(ViewMsg_Resource_ReceivedRedirect, OnReceivedRedirect) 465 IPC_MESSAGE_HANDLER(ViewMsg_Resource_ReceivedRedirect, OnReceivedRedirect)
458 IPC_MESSAGE_HANDLER(ViewMsg_Resource_DataReceived, OnReceivedData) 466 IPC_MESSAGE_HANDLER(ViewMsg_Resource_DataReceived, OnReceivedData)
459 IPC_MESSAGE_HANDLER(ViewMsg_Resource_RequestComplete, OnRequestComplete) 467 IPC_MESSAGE_HANDLER(ViewMsg_Resource_RequestComplete, OnRequestComplete)
460 IPC_END_MESSAGE_MAP() 468 IPC_END_MESSAGE_MAP()
461 } 469 }
462 470
463 void ResourceDispatcher::FlushDeferredMessages(int request_id) { 471 void ResourceDispatcher::FlushDeferredMessages(int request_id) {
464 PendingRequestList::iterator it = pending_requests_.find(request_id); 472 PendingRequestList::iterator it = pending_requests_.find(request_id);
465 if (it == pending_requests_.end()) // The request could have become invalid. 473 if (it == pending_requests_.end()) // The request could have become invalid.
(...skipping 29 matching lines...) Expand all
495 referrer, headers, flags, 503 referrer, headers, flags,
496 origin_pid, resource_type, 504 origin_pid, resource_type,
497 mixed_content, 505 mixed_content,
498 request_context, 506 request_context,
499 route_id); 507 route_id);
500 } 508 }
501 509
502 510
503 bool ResourceDispatcher::IsResourceMessage(const IPC::Message& message) const { 511 bool ResourceDispatcher::IsResourceMessage(const IPC::Message& message) const {
504 switch (message.type()) { 512 switch (message.type()) {
513 case ViewMsg_Resource_DownloadProgress::ID:
505 case ViewMsg_Resource_UploadProgress::ID: 514 case ViewMsg_Resource_UploadProgress::ID:
506 case ViewMsg_Resource_ReceivedResponse::ID: 515 case ViewMsg_Resource_ReceivedResponse::ID:
507 case ViewMsg_Resource_ReceivedRedirect::ID: 516 case ViewMsg_Resource_ReceivedRedirect::ID:
508 case ViewMsg_Resource_DataReceived::ID: 517 case ViewMsg_Resource_DataReceived::ID:
509 case ViewMsg_Resource_RequestComplete::ID: 518 case ViewMsg_Resource_RequestComplete::ID:
510 return true; 519 return true;
511 520
512 default: 521 default:
513 break; 522 break;
514 } 523 }
515 524
516 return false; 525 return false;
517 } 526 }
OLDNEW
« no previous file with comments | « chrome/common/resource_dispatcher.h ('k') | net/base/load_flags.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698