| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 'use strict'; | |
| 6 | |
| 7 /** | 5 /** |
| 8 * Scheduler for requests. Fetches requests from a queue and processes them | 6 * Scheduler for requests. Fetches requests from a queue and processes them |
| 9 * synchronously, taking into account priorities. The highest priority is 0. | 7 * synchronously, taking into account priorities. The highest priority is 0. |
| 10 * @constructor | 8 * @constructor |
| 11 */ | 9 */ |
| 12 function Scheduler() { | 10 function Scheduler() { |
| 13 /** | 11 /** |
| 14 * List of requests waiting to be checked. If these items are available in | 12 * List of requests waiting to be checked. If these items are available in |
| 15 * cache, then they are processed immediately after starting the scheduler. | 13 * cache, then they are processed immediately after starting the scheduler. |
| 16 * However, if they have to be downloaded, then these requests are moved | 14 * However, if they have to be downloaded, then these requests are moved |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 var index = this.activeRequests_.indexOf(request); | 156 var index = this.activeRequests_.indexOf(request); |
| 159 if (index < 0) | 157 if (index < 0) |
| 160 console.warn('Request not found.'); | 158 console.warn('Request not found.'); |
| 161 this.activeRequests_.splice(index, 1); | 159 this.activeRequests_.splice(index, 1); |
| 162 delete this.requests_[request.getId()]; | 160 delete this.requests_[request.getId()]; |
| 163 | 161 |
| 164 // Continue handling the most important requests (if started). | 162 // Continue handling the most important requests (if started). |
| 165 if (this.started_) | 163 if (this.started_) |
| 166 this.continue_(); | 164 this.continue_(); |
| 167 }; | 165 }; |
| OLD | NEW |