| 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 "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 void IPCResourceLoaderBridge::SetDefersLoading(bool value) { | 208 void IPCResourceLoaderBridge::SetDefersLoading(bool value) { |
| 209 if (request_id_ < 0) { | 209 if (request_id_ < 0) { |
| 210 NOTREACHED() << "Trying to (un)defer an unstarted request"; | 210 NOTREACHED() << "Trying to (un)defer an unstarted request"; |
| 211 return; | 211 return; |
| 212 } | 212 } |
| 213 | 213 |
| 214 dispatcher_->SetDefersLoading(request_id_, value); | 214 dispatcher_->SetDefersLoading(request_id_, value); |
| 215 } | 215 } |
| 216 | 216 |
| 217 void IPCResourceLoaderBridge::DidChangePriority( | 217 void IPCResourceLoaderBridge::DidChangePriority( |
| 218 net::RequestPriority new_priority, int intra_priority_value) { | 218 net::RequestPriority new_priority, |
| 219 int intra_priority_value) { |
| 219 if (request_id_ < 0) { | 220 if (request_id_ < 0) { |
| 220 NOTREACHED() << "Trying to change priority of an unstarted request"; | 221 NOTREACHED() << "Trying to change priority of an unstarted request"; |
| 221 return; | 222 return; |
| 222 } | 223 } |
| 223 | 224 |
| 224 dispatcher_->DidChangePriority(routing_id_, request_id_, new_priority, | 225 dispatcher_->DidChangePriority( |
| 225 intra_priority_value); | 226 request_id_, new_priority, intra_priority_value); |
| 226 } | 227 } |
| 227 | 228 |
| 228 void IPCResourceLoaderBridge::SyncLoad(SyncLoadResponse* response) { | 229 void IPCResourceLoaderBridge::SyncLoad(SyncLoadResponse* response) { |
| 229 if (request_id_ != -1) { | 230 if (request_id_ != -1) { |
| 230 NOTREACHED() << "Starting a request twice"; | 231 NOTREACHED() << "Starting a request twice"; |
| 231 response->error_code = net::ERR_FAILED; | 232 response->error_code = net::ERR_FAILED; |
| 232 return; | 233 return; |
| 233 } | 234 } |
| 234 | 235 |
| 235 request_id_ = MakeRequestID(); | 236 request_id_ = MakeRequestID(); |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 FollowPendingRedirect(request_id, request_info); | 669 FollowPendingRedirect(request_id, request_info); |
| 669 | 670 |
| 670 base::MessageLoop::current()->PostTask( | 671 base::MessageLoop::current()->PostTask( |
| 671 FROM_HERE, | 672 FROM_HERE, |
| 672 base::Bind(&ResourceDispatcher::FlushDeferredMessages, | 673 base::Bind(&ResourceDispatcher::FlushDeferredMessages, |
| 673 weak_factory_.GetWeakPtr(), | 674 weak_factory_.GetWeakPtr(), |
| 674 request_id)); | 675 request_id)); |
| 675 } | 676 } |
| 676 } | 677 } |
| 677 | 678 |
| 678 void ResourceDispatcher::DidChangePriority(int routing_id, | 679 void ResourceDispatcher::DidChangePriority(int request_id, |
| 679 int request_id, | |
| 680 net::RequestPriority new_priority, | 680 net::RequestPriority new_priority, |
| 681 int intra_priority_value) { | 681 int intra_priority_value) { |
| 682 DCHECK(ContainsKey(pending_requests_, request_id)); | 682 DCHECK(ContainsKey(pending_requests_, request_id)); |
| 683 message_sender()->Send(new ResourceHostMsg_DidChangePriority( | 683 message_sender()->Send(new ResourceHostMsg_DidChangePriority( |
| 684 request_id, new_priority, intra_priority_value)); | 684 request_id, new_priority, intra_priority_value)); |
| 685 } | 685 } |
| 686 | 686 |
| 687 ResourceDispatcher::PendingRequestInfo::PendingRequestInfo() | 687 ResourceDispatcher::PendingRequestInfo::PendingRequestInfo() |
| 688 : peer(NULL), | 688 : peer(NULL), |
| 689 resource_type(ResourceType::SUB_RESOURCE), | 689 resource_type(ResourceType::SUB_RESOURCE), |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) { | 871 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) { |
| 872 while (!queue->empty()) { | 872 while (!queue->empty()) { |
| 873 IPC::Message* message = queue->front(); | 873 IPC::Message* message = queue->front(); |
| 874 ReleaseResourcesInDataMessage(*message); | 874 ReleaseResourcesInDataMessage(*message); |
| 875 queue->pop_front(); | 875 queue->pop_front(); |
| 876 delete message; | 876 delete message; |
| 877 } | 877 } |
| 878 } | 878 } |
| 879 | 879 |
| 880 } // namespace content | 880 } // namespace content |
| OLD | NEW |