| 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/browser/renderer_host/resource_dispatcher_host.h" | 7 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1005 GlobalRequestID global_id(info->process_id, info->request_id); | 1005 GlobalRequestID global_id(info->process_id, info->request_id); |
| 1006 pending_requests_[global_id] = request; | 1006 pending_requests_[global_id] = request; |
| 1007 OnResponseCompleted(request); | 1007 OnResponseCompleted(request); |
| 1008 return; | 1008 return; |
| 1009 } | 1009 } |
| 1010 | 1010 |
| 1011 std::pair<int, int> pair_id(info->process_id, info->route_id); | 1011 std::pair<int, int> pair_id(info->process_id, info->route_id); |
| 1012 BlockedRequestMap::const_iterator iter = blocked_requests_map_.find(pair_id); | 1012 BlockedRequestMap::const_iterator iter = blocked_requests_map_.find(pair_id); |
| 1013 if (iter != blocked_requests_map_.end()) { | 1013 if (iter != blocked_requests_map_.end()) { |
| 1014 // The request should be blocked. | 1014 // The request should be blocked. |
| 1015 iter->second->push_back(BlockedRequest(request)); | 1015 iter->second->push_back(request); |
| 1016 return; | 1016 return; |
| 1017 } | 1017 } |
| 1018 | 1018 |
| 1019 GlobalRequestID global_id(info->process_id, info->request_id); | 1019 GlobalRequestID global_id(info->process_id, info->request_id); |
| 1020 pending_requests_[global_id] = request; | 1020 pending_requests_[global_id] = request; |
| 1021 if (!SSLManager::ShouldStartRequest(this, request, ui_loop_)) { | 1021 if (!SSLManager::ShouldStartRequest(this, request, ui_loop_)) { |
| 1022 // The SSLManager has told us that we shouldn't start the request yet. The | 1022 // The SSLManager has told us that we shouldn't start the request yet. The |
| 1023 // SSLManager will potentially change the request (potentially to indicate | 1023 // SSLManager will potentially change the request (potentially to indicate |
| 1024 // its content should be filtered) and start it itself. | 1024 // its content should be filtered) and start it itself. |
| 1025 return; | 1025 return; |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1496 | 1496 |
| 1497 BlockedRequestsList* requests = iter->second; | 1497 BlockedRequestsList* requests = iter->second; |
| 1498 | 1498 |
| 1499 // Removing the vector from the map unblocks any subsequent requests. | 1499 // Removing the vector from the map unblocks any subsequent requests. |
| 1500 blocked_requests_map_.erase(iter); | 1500 blocked_requests_map_.erase(iter); |
| 1501 | 1501 |
| 1502 for (BlockedRequestsList::iterator req_iter = requests->begin(); | 1502 for (BlockedRequestsList::iterator req_iter = requests->begin(); |
| 1503 req_iter != requests->end(); ++req_iter) { | 1503 req_iter != requests->end(); ++req_iter) { |
| 1504 // Remove the memory credit that we added when pushing the request onto | 1504 // Remove the memory credit that we added when pushing the request onto |
| 1505 // the blocked list. | 1505 // the blocked list. |
| 1506 ExtraRequestInfo* info = ExtraInfoForRequest(req_iter->url_request); | 1506 URLRequest* request = *req_iter; |
| 1507 ExtraRequestInfo* info = ExtraInfoForRequest(request); |
| 1507 IncrementOutstandingRequestsMemoryCost(-1 * info->memory_cost, | 1508 IncrementOutstandingRequestsMemoryCost(-1 * info->memory_cost, |
| 1508 info->process_id); | 1509 info->process_id); |
| 1509 if (cancel_requests) | 1510 if (cancel_requests) |
| 1510 delete req_iter->url_request; | 1511 delete request; |
| 1511 else | 1512 else |
| 1512 BeginRequestInternal(req_iter->url_request); | 1513 BeginRequestInternal(request); |
| 1513 } | 1514 } |
| 1514 | 1515 |
| 1515 delete requests; | 1516 delete requests; |
| 1516 } | 1517 } |
| 1517 | 1518 |
| 1518 bool ResourceDispatcherHost::IsResourceDispatcherHostMessage( | 1519 bool ResourceDispatcherHost::IsResourceDispatcherHostMessage( |
| 1519 const IPC::Message& message) { | 1520 const IPC::Message& message) { |
| 1520 switch (message.type()) { | 1521 switch (message.type()) { |
| 1521 case ViewHostMsg_RequestResource::ID: | 1522 case ViewHostMsg_RequestResource::ID: |
| 1522 case ViewHostMsg_CancelRequest::ID: | 1523 case ViewHostMsg_CancelRequest::ID: |
| 1523 case ViewHostMsg_ClosePage_ACK::ID: | 1524 case ViewHostMsg_ClosePage_ACK::ID: |
| 1524 case ViewHostMsg_DataReceived_ACK::ID: | 1525 case ViewHostMsg_DataReceived_ACK::ID: |
| 1525 case ViewHostMsg_UploadProgress_ACK::ID: | 1526 case ViewHostMsg_UploadProgress_ACK::ID: |
| 1526 case ViewHostMsg_SyncLoad::ID: | 1527 case ViewHostMsg_SyncLoad::ID: |
| 1527 return true; | 1528 return true; |
| 1528 | 1529 |
| 1529 default: | 1530 default: |
| 1530 break; | 1531 break; |
| 1531 } | 1532 } |
| 1532 | 1533 |
| 1533 return false; | 1534 return false; |
| 1534 } | 1535 } |
| OLD | NEW |