| OLD | NEW |
| 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 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 fowards the messages from the | 7 // dispatches them to URLRequests. It then fowards 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 filter_policy(FilterPolicy::DONT_FILTER), | 101 filter_policy(FilterPolicy::DONT_FILTER), |
| 102 last_load_state(net::LOAD_STATE_IDLE), | 102 last_load_state(net::LOAD_STATE_IDLE), |
| 103 upload_size(upload_size), | 103 upload_size(upload_size), |
| 104 last_upload_position(0), | 104 last_upload_position(0), |
| 105 waiting_for_upload_progress_ack(false), | 105 waiting_for_upload_progress_ack(false), |
| 106 memory_cost(0), | 106 memory_cost(0), |
| 107 is_paused(false), | 107 is_paused(false), |
| 108 has_started_reading(false), | 108 has_started_reading(false), |
| 109 paused_read_bytes(0) { | 109 paused_read_bytes(0) { |
| 110 } | 110 } |
| 111 virtual ~ExtraRequestInfo() { resource_handler->OnRequestClosed(); } |
| 111 | 112 |
| 112 // Top-level ResourceHandler servicing this request. | 113 // Top-level ResourceHandler servicing this request. |
| 113 scoped_refptr<ResourceHandler> resource_handler; | 114 scoped_refptr<ResourceHandler> resource_handler; |
| 114 | 115 |
| 115 // CrossSiteResourceHandler for this request, if it is a cross-site request. | 116 // CrossSiteResourceHandler for this request, if it is a cross-site request. |
| 116 // (NULL otherwise.) This handler is part of the chain of ResourceHandlers | 117 // (NULL otherwise.) This handler is part of the chain of ResourceHandlers |
| 117 // pointed to by resource_handler. | 118 // pointed to by resource_handler. |
| 118 CrossSiteResourceHandler* cross_site_handler; | 119 CrossSiteResourceHandler* cross_site_handler; |
| 119 | 120 |
| 120 LoginHandler* login_handler; | 121 LoginHandler* login_handler; |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 // observe resource events on the UI thread, subscribe to the | 346 // observe resource events on the UI thread, subscribe to the |
| 346 // NOTIFY_RESOURCE_* notifications of the notification service. | 347 // NOTIFY_RESOURCE_* notifications of the notification service. |
| 347 void AddObserver(Observer* obs); | 348 void AddObserver(Observer* obs); |
| 348 | 349 |
| 349 // Removes an observer. | 350 // Removes an observer. |
| 350 void RemoveObserver(Observer* obs); | 351 void RemoveObserver(Observer* obs); |
| 351 | 352 |
| 352 // Retrieves a URLRequest. Must be called from the IO thread. | 353 // Retrieves a URLRequest. Must be called from the IO thread. |
| 353 URLRequest* GetURLRequest(GlobalRequestID request_id) const; | 354 URLRequest* GetURLRequest(GlobalRequestID request_id) const; |
| 354 | 355 |
| 355 // A test to determining whether a given request should be forwarded to the | |
| 356 // download thread. | |
| 357 bool ShouldDownload(const std::string& mime_type, | |
| 358 const std::string& content_disposition); | |
| 359 | |
| 360 // Notifies our observers that a request has been cancelled. | 356 // Notifies our observers that a request has been cancelled. |
| 361 void NotifyResponseCompleted(URLRequest* request, int process_id); | 357 void NotifyResponseCompleted(URLRequest* request, int process_id); |
| 362 | 358 |
| 363 void RemovePendingRequest(int process_id, int request_id); | 359 void RemovePendingRequest(int process_id, int request_id); |
| 364 | 360 |
| 365 // Causes all new requests for the route identified by | 361 // Causes all new requests for the route identified by |
| 366 // |process_id| and |route_id| to be blocked (not being | 362 // |process_id| and |route_id| to be blocked (not being |
| 367 // started) until ResumeBlockedRequestsForRoute or | 363 // started) until ResumeBlockedRequestsForRoute or |
| 368 // CancelBlockedRequestsForRoute is called. | 364 // CancelBlockedRequestsForRoute is called. |
| 369 void BlockRequestsForRoute(int process_id, int route_id); | 365 void BlockRequestsForRoute(int process_id, int route_id); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 // start at -2 and go down from there. (We need to start at -2 because -1 is | 540 // start at -2 and go down from there. (We need to start at -2 because -1 is |
| 545 // used as a special value all over the resource_dispatcher_host for | 541 // used as a special value all over the resource_dispatcher_host for |
| 546 // uninitialized variables.) This way, we no longer have the unlikely (but | 542 // uninitialized variables.) This way, we no longer have the unlikely (but |
| 547 // observed in the real world!) event where we have two requests with the same | 543 // observed in the real world!) event where we have two requests with the same |
| 548 // request_id_. | 544 // request_id_. |
| 549 int request_id_; | 545 int request_id_; |
| 550 | 546 |
| 551 // List of objects observing resource dispatching. | 547 // List of objects observing resource dispatching. |
| 552 ObserverList<Observer> observer_list_; | 548 ObserverList<Observer> observer_list_; |
| 553 | 549 |
| 554 PluginService* plugin_service_; | |
| 555 | |
| 556 // For running tasks. | 550 // For running tasks. |
| 557 ScopedRunnableMethodFactory<ResourceDispatcherHost> method_runner_; | 551 ScopedRunnableMethodFactory<ResourceDispatcherHost> method_runner_; |
| 558 | 552 |
| 559 // True if the resource dispatcher host has been shut down. | 553 // True if the resource dispatcher host has been shut down. |
| 560 bool is_shutdown_; | 554 bool is_shutdown_; |
| 561 | 555 |
| 562 typedef std::vector<URLRequest*> BlockedRequestsList; | 556 typedef std::vector<URLRequest*> BlockedRequestsList; |
| 563 typedef std::pair<int, int> ProcessRouteIDs; | 557 typedef std::pair<int, int> ProcessRouteIDs; |
| 564 typedef std::map<ProcessRouteIDs, BlockedRequestsList*> BlockedRequestMap; | 558 typedef std::map<ProcessRouteIDs, BlockedRequestsList*> BlockedRequestMap; |
| 565 BlockedRequestMap blocked_requests_map_; | 559 BlockedRequestMap blocked_requests_map_; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 581 // Used during IPC message dispatching so that the handlers can get a pointer | 575 // Used during IPC message dispatching so that the handlers can get a pointer |
| 582 // to the source of the message. | 576 // to the source of the message. |
| 583 Receiver* receiver_; | 577 Receiver* receiver_; |
| 584 | 578 |
| 585 static bool g_is_http_prioritization_enabled; | 579 static bool g_is_http_prioritization_enabled; |
| 586 | 580 |
| 587 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHost); | 581 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHost); |
| 588 }; | 582 }; |
| 589 | 583 |
| 590 #endif // CHROME_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_ | 584 #endif // CHROME_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_ |
| OLD | NEW |