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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 96 |
97 // Requests that this ResourceScheduler schedule, and eventually loads, the | 97 // Requests that this ResourceScheduler schedule, and eventually loads, the |
98 // specified |url_request|. Caller should delete the returned ResourceThrottle | 98 // specified |url_request|. Caller should delete the returned ResourceThrottle |
99 // when the load completes or is canceled. | 99 // when the load completes or is canceled. |
100 scoped_ptr<ResourceThrottle> ScheduleRequest( | 100 scoped_ptr<ResourceThrottle> ScheduleRequest( |
101 int child_id, int route_id, net::URLRequest* url_request); | 101 int child_id, int route_id, net::URLRequest* url_request); |
102 | 102 |
103 // Signals from the UI thread, posted as tasks on the IO thread: | 103 // Signals from the UI thread, posted as tasks on the IO thread: |
104 | 104 |
105 // Called when a renderer is created. | 105 // Called when a renderer is created. |
106 void OnClientCreated(int child_id, int route_id); | 106 void OnClientCreated(int child_id, int route_id, bool is_visible); |
107 | 107 |
108 // Called when a renderer is destroyed. | 108 // Called when a renderer is destroyed. |
109 void OnClientDeleted(int child_id, int route_id); | 109 void OnClientDeleted(int child_id, int route_id); |
110 | 110 |
111 // Signals from IPC messages directly from the renderers: | 111 // Signals from IPC messages directly from the renderers: |
112 | 112 |
113 // Called when a client navigates to a new main document. | 113 // Called when a client navigates to a new main document. |
114 void OnNavigate(int child_id, int route_id); | 114 void OnNavigate(int child_id, int route_id); |
115 | 115 |
116 // Called when the client has parsed the <body> element. This is a signal that | 116 // Called when the client has parsed the <body> element. This is a signal that |
(...skipping 12 matching lines...) Expand all Loading... |
129 bool active_clients_loaded() const { return active_clients_loading_ == 0; } | 129 bool active_clients_loaded() const { return active_clients_loading_ == 0; } |
130 | 130 |
131 // Called when a Client starts or stops playing audio. | 131 // Called when a Client starts or stops playing audio. |
132 void OnAudibilityChanged(int child_id, int route_id, bool is_audible); | 132 void OnAudibilityChanged(int child_id, int route_id, bool is_audible); |
133 | 133 |
134 // Called when a Client is shown or hidden. | 134 // Called when a Client is shown or hidden. |
135 void OnVisibilityChanged(int child_id, int route_id, bool is_visible); | 135 void OnVisibilityChanged(int child_id, int route_id, bool is_visible); |
136 | 136 |
137 void OnLoadingStateChanged(int child_id, int route_id, bool is_loaded); | 137 void OnLoadingStateChanged(int child_id, int route_id, bool is_loaded); |
138 | 138 |
| 139 bool IsClientVisibleForTesting(int child_id, int route_id); |
| 140 |
139 private: | 141 private: |
140 class RequestQueue; | 142 class RequestQueue; |
141 class ScheduledResourceRequest; | 143 class ScheduledResourceRequest; |
142 struct RequestPriorityParams; | 144 struct RequestPriorityParams; |
143 struct ScheduledResourceSorter { | 145 struct ScheduledResourceSorter { |
144 bool operator()(const ScheduledResourceRequest* a, | 146 bool operator()(const ScheduledResourceRequest* a, |
145 const ScheduledResourceRequest* b) const; | 147 const ScheduledResourceRequest* b) const; |
146 }; | 148 }; |
147 class Client; | 149 class Client; |
148 | 150 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 size_t active_clients_loading_; | 198 size_t active_clients_loading_; |
197 size_t coalesced_clients_; | 199 size_t coalesced_clients_; |
198 // This is a repeating timer to initiate requests on COALESCED Clients. | 200 // This is a repeating timer to initiate requests on COALESCED Clients. |
199 scoped_ptr<base::Timer> coalescing_timer_; | 201 scoped_ptr<base::Timer> coalescing_timer_; |
200 RequestSet unowned_requests_; | 202 RequestSet unowned_requests_; |
201 }; | 203 }; |
202 | 204 |
203 } // namespace content | 205 } // namespace content |
204 | 206 |
205 #endif // CONTENT_BROWSER_LOADER_RESOURCE_SCHEDULER_H_ | 207 #endif // CONTENT_BROWSER_LOADER_RESOURCE_SCHEDULER_H_ |
OLD | NEW |