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

Side by Side Diff: chrome/browser/renderer_host/resource_dispatcher_host.h

Issue 39206: NO CODE CHANGE. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 // This is the browser side of the resource dispatcher, it receives requests 5 // This is the browser side of the resource dispatcher, it receives requests
6 // from the RenderProcessHosts, and dispatches them to URLRequests. It then 6 // from the RenderProcessHosts, and dispatches them to URLRequests. It then
7 // fowards the messages from the URLRequests back to the correct process for 7 // fowards the messages from the URLRequests back to the correct process for
8 // handling. 8 // handling.
9 // 9 //
10 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading 10 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 bool has_started_reading; 146 bool has_started_reading;
147 147
148 // How many bytes have been read while this request has been paused. 148 // How many bytes have been read while this request has been paused.
149 int paused_read_bytes; 149 int paused_read_bytes;
150 }; 150 };
151 151
152 class Observer { 152 class Observer {
153 public: 153 public:
154 virtual void OnRequestStarted(ResourceDispatcherHost* resource_dispatcher, 154 virtual void OnRequestStarted(ResourceDispatcherHost* resource_dispatcher,
155 URLRequest* request) = 0; 155 URLRequest* request) = 0;
156 virtual void OnResponseCompleted(ResourceDispatcherHost* resource_dispatcher , 156 virtual void OnResponseCompleted(
157 URLRequest* request) = 0; 157 ResourceDispatcherHost* resource_dispatcher,
158 URLRequest* request) = 0;
158 virtual void OnReceivedRedirect(ResourceDispatcherHost* resource_dispatcher, 159 virtual void OnReceivedRedirect(ResourceDispatcherHost* resource_dispatcher,
159 URLRequest* request, 160 URLRequest* request,
160 const GURL& new_url) = 0; 161 const GURL& new_url) = 0;
161 }; 162 };
162 163
163 // Uniquely identifies a URLRequest. 164 // Uniquely identifies a URLRequest.
164 struct GlobalRequestID { 165 struct GlobalRequestID {
165 GlobalRequestID() : render_process_host_id(-1), request_id(-1) { 166 GlobalRequestID() : render_process_host_id(-1), request_id(-1) {
166 } 167 }
167 GlobalRequestID(int render_process_host_id, int request_id) 168 GlobalRequestID(int render_process_host_id, int request_id)
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 void OnResponseCompleted(URLRequest* request); 304 void OnResponseCompleted(URLRequest* request);
304 305
305 // Helper function to get our extra data out of a request. The given request 306 // Helper function to get our extra data out of a request. The given request
306 // must have been one we created so that it has the proper extra data pointer. 307 // must have been one we created so that it has the proper extra data pointer.
307 static ExtraRequestInfo* ExtraInfoForRequest(URLRequest* request) { 308 static ExtraRequestInfo* ExtraInfoForRequest(URLRequest* request) {
308 ExtraRequestInfo* r = static_cast<ExtraRequestInfo*>(request->user_data()); 309 ExtraRequestInfo* r = static_cast<ExtraRequestInfo*>(request->user_data());
309 DLOG_IF(WARNING, !r) << "Request doesn't seem to have our data"; 310 DLOG_IF(WARNING, !r) << "Request doesn't seem to have our data";
310 return r; 311 return r;
311 } 312 }
312 313
313 static const ExtraRequestInfo* ExtraInfoForRequest(const URLRequest* request) { 314 static const ExtraRequestInfo* ExtraInfoForRequest(
315 const URLRequest* request) {
314 const ExtraRequestInfo* r = 316 const ExtraRequestInfo* r =
315 static_cast<const ExtraRequestInfo*>(request->user_data()); 317 static_cast<const ExtraRequestInfo*>(request->user_data());
316 DLOG_IF(WARNING, !r) << "Request doesn't seem to have our data"; 318 DLOG_IF(WARNING, !r) << "Request doesn't seem to have our data";
317 return r; 319 return r;
318 } 320 }
319 321
320 // Adds an observer. The observer will be called on the IO thread. To 322 // Adds an observer. The observer will be called on the IO thread. To
321 // observe resource events on the UI thread, subscribe to the 323 // observe resource events on the UI thread, subscribe to the
322 // NOTIFY_RESOURCE_* notifications of the notification service. 324 // NOTIFY_RESOURCE_* notifications of the notification service.
323 void AddObserver(Observer* obs); 325 void AddObserver(Observer* obs);
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 // individual requests is given by CalculateApproximateMemoryCost). 521 // individual requests is given by CalculateApproximateMemoryCost).
520 // The total number of outstanding requests is roughly: 522 // The total number of outstanding requests is roughly:
521 // (max_outstanding_requests_cost_per_process_ / 523 // (max_outstanding_requests_cost_per_process_ /
522 // kAvgBytesPerOutstandingRequest) 524 // kAvgBytesPerOutstandingRequest)
523 int max_outstanding_requests_cost_per_process_; 525 int max_outstanding_requests_cost_per_process_;
524 526
525 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHost); 527 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHost);
526 }; 528 };
527 529
528 #endif // CHROME_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_ 530 #endif // CHROME_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/renderer_security_policy.cc ('k') | chrome/browser/safe_browsing/chunk_range.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698