Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Side by Side Diff: content/browser/loader/resource_scheduler.h

Issue 465363003: ResourceScheduler get visual signal from RenderViewHostImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove ResourceScheduler::OnVisibilityChanged Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/threading/non_thread_safe.h" 14 #include "base/threading/non_thread_safe.h"
15 #include "base/timer/timer.h" 15 #include "base/timer/timer.h"
16 #include "content/browser/web_contents/web_contents_impl.h"
16 #include "content/common/content_export.h" 17 #include "content/common/content_export.h"
17 #include "net/base/priority_queue.h" 18 #include "net/base/priority_queue.h"
18 #include "net/base/request_priority.h" 19 #include "net/base/request_priority.h"
19 20
20 namespace net { 21 namespace net {
21 class HostPortPair; 22 class HostPortPair;
22 class URLRequest; 23 class URLRequest;
23 } 24 }
24 25
25 namespace content { 26 namespace content {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 97
97 // Requests that this ResourceScheduler schedule, and eventually loads, the 98 // Requests that this ResourceScheduler schedule, and eventually loads, the
98 // specified |url_request|. Caller should delete the returned ResourceThrottle 99 // specified |url_request|. Caller should delete the returned ResourceThrottle
99 // when the load completes or is canceled. 100 // when the load completes or is canceled.
100 scoped_ptr<ResourceThrottle> ScheduleRequest( 101 scoped_ptr<ResourceThrottle> ScheduleRequest(
101 int child_id, int route_id, net::URLRequest* url_request); 102 int child_id, int route_id, net::URLRequest* url_request);
102 103
103 // Signals from the UI thread, posted as tasks on the IO thread: 104 // Signals from the UI thread, posted as tasks on the IO thread:
104 105
105 // Called when a renderer is created. 106 // Called when a renderer is created.
106 void OnClientCreated(int child_id, int route_id); 107 void OnClientCreated(int child_id,
108 int route_id,
109 WebContentsImpl* web_contents);
107 110
108 // Called when a renderer is destroyed. 111 // Called when a renderer is destroyed.
109 void OnClientDeleted(int child_id, int route_id); 112 void OnClientDeleted(int child_id, int route_id);
110 113
111 // Signals from IPC messages directly from the renderers: 114 // Signals from IPC messages directly from the renderers:
112 115
113 // Called when a client navigates to a new main document. 116 // Called when a client navigates to a new main document.
114 void OnNavigate(int child_id, int route_id); 117 void OnNavigate(int child_id, int route_id);
115 118
116 // Called when the client has parsed the <body> element. This is a signal that 119 // Called when the client has parsed the <body> element. This is a signal that
117 // resource loads won't interfere with first paint. 120 // resource loads won't interfere with first paint.
118 void OnWillInsertBody(int child_id, int route_id); 121 void OnWillInsertBody(int child_id, int route_id);
119 122
120 // Signals from the IO thread: 123 // Signals from the IO thread:
121 124
122 // Called when we received a response to a http request that was served 125 // Called when we received a response to a http request that was served
123 // from a proxy using SPDY. 126 // from a proxy using SPDY.
124 void OnReceivedSpdyProxiedHttpResponse(int child_id, int route_id); 127 void OnReceivedSpdyProxiedHttpResponse(int child_id, int route_id);
125 128
126 // Client functions: 129 // Client functions:
127 130
128 // Called to check if all user observable tabs have completed loading. 131 // Called to check if all user observable tabs have completed loading.
129 bool active_clients_loaded() const { return active_clients_loading_ == 0; } 132 bool active_clients_loaded() const { return active_clients_loading_ == 0; }
130 133
131 // Called when a Client starts or stops playing audio. 134 // Called when a Client starts or stops playing audio.
132 void OnAudibilityChanged(int child_id, int route_id, bool is_audible); 135 void OnAudibilityChanged(int child_id, int route_id, bool is_audible);
133 136
134 // Called when a Client is shown or hidden. 137 void OnLoadingStateChanged(int child_id, int route_id, bool is_loaded);
135 void OnVisibilityChanged(int child_id, int route_id, bool is_visible);
136 138
137 void OnLoadingStateChanged(int child_id, int route_id, bool is_loaded); 139 bool IsClientVisible(int child_id, int route_id);
aiolos (Not reviewing) 2014/08/15 01:45:38 nit: Since this isn't used outside of the unittest
Zhen Wang 2014/08/15 18:43:01 Done.
138 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;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698