Chromium Code Reviews| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 121 ResourceScheduler* scheduler, | 121 ResourceScheduler* scheduler, |
| 122 const RequestPriorityParams& priority) | 122 const RequestPriorityParams& priority) |
| 123 : ResourceMessageDelegate(request), | 123 : ResourceMessageDelegate(request), |
| 124 client_id_(client_id), | 124 client_id_(client_id), |
| 125 request_(request), | 125 request_(request), |
| 126 ready_(false), | 126 ready_(false), |
| 127 deferred_(false), | 127 deferred_(false), |
| 128 scheduler_(scheduler), | 128 scheduler_(scheduler), |
| 129 priority_(priority), | 129 priority_(priority), |
| 130 fifo_ordering_(0), | 130 fifo_ordering_(0), |
| 131 accounted_as_delayable_request_(false) { | 131 category_(NORMAL_REQUEST) { |
| 132 TRACE_EVENT_ASYNC_BEGIN1("net", "URLRequest", request_, | 132 TRACE_EVENT_ASYNC_BEGIN1("net", "URLRequest", request_, |
| 133 "url", request->url().spec()); | 133 "url", request->url().spec()); |
| 134 } | 134 } |
| 135 | 135 |
| 136 virtual ~ScheduledResourceRequest() { | 136 virtual ~ScheduledResourceRequest() { |
| 137 scheduler_->RemoveRequest(this); | 137 scheduler_->RemoveRequest(this); |
| 138 } | 138 } |
| 139 | 139 |
| 140 void Start() { | 140 void Start() { |
| 141 TRACE_EVENT_ASYNC_STEP_PAST0("net", "URLRequest", request_, "Queued"); | 141 TRACE_EVENT_ASYNC_STEP_PAST0("net", "URLRequest", request_, "Queued"); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 152 const RequestPriorityParams& get_request_priority_params() const { | 152 const RequestPriorityParams& get_request_priority_params() const { |
| 153 return priority_; | 153 return priority_; |
| 154 } | 154 } |
| 155 const ClientId& client_id() const { return client_id_; } | 155 const ClientId& client_id() const { return client_id_; } |
| 156 net::URLRequest* url_request() { return request_; } | 156 net::URLRequest* url_request() { return request_; } |
| 157 const net::URLRequest* url_request() const { return request_; } | 157 const net::URLRequest* url_request() const { return request_; } |
| 158 uint32 fifo_ordering() const { return fifo_ordering_; } | 158 uint32 fifo_ordering() const { return fifo_ordering_; } |
| 159 void set_fifo_ordering(uint32 fifo_ordering) { | 159 void set_fifo_ordering(uint32 fifo_ordering) { |
| 160 fifo_ordering_ = fifo_ordering; | 160 fifo_ordering_ = fifo_ordering; |
| 161 } | 161 } |
| 162 bool accounted_as_delayable_request() const { | 162 RequestCategory category() const { |
| 163 return accounted_as_delayable_request_; | 163 return category_; |
| 164 } | 164 } |
| 165 void set_accounted_as_delayable_request(bool accounted) { | 165 void set_category(RequestCategory category) { |
| 166 accounted_as_delayable_request_ = accounted; | 166 category_ = category; |
| 167 } | 167 } |
| 168 | 168 |
| 169 private: | 169 private: |
| 170 // ResourceMessageDelegate interface: | 170 // ResourceMessageDelegate interface: |
| 171 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { | 171 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { |
| 172 bool handled = true; | 172 bool handled = true; |
| 173 IPC_BEGIN_MESSAGE_MAP(ScheduledResourceRequest, message) | 173 IPC_BEGIN_MESSAGE_MAP(ScheduledResourceRequest, message) |
| 174 IPC_MESSAGE_HANDLER(ResourceHostMsg_DidChangePriority, DidChangePriority) | 174 IPC_MESSAGE_HANDLER(ResourceHostMsg_DidChangePriority, DidChangePriority) |
| 175 IPC_MESSAGE_UNHANDLED(handled = false) | 175 IPC_MESSAGE_UNHANDLED(handled = false) |
| 176 IPC_END_MESSAGE_MAP() | 176 IPC_END_MESSAGE_MAP() |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 188 | 188 |
| 189 void DidChangePriority(int request_id, net::RequestPriority new_priority, | 189 void DidChangePriority(int request_id, net::RequestPriority new_priority, |
| 190 int intra_priority_value) { | 190 int intra_priority_value) { |
| 191 scheduler_->ReprioritizeRequest(this, new_priority, intra_priority_value); | 191 scheduler_->ReprioritizeRequest(this, new_priority, intra_priority_value); |
| 192 } | 192 } |
| 193 | 193 |
| 194 ClientId client_id_; | 194 ClientId client_id_; |
| 195 net::URLRequest* request_; | 195 net::URLRequest* request_; |
| 196 bool ready_; | 196 bool ready_; |
| 197 bool deferred_; | 197 bool deferred_; |
| 198 RequestCategory category_; | |
| 198 ResourceScheduler* scheduler_; | 199 ResourceScheduler* scheduler_; |
| 199 RequestPriorityParams priority_; | 200 RequestPriorityParams priority_; |
| 200 uint32 fifo_ordering_; | 201 uint32 fifo_ordering_; |
| 201 // True if the request is delayable in |in_flight_requests_|. | |
| 202 bool accounted_as_delayable_request_; | |
| 203 | 202 |
| 204 DISALLOW_COPY_AND_ASSIGN(ScheduledResourceRequest); | 203 DISALLOW_COPY_AND_ASSIGN(ScheduledResourceRequest); |
| 205 }; | 204 }; |
| 206 | 205 |
| 207 bool ResourceScheduler::ScheduledResourceSorter::operator()( | 206 bool ResourceScheduler::ScheduledResourceSorter::operator()( |
| 208 const ScheduledResourceRequest* a, | 207 const ScheduledResourceRequest* a, |
| 209 const ScheduledResourceRequest* b) const { | 208 const ScheduledResourceRequest* b) const { |
| 210 // Want the set to be ordered first by decreasing priority, then by | 209 // Want the set to be ordered first by decreasing priority, then by |
| 211 // decreasing intra_priority. | 210 // decreasing intra_priority. |
| 212 // ie. with (priority, intra_priority) | 211 // ie. with (priority, intra_priority) |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 231 class ResourceScheduler::Client { | 230 class ResourceScheduler::Client { |
| 232 public: | 231 public: |
| 233 explicit Client(ResourceScheduler* scheduler) | 232 explicit Client(ResourceScheduler* scheduler) |
| 234 : is_audible_(false), | 233 : is_audible_(false), |
| 235 is_visible_(false), | 234 is_visible_(false), |
| 236 is_loaded_(false), | 235 is_loaded_(false), |
| 237 is_paused_(false), | 236 is_paused_(false), |
| 238 has_body_(false), | 237 has_body_(false), |
| 239 using_spdy_proxy_(false), | 238 using_spdy_proxy_(false), |
| 240 total_delayable_count_(0), | 239 total_delayable_count_(0), |
| 240 total_critical_count_(0), | |
| 241 throttle_state_(ResourceScheduler::THROTTLED) { | 241 throttle_state_(ResourceScheduler::THROTTLED) { |
| 242 scheduler_ = scheduler; | 242 scheduler_ = scheduler; |
| 243 } | 243 } |
| 244 | 244 |
| 245 ~Client() { | 245 ~Client() { |
| 246 // Update to default state and pause to ensure the scheduler has a | 246 // Update to default state and pause to ensure the scheduler has a |
| 247 // correct count of relevant types of clients. | 247 // correct count of relevant types of clients. |
| 248 is_visible_ = false; | 248 is_visible_ = false; |
| 249 is_audible_ = false; | 249 is_audible_ = false; |
| 250 is_paused_ = true; | 250 is_paused_ = true; |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 271 // Removing this request may have freed up another to load. | 271 // Removing this request may have freed up another to load. |
| 272 LoadAnyStartablePendingRequests(); | 272 LoadAnyStartablePendingRequests(); |
| 273 } | 273 } |
| 274 } | 274 } |
| 275 | 275 |
| 276 RequestSet RemoveAllRequests() { | 276 RequestSet RemoveAllRequests() { |
| 277 RequestSet unowned_requests; | 277 RequestSet unowned_requests; |
| 278 for (RequestSet::iterator it = in_flight_requests_.begin(); | 278 for (RequestSet::iterator it = in_flight_requests_.begin(); |
| 279 it != in_flight_requests_.end(); ++it) { | 279 it != in_flight_requests_.end(); ++it) { |
| 280 unowned_requests.insert(*it); | 280 unowned_requests.insert(*it); |
| 281 (*it)->set_accounted_as_delayable_request(false); | 281 (*it)->set_category(NORMAL_REQUEST); |
| 282 } | 282 } |
| 283 ClearInFlightRequests(); | 283 ClearInFlightRequests(); |
| 284 return unowned_requests; | 284 return unowned_requests; |
| 285 } | 285 } |
| 286 | 286 |
| 287 bool is_active() const { return is_visible_ || is_audible_; } | 287 bool is_active() const { return is_visible_ || is_audible_; } |
| 288 | 288 |
| 289 bool is_loaded() const { return is_loaded_; } | 289 bool is_loaded() const { return is_loaded_; } |
| 290 | 290 |
| 291 void OnAudibilityChanged(bool is_audible) { | 291 void OnAudibilityChanged(bool is_audible) { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 367 | 367 |
| 368 void ReprioritizeRequest(ScheduledResourceRequest* request, | 368 void ReprioritizeRequest(ScheduledResourceRequest* request, |
| 369 RequestPriorityParams old_priority_params, | 369 RequestPriorityParams old_priority_params, |
| 370 RequestPriorityParams new_priority_params) { | 370 RequestPriorityParams new_priority_params) { |
| 371 request->url_request()->SetPriority(new_priority_params.priority); | 371 request->url_request()->SetPriority(new_priority_params.priority); |
| 372 request->set_request_priority_params(new_priority_params); | 372 request->set_request_priority_params(new_priority_params); |
| 373 if (!pending_requests_.IsQueued(request)) { | 373 if (!pending_requests_.IsQueued(request)) { |
| 374 DCHECK(ContainsKey(in_flight_requests_, request)); | 374 DCHECK(ContainsKey(in_flight_requests_, request)); |
| 375 // The priority and SPDY support may have changed, so update the | 375 // The priority and SPDY support may have changed, so update the |
| 376 // delayable count. | 376 // delayable count. |
| 377 SetRequestDelayable(request, IsDelayableRequest(request)); | 377 SetRequestCategory(request, GetRequestCategory(request)); |
| 378 // Request has already started. | 378 // Request has already started. |
| 379 return; | 379 return; |
| 380 } | 380 } |
| 381 | 381 |
| 382 pending_requests_.Erase(request); | 382 pending_requests_.Erase(request); |
| 383 pending_requests_.Insert(request); | 383 pending_requests_.Insert(request); |
| 384 | 384 |
| 385 if (new_priority_params.priority > old_priority_params.priority) { | 385 if (new_priority_params.priority > old_priority_params.priority) { |
| 386 // Check if this request is now able to load at its new priority. | 386 // Check if this request is now able to load at its new priority. |
| 387 LoadAnyStartablePendingRequests(); | 387 LoadAnyStartablePendingRequests(); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 434 | 434 |
| 435 private: | 435 private: |
| 436 enum ShouldStartReqResult { | 436 enum ShouldStartReqResult { |
| 437 DO_NOT_START_REQUEST_AND_STOP_SEARCHING, | 437 DO_NOT_START_REQUEST_AND_STOP_SEARCHING, |
| 438 DO_NOT_START_REQUEST_AND_KEEP_SEARCHING, | 438 DO_NOT_START_REQUEST_AND_KEEP_SEARCHING, |
| 439 START_REQUEST, | 439 START_REQUEST, |
| 440 }; | 440 }; |
| 441 | 441 |
| 442 void InsertInFlightRequest(ScheduledResourceRequest* request) { | 442 void InsertInFlightRequest(ScheduledResourceRequest* request) { |
| 443 in_flight_requests_.insert(request); | 443 in_flight_requests_.insert(request); |
| 444 if (IsDelayableRequest(request)) | 444 SetRequestCategory(request, GetRequestCategory(request)); |
| 445 SetRequestDelayable(request, true); | |
| 446 } | 445 } |
| 447 | 446 |
| 448 void EraseInFlightRequest(ScheduledResourceRequest* request) { | 447 void EraseInFlightRequest(ScheduledResourceRequest* request) { |
| 449 size_t erased = in_flight_requests_.erase(request); | 448 size_t erased = in_flight_requests_.erase(request); |
| 450 DCHECK_EQ(1u, erased); | 449 DCHECK_EQ(1u, erased); |
| 451 SetRequestDelayable(request, false); | 450 // Clear any special state that we were tracking for this request. |
| 451 SetRequestCategory(request, NORMAL_REQUEST); | |
| 452 DCHECK_LE(total_delayable_count_, in_flight_requests_.size()); | 452 DCHECK_LE(total_delayable_count_, in_flight_requests_.size()); |
| 453 DCHECK_LE(total_critical_count_, in_flight_requests_.size()); | |
|
mmenke
2014/08/13 17:55:11
Maybe these would get more coverage if at the end
Pat Meenan
2014/08/13 19:24:55
Done.
| |
| 453 } | 454 } |
| 454 | 455 |
| 455 void ClearInFlightRequests() { | 456 void ClearInFlightRequests() { |
| 456 in_flight_requests_.clear(); | 457 in_flight_requests_.clear(); |
| 457 total_delayable_count_ = 0; | 458 total_delayable_count_ = 0; |
| 459 total_critical_count_ = 0; | |
| 458 } | 460 } |
| 459 | 461 |
| 460 bool IsDelayableRequest(ScheduledResourceRequest* request) { | 462 void SetRequestCategory(ScheduledResourceRequest* request, |
| 463 RequestCategory category) { | |
| 464 RequestCategory old_category = request->category(); | |
| 465 if (old_category == category) | |
| 466 return; | |
| 467 | |
| 468 if (old_category == DELAYABLE_REQUEST) | |
| 469 total_delayable_count_--; | |
| 470 if (old_category == CRITICAL_REQUEST) | |
| 471 total_critical_count_--; | |
| 472 | |
| 473 if (category == DELAYABLE_REQUEST) | |
| 474 total_delayable_count_++; | |
| 475 if (category == CRITICAL_REQUEST) | |
| 476 total_critical_count_++; | |
| 477 | |
| 478 request->set_category(category); | |
| 479 } | |
| 480 | |
| 481 RequestCategory GetRequestCategory(ScheduledResourceRequest* request) { | |
| 482 if (!has_body_ && request->url_request()->priority() >= net::LOW) | |
| 483 return CRITICAL_REQUEST; | |
|
mmenke
2014/08/13 17:55:11
Do critical requests prevent has_body_ from becomi
Pat Meenan
2014/08/13 19:24:55
No, they do not - good catch. I changed the logic
| |
| 461 if (request->url_request()->priority() < net::LOW) { | 484 if (request->url_request()->priority() < net::LOW) { |
| 462 net::HostPortPair host_port_pair = | 485 net::HostPortPair host_port_pair = |
| 463 net::HostPortPair::FromURL(request->url_request()->url()); | 486 net::HostPortPair::FromURL(request->url_request()->url()); |
| 464 net::HttpServerProperties& http_server_properties = | 487 net::HttpServerProperties& http_server_properties = |
| 465 *request->url_request()->context()->http_server_properties(); | 488 *request->url_request()->context()->http_server_properties(); |
| 466 if (!http_server_properties.SupportsSpdy(host_port_pair)) { | 489 if (!http_server_properties.SupportsSpdy(host_port_pair)) { |
| 467 return true; | 490 return DELAYABLE_REQUEST; |
| 468 } | 491 } |
| 469 } | 492 } |
| 470 return false; | 493 return NORMAL_REQUEST; |
| 471 } | |
| 472 | |
| 473 void SetRequestDelayable(ScheduledResourceRequest* request, | |
| 474 bool delayable) { | |
| 475 if (request->accounted_as_delayable_request() == delayable) | |
| 476 return; | |
| 477 if (delayable) | |
| 478 total_delayable_count_++; | |
| 479 else | |
| 480 total_delayable_count_--; | |
| 481 request->set_accounted_as_delayable_request(delayable); | |
| 482 } | 494 } |
| 483 | 495 |
| 484 bool ShouldKeepSearching( | 496 bool ShouldKeepSearching( |
| 485 const net::HostPortPair& active_request_host) const { | 497 const net::HostPortPair& active_request_host) const { |
| 486 size_t same_host_count = 0; | 498 size_t same_host_count = 0; |
| 487 for (RequestSet::const_iterator it = in_flight_requests_.begin(); | 499 for (RequestSet::const_iterator it = in_flight_requests_.begin(); |
| 488 it != in_flight_requests_.end(); ++it) { | 500 it != in_flight_requests_.end(); ++it) { |
| 489 net::HostPortPair host_port_pair = | 501 net::HostPortPair host_port_pair = |
| 490 net::HostPortPair::FromURL((*it)->url_request()->url()); | 502 net::HostPortPair::FromURL((*it)->url_request()->url()); |
| 491 if (active_request_host.Equals(host_port_pair)) { | 503 if (active_request_host.Equals(host_port_pair)) { |
| 492 same_host_count++; | 504 same_host_count++; |
| 493 if (same_host_count >= kMaxNumDelayableRequestsPerHost) | 505 if (same_host_count >= kMaxNumDelayableRequestsPerHost) |
| 494 return true; | 506 return true; |
| 495 } | 507 } |
| 496 } | 508 } |
| 497 return false; | 509 return false; |
| 498 } | 510 } |
| 499 | 511 |
| 500 void StartRequest(ScheduledResourceRequest* request) { | 512 void StartRequest(ScheduledResourceRequest* request) { |
| 501 InsertInFlightRequest(request); | 513 InsertInFlightRequest(request); |
| 502 request->Start(); | 514 request->Start(); |
| 503 } | 515 } |
| 504 | 516 |
| 505 // ShouldStartRequest is the main scheduling algorithm. | 517 // ShouldStartRequest is the main scheduling algorithm. |
| 506 // | 518 // |
| 507 // Requests are categorized into three categories: | 519 // Requests are categorized into five categories: |
| 508 // | 520 // |
| 509 // 1. Non-delayable requests: | 521 // 1. Non-delayable requests: |
| 510 // * Synchronous requests. | 522 // * Synchronous requests. |
| 511 // * Non-HTTP[S] requests. | 523 // * Non-HTTP[S] requests. |
| 512 // | 524 // |
| 513 // 2. Requests to SPDY-capable origin servers. | 525 // 2. Requests to SPDY-capable origin servers. |
| 514 // | 526 // |
| 515 // 3. High-priority requests: | 527 // 3. High-priority requests: |
| 516 // * Higher priority requests (>= net::LOW). | 528 // * Higher priority requests (>= net::LOW). |
| 517 // | 529 // |
| 518 // 4. Low priority requests | 530 // 4. Critical requests: |
| 531 // * High-priority requests initiated before the renderer has a <body>. | |
|
mmenke
2014/08/13 17:55:11
I think it's kinda weird (And very non-intuitive)
Pat Meenan
2014/08/13 19:24:55
Would it be less worrying if I called them render-
| |
| 532 // | |
| 533 // 5. Low priority requests | |
| 519 // | 534 // |
| 520 // The following rules are followed: | 535 // The following rules are followed: |
| 521 // | 536 // |
| 522 // ACTIVE_AND_LOADING and UNTHROTTLED Clients follow these rules: | 537 // ACTIVE_AND_LOADING and UNTHROTTLED Clients follow these rules: |
| 523 // * Non-delayable, High-priority and SDPY capable requests are issued | 538 // * Non-delayable, High-priority and SDPY capable requests are issued |
|
mmenke
2014/08/13 17:55:11
nit: While you're here, SDPY -> SPDY
Pat Meenan
2014/08/13 19:24:55
Done.
| |
| 524 // immediately | 539 // immediately. |
| 525 // * If no high priority requests are in flight, start loading low priority | 540 // * If no high priority requests are in flight, start loading low priority |
| 526 // requests. | 541 // requests. |
| 527 // * Low priority requests are delayable. | 542 // * Low priority requests are delayable. |
| 528 // * Once the renderer has a <body>, start loading delayable requests. | 543 // * Allow one delayable request toload at a time while critical requests |
| 544 // are loading. | |
| 545 // * Once all critical requests have finished loading, start loading | |
| 546 // delayable requests. | |
| 529 // * Never exceed 10 delayable requests in flight per client. | 547 // * Never exceed 10 delayable requests in flight per client. |
| 530 // * Never exceed 6 delayable requests for a given host. | 548 // * Never exceed 6 delayable requests for a given host. |
| 531 // * Prior to <body>, allow one delayable request to load at a time. | |
| 532 // | 549 // |
| 533 // THROTTLED Clients follow these rules: | 550 // THROTTLED Clients follow these rules: |
| 534 // * Non-delayable and SPDY-capable requests are issued immediately. | 551 // * Non-delayable and SPDY-capable requests are issued immediately. |
| 535 // * At most one non-SPDY request will be issued per THROTTLED Client | 552 // * At most one non-SPDY request will be issued per THROTTLED Client |
| 536 // * If no high priority requests are in flight, start loading low priority | 553 // * If no high priority requests are in flight, start loading low priority |
| 537 // requests. | 554 // requests. |
| 538 // | 555 // |
| 539 // COALESCED Clients never load requests, with the following exceptions: | 556 // COALESCED Clients never load requests, with the following exceptions: |
| 540 // * Non-delayable requests are issued imediately. | 557 // * Non-delayable requests are issued imediately. |
| 541 // * On a (currently 5 second) heart beat, they load all requests as an | 558 // * On a (currently 5 second) heart beat, they load all requests as an |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 595 } | 612 } |
| 596 | 613 |
| 597 if (ShouldKeepSearching(host_port_pair)) { | 614 if (ShouldKeepSearching(host_port_pair)) { |
| 598 // There may be other requests for other hosts we'd allow, | 615 // There may be other requests for other hosts we'd allow, |
| 599 // so keep checking. | 616 // so keep checking. |
| 600 return DO_NOT_START_REQUEST_AND_KEEP_SEARCHING; | 617 return DO_NOT_START_REQUEST_AND_KEEP_SEARCHING; |
| 601 } | 618 } |
| 602 | 619 |
| 603 bool have_immediate_requests_in_flight = | 620 bool have_immediate_requests_in_flight = |
| 604 in_flight_requests_.size() > num_delayable_requests_in_flight; | 621 in_flight_requests_.size() > num_delayable_requests_in_flight; |
| 605 if (have_immediate_requests_in_flight && !has_body_ && | 622 if (have_immediate_requests_in_flight && |
| 623 total_critical_count_ != 0 && | |
|
mmenke
2014/08/13 17:55:11
Shouldn't we check if the current request is criti
Pat Meenan
2014/08/13 19:24:55
I added a comment to the priority >= net::LOW chec
mmenke
2014/08/15 19:53:40
Oops - forgot to delete that comment once I figure
| |
| 606 num_delayable_requests_in_flight != 0) { | 624 num_delayable_requests_in_flight != 0) { |
| 607 return DO_NOT_START_REQUEST_AND_STOP_SEARCHING; | 625 return DO_NOT_START_REQUEST_AND_STOP_SEARCHING; |
| 608 } | 626 } |
| 609 | 627 |
| 610 return START_REQUEST; | 628 return START_REQUEST; |
| 611 } | 629 } |
| 612 | 630 |
| 613 void LoadAnyStartablePendingRequests() { | 631 void LoadAnyStartablePendingRequests() { |
| 614 // We iterate through all the pending requests, starting with the highest | 632 // We iterate through all the pending requests, starting with the highest |
| 615 // priority one. For each entry, one of three things can happen: | 633 // priority one. For each entry, one of three things can happen: |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 651 bool is_visible_; | 669 bool is_visible_; |
| 652 bool is_loaded_; | 670 bool is_loaded_; |
| 653 bool is_paused_; | 671 bool is_paused_; |
| 654 bool has_body_; | 672 bool has_body_; |
| 655 bool using_spdy_proxy_; | 673 bool using_spdy_proxy_; |
| 656 RequestQueue pending_requests_; | 674 RequestQueue pending_requests_; |
| 657 RequestSet in_flight_requests_; | 675 RequestSet in_flight_requests_; |
| 658 ResourceScheduler* scheduler_; | 676 ResourceScheduler* scheduler_; |
| 659 // The number of delayable in-flight requests. | 677 // The number of delayable in-flight requests. |
| 660 size_t total_delayable_count_; | 678 size_t total_delayable_count_; |
| 679 // The number of critical in-flight requests. | |
| 680 size_t total_critical_count_; | |
| 661 ResourceScheduler::ClientThrottleState throttle_state_; | 681 ResourceScheduler::ClientThrottleState throttle_state_; |
| 662 }; | 682 }; |
| 663 | 683 |
| 664 ResourceScheduler::ResourceScheduler() | 684 ResourceScheduler::ResourceScheduler() |
| 665 : should_coalesce_(false), | 685 : should_coalesce_(false), |
| 666 should_throttle_(false), | 686 should_throttle_(false), |
| 667 active_clients_loading_(0), | 687 active_clients_loading_(0), |
| 668 coalesced_clients_(0), | 688 coalesced_clients_(0), |
| 669 coalescing_timer_(new base::Timer(true /* retain_user_task */, | 689 coalescing_timer_(new base::Timer(true /* retain_user_task */, |
| 670 true /* is_repeating */)) { | 690 true /* is_repeating */)) { |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 960 client->ReprioritizeRequest( | 980 client->ReprioritizeRequest( |
| 961 request, old_priority_params, new_priority_params); | 981 request, old_priority_params, new_priority_params); |
| 962 } | 982 } |
| 963 | 983 |
| 964 ResourceScheduler::ClientId ResourceScheduler::MakeClientId( | 984 ResourceScheduler::ClientId ResourceScheduler::MakeClientId( |
| 965 int child_id, int route_id) { | 985 int child_id, int route_id) { |
| 966 return (static_cast<ResourceScheduler::ClientId>(child_id) << 32) | route_id; | 986 return (static_cast<ResourceScheduler::ClientId>(child_id) << 32) | route_id; |
| 967 } | 987 } |
| 968 | 988 |
| 969 } // namespace content | 989 } // namespace content |
| OLD | NEW |