| 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 #include <set> | 5 #include <set> |
| 6 | 6 |
| 7 #include "content/browser/loader/resource_scheduler.h" | 7 #include "content/browser/loader/resource_scheduler.h" |
| 8 | 8 |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "content/common/resource_messages.h" | 10 #include "content/common/resource_messages.h" |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 | 330 |
| 331 void ClearInFlightRequests() { | 331 void ClearInFlightRequests() { |
| 332 in_flight_requests_.clear(); | 332 in_flight_requests_.clear(); |
| 333 total_delayable_count_ = 0; | 333 total_delayable_count_ = 0; |
| 334 } | 334 } |
| 335 | 335 |
| 336 bool IsDelayableRequest(ScheduledResourceRequest* request) { | 336 bool IsDelayableRequest(ScheduledResourceRequest* request) { |
| 337 if (request->url_request()->priority() < net::LOW) { | 337 if (request->url_request()->priority() < net::LOW) { |
| 338 net::HostPortPair host_port_pair = | 338 net::HostPortPair host_port_pair = |
| 339 net::HostPortPair::FromURL(request->url_request()->url()); | 339 net::HostPortPair::FromURL(request->url_request()->url()); |
| 340 const net::HttpServerProperties& http_server_properties = | 340 net::HttpServerProperties& http_server_properties = |
| 341 *request->url_request()->context()->http_server_properties(); | 341 *request->url_request()->context()->http_server_properties(); |
| 342 if (!http_server_properties.SupportsSpdy(host_port_pair)) { | 342 if (!http_server_properties.SupportsSpdy(host_port_pair)) { |
| 343 return true; | 343 return true; |
| 344 } | 344 } |
| 345 } | 345 } |
| 346 return false; | 346 return false; |
| 347 } | 347 } |
| 348 | 348 |
| 349 void SetRequestDelayable(ScheduledResourceRequest* request, | 349 void SetRequestDelayable(ScheduledResourceRequest* request, |
| 350 bool delayable) { | 350 bool delayable) { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 // TODO(simonjam): This may end up causing disk contention. We should | 403 // TODO(simonjam): This may end up causing disk contention. We should |
| 404 // experiment with throttling if that happens. | 404 // experiment with throttling if that happens. |
| 405 if (!url_request.url().SchemeIsHTTPOrHTTPS()) { | 405 if (!url_request.url().SchemeIsHTTPOrHTTPS()) { |
| 406 return START_REQUEST; | 406 return START_REQUEST; |
| 407 } | 407 } |
| 408 | 408 |
| 409 if (using_spdy_proxy_ && url_request.url().SchemeIs("http")) { | 409 if (using_spdy_proxy_ && url_request.url().SchemeIs("http")) { |
| 410 return START_REQUEST; | 410 return START_REQUEST; |
| 411 } | 411 } |
| 412 | 412 |
| 413 const net::HttpServerProperties& http_server_properties = | 413 net::HttpServerProperties& http_server_properties = |
| 414 *url_request.context()->http_server_properties(); | 414 *url_request.context()->http_server_properties(); |
| 415 | 415 |
| 416 if (url_request.priority() >= net::LOW || | 416 if (url_request.priority() >= net::LOW || |
| 417 !ResourceRequestInfo::ForRequest(&url_request)->IsAsync()) { | 417 !ResourceRequestInfo::ForRequest(&url_request)->IsAsync()) { |
| 418 return START_REQUEST; | 418 return START_REQUEST; |
| 419 } | 419 } |
| 420 | 420 |
| 421 net::HostPortPair host_port_pair = | 421 net::HostPortPair host_port_pair = |
| 422 net::HostPortPair::FromURL(url_request.url()); | 422 net::HostPortPair::FromURL(url_request.url()); |
| 423 | 423 |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 client->ReprioritizeRequest( | 649 client->ReprioritizeRequest( |
| 650 request, old_priority_params, new_priority_params); | 650 request, old_priority_params, new_priority_params); |
| 651 } | 651 } |
| 652 | 652 |
| 653 ResourceScheduler::ClientId ResourceScheduler::MakeClientId( | 653 ResourceScheduler::ClientId ResourceScheduler::MakeClientId( |
| 654 int child_id, int route_id) { | 654 int child_id, int route_id) { |
| 655 return (static_cast<ResourceScheduler::ClientId>(child_id) << 32) | route_id; | 655 return (static_cast<ResourceScheduler::ClientId>(child_id) << 32) | route_id; |
| 656 } | 656 } |
| 657 | 657 |
| 658 } // namespace content | 658 } // namespace content |
| OLD | NEW |