| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/child/resource_dispatcher.h" | 7 #include "content/child/resource_dispatcher.h" |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 | 501 |
| 502 main_thread_task_runner_->PostTask( | 502 main_thread_task_runner_->PostTask( |
| 503 FROM_HERE, base::Bind(&ResourceDispatcher::FlushDeferredMessages, | 503 FROM_HERE, base::Bind(&ResourceDispatcher::FlushDeferredMessages, |
| 504 weak_factory_.GetWeakPtr(), request_id)); | 504 weak_factory_.GetWeakPtr(), request_id)); |
| 505 } | 505 } |
| 506 } | 506 } |
| 507 | 507 |
| 508 void ResourceDispatcher::DidChangePriority(int request_id, | 508 void ResourceDispatcher::DidChangePriority(int request_id, |
| 509 net::RequestPriority new_priority, | 509 net::RequestPriority new_priority, |
| 510 int intra_priority_value) { | 510 int intra_priority_value) { |
| 511 DCHECK(base::ContainsKey(pending_requests_, request_id)); | 511 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); |
| 512 message_sender_->Send(new ResourceHostMsg_DidChangePriority( | 512 DCHECK(request_info); |
| 513 request_id, new_priority, intra_priority_value)); | 513 if (request_info->url_loader) { |
| 514 request_info->url_loader->SetPriority(new_priority, intra_priority_value); |
| 515 } else { |
| 516 message_sender_->Send(new ResourceHostMsg_DidChangePriority( |
| 517 request_id, new_priority, intra_priority_value)); |
| 518 } |
| 514 } | 519 } |
| 515 | 520 |
| 516 void ResourceDispatcher::OnTransferSizeUpdated(int request_id, | 521 void ResourceDispatcher::OnTransferSizeUpdated(int request_id, |
| 517 int32_t transfer_size_diff) { | 522 int32_t transfer_size_diff) { |
| 518 DCHECK_GT(transfer_size_diff, 0); | 523 DCHECK_GT(transfer_size_diff, 0); |
| 519 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); | 524 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); |
| 520 if (!request_info) | 525 if (!request_info) |
| 521 return; | 526 return; |
| 522 | 527 |
| 523 // TODO(yhirano): Consider using int64_t in | 528 // TODO(yhirano): Consider using int64_t in |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 delete message; | 822 delete message; |
| 818 } | 823 } |
| 819 } | 824 } |
| 820 | 825 |
| 821 void ResourceDispatcher::SetResourceSchedulingFilter( | 826 void ResourceDispatcher::SetResourceSchedulingFilter( |
| 822 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter) { | 827 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter) { |
| 823 resource_scheduling_filter_ = resource_scheduling_filter; | 828 resource_scheduling_filter_ = resource_scheduling_filter; |
| 824 } | 829 } |
| 825 | 830 |
| 826 } // namespace content | 831 } // namespace content |
| OLD | NEW |