| 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 #ifndef CONTENT_BROWSER_LOADER_RESOURCE_SCHEDULER_H_ | 5 #ifndef CONTENT_BROWSER_LOADER_RESOURCE_SCHEDULER_H_ |
| 6 #define CONTENT_BROWSER_LOADER_RESOURCE_SCHEDULER_H_ | 6 #define CONTENT_BROWSER_LOADER_RESOURCE_SCHEDULER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 THROTTLED, | 71 THROTTLED, |
| 72 // Observable (active) loaded client or | 72 // Observable (active) loaded client or |
| 73 // Loading background client, all observable clients loaded. | 73 // Loading background client, all observable clients loaded. |
| 74 // Note that clients which would be COALESCED are UNTHROTTLED until | 74 // Note that clients which would be COALESCED are UNTHROTTLED until |
| 75 // coalescing is turned on. | 75 // coalescing is turned on. |
| 76 UNTHROTTLED, | 76 UNTHROTTLED, |
| 77 // Observable (active) loading client. | 77 // Observable (active) loading client. |
| 78 ACTIVE_AND_LOADING, | 78 ACTIVE_AND_LOADING, |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 enum RequestCategory { |
| 82 NORMAL_REQUEST, |
| 83 // Low priority requests |
| 84 DELAYABLE_REQUEST, |
| 85 // High-priority requests received before the renderer has a <body> |
| 86 CRITICAL_REQUEST, |
| 87 }; |
| 88 |
| 81 ResourceScheduler(); | 89 ResourceScheduler(); |
| 82 ~ResourceScheduler(); | 90 ~ResourceScheduler(); |
| 83 | 91 |
| 84 // Use a mock timer when testing. | 92 // Use a mock timer when testing. |
| 85 void set_timer_for_testing(scoped_ptr<base::Timer> timer) { | 93 void set_timer_for_testing(scoped_ptr<base::Timer> timer) { |
| 86 coalescing_timer_.reset(timer.release()); | 94 coalescing_timer_.reset(timer.release()); |
| 87 } | 95 } |
| 88 | 96 |
| 89 // TODO(aiolos): Remove when throttling and coalescing have landed | 97 // TODO(aiolos): Remove when throttling and coalescing have landed |
| 90 void SetThrottleOptionsForTesting(bool should_throttle, bool should_coalesce); | 98 void SetThrottleOptionsForTesting(bool should_throttle, bool should_coalesce); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 size_t active_clients_loading_; | 204 size_t active_clients_loading_; |
| 197 size_t coalesced_clients_; | 205 size_t coalesced_clients_; |
| 198 // This is a repeating timer to initiate requests on COALESCED Clients. | 206 // This is a repeating timer to initiate requests on COALESCED Clients. |
| 199 scoped_ptr<base::Timer> coalescing_timer_; | 207 scoped_ptr<base::Timer> coalescing_timer_; |
| 200 RequestSet unowned_requests_; | 208 RequestSet unowned_requests_; |
| 201 }; | 209 }; |
| 202 | 210 |
| 203 } // namespace content | 211 } // namespace content |
| 204 | 212 |
| 205 #endif // CONTENT_BROWSER_LOADER_RESOURCE_SCHEDULER_H_ | 213 #endif // CONTENT_BROWSER_LOADER_RESOURCE_SCHEDULER_H_ |
| OLD | NEW |