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 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
993 | 993 |
994 // Add the memory estimate that starting this request will consume. | 994 // Add the memory estimate that starting this request will consume. |
995 info->memory_cost = CalculateApproximateMemoryCost(request); | 995 info->memory_cost = CalculateApproximateMemoryCost(request); |
996 int memory_cost = IncrementOutstandingRequestsMemoryCost( | 996 int memory_cost = IncrementOutstandingRequestsMemoryCost( |
997 info->memory_cost, | 997 info->memory_cost, |
998 info->process_id); | 998 info->process_id); |
999 | 999 |
1000 // If enqueing/starting this request will exceed our per-process memory | 1000 // If enqueing/starting this request will exceed our per-process memory |
1001 // bound, abort it right away. | 1001 // bound, abort it right away. |
1002 if (memory_cost > max_outstanding_requests_cost_per_process_) { | 1002 if (memory_cost > max_outstanding_requests_cost_per_process_) { |
1003 // We call "CancelWithError()" as a way of setting the URLRequest's | 1003 // We call "SimulateError()" as a way of setting the URLRequest's |
1004 // status -- it has no effect beyond this, since the request hasn't started. | 1004 // status -- it has no effect beyond this, since the request hasn't started. |
1005 request->SimulateError(net::ERR_INSUFFICIENT_RESOURCES); | 1005 request->SimulateError(net::ERR_INSUFFICIENT_RESOURCES); |
1006 | 1006 |
1007 // TODO(eroman): this is kinda funky -- we insert the unstarted request into | 1007 // TODO(eroman): this is kinda funky -- we insert the unstarted request into |
1008 // |pending_requests_| simply to please OnResponseCompleted(). | 1008 // |pending_requests_| simply to please OnResponseCompleted(). |
1009 GlobalRequestID global_id(info->process_id, info->request_id); | 1009 GlobalRequestID global_id(info->process_id, info->request_id); |
1010 pending_requests_[global_id] = request; | 1010 pending_requests_[global_id] = request; |
1011 OnResponseCompleted(request); | 1011 OnResponseCompleted(request); |
1012 return; | 1012 return; |
1013 } | 1013 } |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1531 case ViewHostMsg_UploadProgress_ACK::ID: | 1531 case ViewHostMsg_UploadProgress_ACK::ID: |
1532 case ViewHostMsg_SyncLoad::ID: | 1532 case ViewHostMsg_SyncLoad::ID: |
1533 return true; | 1533 return true; |
1534 | 1534 |
1535 default: | 1535 default: |
1536 break; | 1536 break; |
1537 } | 1537 } |
1538 | 1538 |
1539 return false; | 1539 return false; |
1540 } | 1540 } |
OLD | NEW |