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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 int child_id, int route_id, net::URLRequest* url_request); | 109 int child_id, int route_id, net::URLRequest* url_request); |
110 | 110 |
111 // Signals from the UI thread, posted as tasks on the IO thread: | 111 // Signals from the UI thread, posted as tasks on the IO thread: |
112 | 112 |
113 // Called when a renderer is created. | 113 // Called when a renderer is created. |
114 void OnClientCreated(int child_id, int route_id, bool is_visible); | 114 void OnClientCreated(int child_id, int route_id, bool is_visible); |
115 | 115 |
116 // Called when a renderer is destroyed. | 116 // Called when a renderer is destroyed. |
117 void OnClientDeleted(int child_id, int route_id); | 117 void OnClientDeleted(int child_id, int route_id); |
118 | 118 |
| 119 // Called when a renderer stops or restarts loading. |
| 120 void OnLoadingStateChanged(int child_id, int route_id, bool is_loaded); |
| 121 |
| 122 // Called when a Client is shown or hidden. |
| 123 void OnVisibilityChanged(int child_id, int route_id, bool is_visible); |
| 124 |
119 // Signals from IPC messages directly from the renderers: | 125 // Signals from IPC messages directly from the renderers: |
120 | 126 |
121 // Called when a client navigates to a new main document. | 127 // Called when a client navigates to a new main document. |
122 void OnNavigate(int child_id, int route_id); | 128 void OnNavigate(int child_id, int route_id); |
123 | 129 |
124 // Called when the client has parsed the <body> element. This is a signal that | 130 // Called when the client has parsed the <body> element. This is a signal that |
125 // resource loads won't interfere with first paint. | 131 // resource loads won't interfere with first paint. |
126 void OnWillInsertBody(int child_id, int route_id); | 132 void OnWillInsertBody(int child_id, int route_id); |
127 | 133 |
128 // Signals from the IO thread: | 134 // Signals from the IO thread: |
129 | 135 |
130 // Called when we received a response to a http request that was served | 136 // Called when we received a response to a http request that was served |
131 // from a proxy using SPDY. | 137 // from a proxy using SPDY. |
132 void OnReceivedSpdyProxiedHttpResponse(int child_id, int route_id); | 138 void OnReceivedSpdyProxiedHttpResponse(int child_id, int route_id); |
133 | 139 |
134 // Client functions: | 140 // Client functions: |
135 | 141 |
136 // Called to check if all user observable tabs have completed loading. | 142 // Called to check if all user observable tabs have completed loading. |
137 bool active_clients_loaded() const { return active_clients_loading_ == 0; } | 143 bool active_clients_loaded() const { return active_clients_loading_ == 0; } |
138 | 144 |
139 // Called when a Client starts or stops playing audio. | 145 // Called when a Client starts or stops playing audio. |
140 void OnAudibilityChanged(int child_id, int route_id, bool is_audible); | 146 void OnAudibilityChanged(int child_id, int route_id, bool is_audible); |
141 | 147 |
142 // Called when a Client is shown or hidden. | |
143 void OnVisibilityChanged(int child_id, int route_id, bool is_visible); | |
144 | |
145 void OnLoadingStateChanged(int child_id, int route_id, bool is_loaded); | |
146 | |
147 bool IsClientVisibleForTesting(int child_id, int route_id); | 148 bool IsClientVisibleForTesting(int child_id, int route_id); |
148 | 149 |
149 private: | 150 private: |
150 class RequestQueue; | 151 class RequestQueue; |
151 class ScheduledResourceRequest; | 152 class ScheduledResourceRequest; |
152 struct RequestPriorityParams; | 153 struct RequestPriorityParams; |
153 struct ScheduledResourceSorter { | 154 struct ScheduledResourceSorter { |
154 bool operator()(const ScheduledResourceRequest* a, | 155 bool operator()(const ScheduledResourceRequest* a, |
155 const ScheduledResourceRequest* b) const; | 156 const ScheduledResourceRequest* b) const; |
156 }; | 157 }; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 size_t active_clients_loading_; | 207 size_t active_clients_loading_; |
207 size_t coalesced_clients_; | 208 size_t coalesced_clients_; |
208 // This is a repeating timer to initiate requests on COALESCED Clients. | 209 // This is a repeating timer to initiate requests on COALESCED Clients. |
209 scoped_ptr<base::Timer> coalescing_timer_; | 210 scoped_ptr<base::Timer> coalescing_timer_; |
210 RequestSet unowned_requests_; | 211 RequestSet unowned_requests_; |
211 }; | 212 }; |
212 | 213 |
213 } // namespace content | 214 } // namespace content |
214 | 215 |
215 #endif // CONTENT_BROWSER_LOADER_RESOURCE_SCHEDULER_H_ | 216 #endif // CONTENT_BROWSER_LOADER_RESOURCE_SCHEDULER_H_ |
OLD | NEW |