OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 child process (i.e. [Renderer, Plugin, Worker]ProcessHost), and | 6 // from the child process (i.e. [Renderer, Plugin, Worker]ProcessHost), and |
7 // dispatches them to URLRequests. It then forwards the messages from the | 7 // dispatches them to URLRequests. It then forwards the messages from the |
8 // URLRequests back to the correct process for handling. | 8 // URLRequests back to the correct process for 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 class WebKitThread; | 44 class WebKitThread; |
45 struct DownloadSaveInfo; | 45 struct DownloadSaveInfo; |
46 struct GlobalRequestID; | 46 struct GlobalRequestID; |
47 struct ViewHostMsg_Resource_Request; | 47 struct ViewHostMsg_Resource_Request; |
48 struct ViewMsg_ClosePage_Params; | 48 struct ViewMsg_ClosePage_Params; |
49 | 49 |
50 namespace webkit_blob { | 50 namespace webkit_blob { |
51 class DeletableFileReference; | 51 class DeletableFileReference; |
52 } | 52 } |
53 | 53 |
54 class ResourceDispatcherHost : public URLRequest::Delegate { | 54 class ResourceDispatcherHost : public net::URLRequest::Delegate { |
55 public: | 55 public: |
56 // Implemented by the client of ResourceDispatcherHost to receive messages in | 56 // Implemented by the client of ResourceDispatcherHost to receive messages in |
57 // response to a resource load. The messages are intended to be forwarded to | 57 // response to a resource load. The messages are intended to be forwarded to |
58 // the ResourceDispatcher in the child process via an IPC channel that the | 58 // the ResourceDispatcher in the child process via an IPC channel that the |
59 // client manages. | 59 // client manages. |
60 // | 60 // |
61 // NOTE: This class unfortunately cannot be named 'Delegate' because that | 61 // NOTE: This class unfortunately cannot be named 'Delegate' because that |
62 // conflicts with the name of ResourceDispatcherHost's base class. | 62 // conflicts with the name of ResourceDispatcherHost's base class. |
63 // | 63 // |
64 // If the receiver is unable to send a given message (i.e., if Send returns | 64 // If the receiver is unable to send a given message (i.e., if Send returns |
(...skipping 11 matching lines...) Expand all Loading... |
76 | 76 |
77 protected: | 77 protected: |
78 explicit Receiver(ChildProcessInfo::ProcessType type, int child_id); | 78 explicit Receiver(ChildProcessInfo::ProcessType type, int child_id); |
79 virtual ~Receiver(); | 79 virtual ~Receiver(); |
80 }; | 80 }; |
81 | 81 |
82 class Observer { | 82 class Observer { |
83 public: | 83 public: |
84 virtual ~Observer() {} | 84 virtual ~Observer() {} |
85 virtual void OnRequestStarted(ResourceDispatcherHost* resource_dispatcher, | 85 virtual void OnRequestStarted(ResourceDispatcherHost* resource_dispatcher, |
86 URLRequest* request) = 0; | 86 net::URLRequest* request) = 0; |
87 virtual void OnResponseCompleted( | 87 virtual void OnResponseCompleted( |
88 ResourceDispatcherHost* resource_dispatcher, | 88 ResourceDispatcherHost* resource_dispatcher, |
89 URLRequest* request) = 0; | 89 net::URLRequest* request) = 0; |
90 virtual void OnReceivedRedirect(ResourceDispatcherHost* resource_dispatcher, | 90 virtual void OnReceivedRedirect(ResourceDispatcherHost* resource_dispatcher, |
91 URLRequest* request, | 91 net::URLRequest* request, |
92 const GURL& new_url) = 0; | 92 const GURL& new_url) = 0; |
93 }; | 93 }; |
94 | 94 |
95 ResourceDispatcherHost(); | 95 ResourceDispatcherHost(); |
96 ~ResourceDispatcherHost(); | 96 ~ResourceDispatcherHost(); |
97 | 97 |
98 void Initialize(); | 98 void Initialize(); |
99 | 99 |
100 // Puts the resource dispatcher host in an inactive state (unable to begin | 100 // Puts the resource dispatcher host in an inactive state (unable to begin |
101 // new requests). Cancels all pending requests. | 101 // new requests). Cancels all pending requests. |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 // Called when the onunload handler for a cross-site request has finished. | 195 // Called when the onunload handler for a cross-site request has finished. |
196 void OnClosePageACK(const ViewMsg_ClosePage_Params& params); | 196 void OnClosePageACK(const ViewMsg_ClosePage_Params& params); |
197 | 197 |
198 // Force cancels any pending requests for the given process. | 198 // Force cancels any pending requests for the given process. |
199 void CancelRequestsForProcess(int process_unique_id); | 199 void CancelRequestsForProcess(int process_unique_id); |
200 | 200 |
201 // Force cancels any pending requests for the given route id. This method | 201 // Force cancels any pending requests for the given route id. This method |
202 // acts like CancelRequestsForProcess when route_id is -1. | 202 // acts like CancelRequestsForProcess when route_id is -1. |
203 void CancelRequestsForRoute(int process_unique_id, int route_id); | 203 void CancelRequestsForRoute(int process_unique_id, int route_id); |
204 | 204 |
205 // URLRequest::Delegate | 205 // net::URLRequest::Delegate |
206 virtual void OnReceivedRedirect(URLRequest* request, | 206 virtual void OnReceivedRedirect(net::URLRequest* request, |
207 const GURL& new_url, | 207 const GURL& new_url, |
208 bool* defer_redirect); | 208 bool* defer_redirect); |
209 virtual void OnAuthRequired(URLRequest* request, | 209 virtual void OnAuthRequired(net::URLRequest* request, |
210 net::AuthChallengeInfo* auth_info); | 210 net::AuthChallengeInfo* auth_info); |
211 virtual void OnCertificateRequested( | 211 virtual void OnCertificateRequested( |
212 URLRequest* request, | 212 net::URLRequest* request, |
213 net::SSLCertRequestInfo* cert_request_info); | 213 net::SSLCertRequestInfo* cert_request_info); |
214 virtual void OnSSLCertificateError(URLRequest* request, | 214 virtual void OnSSLCertificateError(net::URLRequest* request, |
215 int cert_error, | 215 int cert_error, |
216 net::X509Certificate* cert); | 216 net::X509Certificate* cert); |
217 virtual void OnSetCookie(URLRequest* request, | 217 virtual void OnSetCookie(net::URLRequest* request, |
218 const std::string& cookie_line, | 218 const std::string& cookie_line, |
219 const net::CookieOptions& options, | 219 const net::CookieOptions& options, |
220 bool blocked_by_policy); | 220 bool blocked_by_policy); |
221 virtual void OnResponseStarted(URLRequest* request); | 221 virtual void OnResponseStarted(net::URLRequest* request); |
222 virtual void OnReadCompleted(URLRequest* request, int bytes_read); | 222 virtual void OnReadCompleted(net::URLRequest* request, int bytes_read); |
223 void OnResponseCompleted(URLRequest* request); | 223 void OnResponseCompleted(net::URLRequest* request); |
224 | 224 |
225 // Helper functions to get our extra data out of a request. The given request | 225 // Helper functions to get our extra data out of a request. The given request |
226 // must have been one we created so that it has the proper extra data pointer. | 226 // must have been one we created so that it has the proper extra data pointer. |
227 static ResourceDispatcherHostRequestInfo* InfoForRequest(URLRequest* request); | 227 static ResourceDispatcherHostRequestInfo* InfoForRequest( |
| 228 net::URLRequest* request); |
228 static const ResourceDispatcherHostRequestInfo* InfoForRequest( | 229 static const ResourceDispatcherHostRequestInfo* InfoForRequest( |
229 const URLRequest* request); | 230 const net::URLRequest* request); |
230 | 231 |
231 // Extracts the render view/process host's identifiers from the given request | 232 // Extracts the render view/process host's identifiers from the given request |
232 // and places them in the given out params (both required). If there are no | 233 // and places them in the given out params (both required). If there are no |
233 // such IDs associated with the request (such as non-page-related requests), | 234 // such IDs associated with the request (such as non-page-related requests), |
234 // this function will return false and both out params will be -1. | 235 // this function will return false and both out params will be -1. |
235 static bool RenderViewForRequest(const URLRequest* request, | 236 static bool RenderViewForRequest(const net::URLRequest* request, |
236 int* render_process_host_id, | 237 int* render_process_host_id, |
237 int* render_view_host_id); | 238 int* render_view_host_id); |
238 | 239 |
239 // Adds an observer. The observer will be called on the IO thread. To | 240 // Adds an observer. The observer will be called on the IO thread. To |
240 // observe resource events on the UI thread, subscribe to the | 241 // observe resource events on the UI thread, subscribe to the |
241 // NOTIFY_RESOURCE_* notifications of the notification service. | 242 // NOTIFY_RESOURCE_* notifications of the notification service. |
242 void AddObserver(Observer* obs); | 243 void AddObserver(Observer* obs); |
243 | 244 |
244 // Removes an observer. | 245 // Removes an observer. |
245 void RemoveObserver(Observer* obs); | 246 void RemoveObserver(Observer* obs); |
246 | 247 |
247 // Retrieves a URLRequest. Must be called from the IO thread. | 248 // Retrieves a net::URLRequest. Must be called from the IO thread. |
248 URLRequest* GetURLRequest(const GlobalRequestID& request_id) const; | 249 net::URLRequest* GetURLRequest(const GlobalRequestID& request_id) const; |
249 | 250 |
250 // Notifies our observers that a request has been cancelled. | 251 // Notifies our observers that a request has been cancelled. |
251 void NotifyResponseCompleted(URLRequest* request, int process_unique_id); | 252 void NotifyResponseCompleted(net::URLRequest* request, int process_unique_id); |
252 | 253 |
253 void RemovePendingRequest(int process_unique_id, int request_id); | 254 void RemovePendingRequest(int process_unique_id, int request_id); |
254 | 255 |
255 // Causes all new requests for the route identified by | 256 // Causes all new requests for the route identified by |
256 // |process_unique_id| and |route_id| to be blocked (not being | 257 // |process_unique_id| and |route_id| to be blocked (not being |
257 // started) until ResumeBlockedRequestsForRoute or | 258 // started) until ResumeBlockedRequestsForRoute or |
258 // CancelBlockedRequestsForRoute is called. | 259 // CancelBlockedRequestsForRoute is called. |
259 void BlockRequestsForRoute(int process_unique_id, int route_id); | 260 void BlockRequestsForRoute(int process_unique_id, int route_id); |
260 | 261 |
261 // Resumes any blocked request for the specified route id. | 262 // Resumes any blocked request for the specified route id. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 FRIEND_TEST_ALL_PREFIXES(ApplyExtensionLocalizationFilterTest, GoodScheme); | 298 FRIEND_TEST_ALL_PREFIXES(ApplyExtensionLocalizationFilterTest, GoodScheme); |
298 FRIEND_TEST_ALL_PREFIXES(ApplyExtensionLocalizationFilterTest, | 299 FRIEND_TEST_ALL_PREFIXES(ApplyExtensionLocalizationFilterTest, |
299 GoodSchemeWrongResourceType); | 300 GoodSchemeWrongResourceType); |
300 | 301 |
301 class ShutdownTask; | 302 class ShutdownTask; |
302 | 303 |
303 friend class ShutdownTask; | 304 friend class ShutdownTask; |
304 | 305 |
305 // Associates the given info with the given request. The info will then be | 306 // Associates the given info with the given request. The info will then be |
306 // owned by the request. | 307 // owned by the request. |
307 void SetRequestInfo(URLRequest* request, | 308 void SetRequestInfo(net::URLRequest* request, |
308 ResourceDispatcherHostRequestInfo* info); | 309 ResourceDispatcherHostRequestInfo* info); |
309 | 310 |
310 // A shutdown helper that runs on the IO thread. | 311 // A shutdown helper that runs on the IO thread. |
311 void OnShutdown(); | 312 void OnShutdown(); |
312 | 313 |
313 // Returns true if the request is paused. | 314 // Returns true if the request is paused. |
314 bool PauseRequestIfNeeded(ResourceDispatcherHostRequestInfo* info); | 315 bool PauseRequestIfNeeded(ResourceDispatcherHostRequestInfo* info); |
315 | 316 |
316 // Resumes the given request by calling OnResponseStarted or OnReadCompleted. | 317 // Resumes the given request by calling OnResponseStarted or OnReadCompleted. |
317 void ResumeRequest(const GlobalRequestID& request_id); | 318 void ResumeRequest(const GlobalRequestID& request_id); |
318 | 319 |
319 // Internal function to start reading for the first time. | 320 // Internal function to start reading for the first time. |
320 void StartReading(URLRequest* request); | 321 void StartReading(net::URLRequest* request); |
321 | 322 |
322 // Reads data from the response using our internal buffer as async IO. | 323 // Reads data from the response using our internal buffer as async IO. |
323 // Returns true if data is available immediately, false otherwise. If the | 324 // Returns true if data is available immediately, false otherwise. If the |
324 // return value is false, we will receive a OnReadComplete() callback later. | 325 // return value is false, we will receive a OnReadComplete() callback later. |
325 bool Read(URLRequest* request, int* bytes_read); | 326 bool Read(net::URLRequest* request, int* bytes_read); |
326 | 327 |
327 // Internal function to finish an async IO which has completed. Returns | 328 // Internal function to finish an async IO which has completed. Returns |
328 // true if there is more data to read (e.g. we haven't read EOF yet and | 329 // true if there is more data to read (e.g. we haven't read EOF yet and |
329 // no errors have occurred). | 330 // no errors have occurred). |
330 bool CompleteRead(URLRequest*, int* bytes_read); | 331 bool CompleteRead(net::URLRequest*, int* bytes_read); |
331 | 332 |
332 // Internal function to finish handling the ResponseStarted message. Returns | 333 // Internal function to finish handling the ResponseStarted message. Returns |
333 // true on success. | 334 // true on success. |
334 bool CompleteResponseStarted(URLRequest* request); | 335 bool CompleteResponseStarted(net::URLRequest* request); |
335 | 336 |
336 // Helper function for regular and download requests. | 337 // Helper function for regular and download requests. |
337 void BeginRequestInternal(URLRequest* request); | 338 void BeginRequestInternal(net::URLRequest* request); |
338 | 339 |
339 // Helper function that cancels |request|. | 340 // Helper function that cancels |request|. |
340 void CancelRequestInternal(URLRequest* request, bool from_renderer); | 341 void CancelRequestInternal(net::URLRequest* request, bool from_renderer); |
341 | 342 |
342 // Helper function that inserts |request| into the resource queue. | 343 // Helper function that inserts |request| into the resource queue. |
343 void InsertIntoResourceQueue( | 344 void InsertIntoResourceQueue( |
344 URLRequest* request, | 345 net::URLRequest* request, |
345 const ResourceDispatcherHostRequestInfo& request_info); | 346 const ResourceDispatcherHostRequestInfo& request_info); |
346 | 347 |
347 // Updates the "cost" of outstanding requests for |process_unique_id|. | 348 // Updates the "cost" of outstanding requests for |process_unique_id|. |
348 // The "cost" approximates how many bytes are consumed by all the in-memory | 349 // The "cost" approximates how many bytes are consumed by all the in-memory |
349 // data structures supporting this request (URLRequest object, | 350 // data structures supporting this request (net::URLRequest object, |
350 // HttpNetworkTransaction, etc...). | 351 // HttpNetworkTransaction, etc...). |
351 // The value of |cost| is added to the running total, and the resulting | 352 // The value of |cost| is added to the running total, and the resulting |
352 // sum is returned. | 353 // sum is returned. |
353 int IncrementOutstandingRequestsMemoryCost(int cost, | 354 int IncrementOutstandingRequestsMemoryCost(int cost, |
354 int process_unique_id); | 355 int process_unique_id); |
355 | 356 |
356 // Estimate how much heap space |request| will consume to run. | 357 // Estimate how much heap space |request| will consume to run. |
357 static int CalculateApproximateMemoryCost(URLRequest* request); | 358 static int CalculateApproximateMemoryCost(net::URLRequest* request); |
358 | 359 |
359 // The list of all requests that we have pending. This list is not really | 360 // The list of all requests that we have pending. This list is not really |
360 // optimized, and assumes that we have relatively few requests pending at once | 361 // optimized, and assumes that we have relatively few requests pending at once |
361 // since some operations require brute-force searching of the list. | 362 // since some operations require brute-force searching of the list. |
362 // | 363 // |
363 // It may be enhanced in the future to provide some kind of prioritization | 364 // It may be enhanced in the future to provide some kind of prioritization |
364 // mechanism. We should also consider a hashtable or binary tree if it turns | 365 // mechanism. We should also consider a hashtable or binary tree if it turns |
365 // out we have a lot of things here. | 366 // out we have a lot of things here. |
366 typedef std::map<GlobalRequestID, URLRequest*> PendingRequestList; | 367 typedef std::map<GlobalRequestID, net::URLRequest*> PendingRequestList; |
367 | 368 |
368 // Deletes the pending request identified by the iterator passed in. | 369 // Deletes the pending request identified by the iterator passed in. |
369 // This function will invalidate the iterator passed in. Callers should | 370 // This function will invalidate the iterator passed in. Callers should |
370 // not rely on this iterator being valid on return. | 371 // not rely on this iterator being valid on return. |
371 void RemovePendingRequest(const PendingRequestList::iterator& iter); | 372 void RemovePendingRequest(const PendingRequestList::iterator& iter); |
372 | 373 |
373 // Notify our observers that we started receiving a response for a request. | 374 // Notify our observers that we started receiving a response for a request. |
374 void NotifyResponseStarted(URLRequest* request, int process_unique_id); | 375 void NotifyResponseStarted(net::URLRequest* request, int process_unique_id); |
375 | 376 |
376 // Notify our observers that a request has been redirected. | 377 // Notify our observers that a request has been redirected. |
377 void NotifyReceivedRedirect(URLRequest* request, | 378 void NotifyReceivedRedirect(net::URLRequest* request, |
378 int process_unique_id, | 379 int process_unique_id, |
379 const GURL& new_url); | 380 const GURL& new_url); |
380 | 381 |
381 // Tries to handle the url with an external protocol. If the request is | 382 // Tries to handle the url with an external protocol. If the request is |
382 // handled, the function returns true. False otherwise. | 383 // handled, the function returns true. False otherwise. |
383 bool HandleExternalProtocol(int request_id, | 384 bool HandleExternalProtocol(int request_id, |
384 int process_unique_id, | 385 int process_unique_id, |
385 int route_id, | 386 int route_id, |
386 const GURL& url, | 387 const GURL& url, |
387 ResourceType::Type resource_type, | 388 ResourceType::Type resource_type, |
388 ResourceHandler* handler); | 389 ResourceHandler* handler); |
389 | 390 |
390 // Checks all pending requests and updates the load states and upload | 391 // Checks all pending requests and updates the load states and upload |
391 // progress if necessary. | 392 // progress if necessary. |
392 void UpdateLoadStates(); | 393 void UpdateLoadStates(); |
393 | 394 |
394 // Checks the upload state and sends an update if one is necessary. | 395 // Checks the upload state and sends an update if one is necessary. |
395 bool MaybeUpdateUploadProgress(ResourceDispatcherHostRequestInfo *info, | 396 bool MaybeUpdateUploadProgress(ResourceDispatcherHostRequestInfo *info, |
396 URLRequest *request); | 397 net::URLRequest *request); |
397 | 398 |
398 // Resumes or cancels (if |cancel_requests| is true) any blocked requests. | 399 // Resumes or cancels (if |cancel_requests| is true) any blocked requests. |
399 void ProcessBlockedRequestsForRoute(int process_unique_id, | 400 void ProcessBlockedRequestsForRoute(int process_unique_id, |
400 int route_id, | 401 int route_id, |
401 bool cancel_requests); | 402 bool cancel_requests); |
402 | 403 |
403 void OnRequestResource(const IPC::Message& msg, | 404 void OnRequestResource(const IPC::Message& msg, |
404 int request_id, | 405 int request_id, |
405 const ViewHostMsg_Resource_Request& request_data); | 406 const ViewHostMsg_Resource_Request& request_data); |
406 void OnSyncLoad(int request_id, | 407 void OnSyncLoad(int request_id, |
(...skipping 16 matching lines...) Expand all Loading... |
423 ResourceHandler* handler, int child_id, int route_id, | 424 ResourceHandler* handler, int child_id, int route_id, |
424 ResourceType::Type resource_type); | 425 ResourceType::Type resource_type); |
425 | 426 |
426 // Creates ResourceDispatcherHostRequestInfo for a browser-initiated request | 427 // Creates ResourceDispatcherHostRequestInfo for a browser-initiated request |
427 // (a download or a page save). |download| should be true if the request | 428 // (a download or a page save). |download| should be true if the request |
428 // is a file download. | 429 // is a file download. |
429 ResourceDispatcherHostRequestInfo* CreateRequestInfoForBrowserRequest( | 430 ResourceDispatcherHostRequestInfo* CreateRequestInfoForBrowserRequest( |
430 ResourceHandler* handler, int child_id, int route_id, bool download); | 431 ResourceHandler* handler, int child_id, int route_id, bool download); |
431 | 432 |
432 // Returns true if |request| is in |pending_requests_|. | 433 // Returns true if |request| is in |pending_requests_|. |
433 bool IsValidRequest(URLRequest* request); | 434 bool IsValidRequest(net::URLRequest* request); |
434 | 435 |
435 // Returns true if the message passed in is a resource related message. | 436 // Returns true if the message passed in is a resource related message. |
436 static bool IsResourceDispatcherHostMessage(const IPC::Message&); | 437 static bool IsResourceDispatcherHostMessage(const IPC::Message&); |
437 | 438 |
438 // Sets replace_extension_localization_templates on all text/css requests that | 439 // Sets replace_extension_localization_templates on all text/css requests that |
439 // have "chrome-extension://" scheme. | 440 // have "chrome-extension://" scheme. |
440 static void ApplyExtensionLocalizationFilter( | 441 static void ApplyExtensionLocalizationFilter( |
441 const GURL& url, | 442 const GURL& url, |
442 const ResourceType::Type& resource_type, | 443 const ResourceType::Type& resource_type, |
443 ResourceDispatcherHostRequestInfo* request_info); | 444 ResourceDispatcherHostRequestInfo* request_info); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 | 494 |
494 // List of objects observing resource dispatching. | 495 // List of objects observing resource dispatching. |
495 ObserverList<Observer> observer_list_; | 496 ObserverList<Observer> observer_list_; |
496 | 497 |
497 // For running tasks. | 498 // For running tasks. |
498 ScopedRunnableMethodFactory<ResourceDispatcherHost> method_runner_; | 499 ScopedRunnableMethodFactory<ResourceDispatcherHost> method_runner_; |
499 | 500 |
500 // True if the resource dispatcher host has been shut down. | 501 // True if the resource dispatcher host has been shut down. |
501 bool is_shutdown_; | 502 bool is_shutdown_; |
502 | 503 |
503 typedef std::vector<URLRequest*> BlockedRequestsList; | 504 typedef std::vector<net::URLRequest*> BlockedRequestsList; |
504 typedef std::pair<int, int> ProcessRouteIDs; | 505 typedef std::pair<int, int> ProcessRouteIDs; |
505 typedef std::map<ProcessRouteIDs, BlockedRequestsList*> BlockedRequestMap; | 506 typedef std::map<ProcessRouteIDs, BlockedRequestsList*> BlockedRequestMap; |
506 BlockedRequestMap blocked_requests_map_; | 507 BlockedRequestMap blocked_requests_map_; |
507 | 508 |
508 // Maps the process_unique_ids to the approximate number of bytes | 509 // Maps the process_unique_ids to the approximate number of bytes |
509 // being used to service its resource requests. No entry implies 0 cost. | 510 // being used to service its resource requests. No entry implies 0 cost. |
510 typedef std::map<int, int> OutstandingRequestsMemoryCostMap; | 511 typedef std::map<int, int> OutstandingRequestsMemoryCostMap; |
511 OutstandingRequestsMemoryCostMap outstanding_requests_memory_cost_map_; | 512 OutstandingRequestsMemoryCostMap outstanding_requests_memory_cost_map_; |
512 | 513 |
513 // |max_outstanding_requests_cost_per_process_| is the upper bound on how | 514 // |max_outstanding_requests_cost_per_process_| is the upper bound on how |
514 // many outstanding requests can be issued per child process host. | 515 // many outstanding requests can be issued per child process host. |
515 // The constraint is expressed in terms of bytes (where the cost of | 516 // The constraint is expressed in terms of bytes (where the cost of |
516 // individual requests is given by CalculateApproximateMemoryCost). | 517 // individual requests is given by CalculateApproximateMemoryCost). |
517 // The total number of outstanding requests is roughly: | 518 // The total number of outstanding requests is roughly: |
518 // (max_outstanding_requests_cost_per_process_ / | 519 // (max_outstanding_requests_cost_per_process_ / |
519 // kAvgBytesPerOutstandingRequest) | 520 // kAvgBytesPerOutstandingRequest) |
520 int max_outstanding_requests_cost_per_process_; | 521 int max_outstanding_requests_cost_per_process_; |
521 | 522 |
522 // Used during IPC message dispatching so that the handlers can get a pointer | 523 // Used during IPC message dispatching so that the handlers can get a pointer |
523 // to the source of the message. | 524 // to the source of the message. |
524 Receiver* receiver_; | 525 Receiver* receiver_; |
525 | 526 |
526 static bool is_prefetch_enabled_; | 527 static bool is_prefetch_enabled_; |
527 | 528 |
528 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHost); | 529 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHost); |
529 }; | 530 }; |
530 | 531 |
531 #endif // CHROME_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_ | 532 #endif // CHROME_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_ |
OLD | NEW |