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

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

Issue 3455022: Revert 60378 (trying to track down http://crbug.com/56752 )- Flesh out URLLoa... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 2 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) 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 29 matching lines...) Expand all
40 class SocketStreamDispatcherHost; 40 class SocketStreamDispatcherHost;
41 class SSLClientAuthHandler; 41 class SSLClientAuthHandler;
42 class UserScriptListener; 42 class UserScriptListener;
43 class URLRequestContext; 43 class URLRequestContext;
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 {
51 class DeletableFileReference;
52 }
53
54 class ResourceDispatcherHost : public URLRequest::Delegate { 50 class ResourceDispatcherHost : public URLRequest::Delegate {
55 public: 51 public:
56 // Implemented by the client of ResourceDispatcherHost to receive messages in 52 // Implemented by the client of ResourceDispatcherHost to receive messages in
57 // response to a resource load. The messages are intended to be forwarded to 53 // 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 54 // the ResourceDispatcher in the child process via an IPC channel that the
59 // client manages. 55 // client manages.
60 // 56 //
61 // NOTE: This class unfortunately cannot be named 'Delegate' because that 57 // NOTE: This class unfortunately cannot be named 'Delegate' because that
62 // conflicts with the name of ResourceDispatcherHost's base class. 58 // conflicts with the name of ResourceDispatcherHost's base class.
63 // 59 //
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 void ResumeBlockedRequestsForRoute(int process_unique_id, int route_id); 257 void ResumeBlockedRequestsForRoute(int process_unique_id, int route_id);
262 258
263 // Cancels any blocked request for the specified route id. 259 // Cancels any blocked request for the specified route id.
264 void CancelBlockedRequestsForRoute(int process_unique_id, int route_id); 260 void CancelBlockedRequestsForRoute(int process_unique_id, int route_id);
265 261
266 // Decrements the pending_data_count for the request and resumes 262 // Decrements the pending_data_count for the request and resumes
267 // the request if it was paused due to too many pending data 263 // the request if it was paused due to too many pending data
268 // messages sent. 264 // messages sent.
269 void DataReceivedACK(int process_unique_id, int request_id); 265 void DataReceivedACK(int process_unique_id, int request_id);
270 266
271 // Maintains a collection of temp files created in support of
272 // the download_to_file capability. Used to grant access to the
273 // child process and to defer deletion of the file until it's
274 // no longer needed.
275 void RegisterDownloadedTempFile(
276 int receiver_id, int request_id,
277 webkit_blob::DeletableFileReference* reference);
278 void UnregisterDownloadedTempFile(int receiver_id, int request_id);
279
280 // Needed for the sync IPC message dispatcher macros. 267 // Needed for the sync IPC message dispatcher macros.
281 bool Send(IPC::Message* message); 268 bool Send(IPC::Message* message);
282 269
283 // Controls if we launch or squash prefetch requests as they arrive 270 // Controls if we launch or squash prefetch requests as they arrive
284 // from renderers. 271 // from renderers.
285 static bool is_prefetch_enabled(); 272 static bool is_prefetch_enabled();
286 static void set_is_prefetch_enabled(bool value); 273 static void set_is_prefetch_enabled(bool value);
287 274
288 private: 275 private:
289 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, 276 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest,
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 int request_id, 390 int request_id,
404 const ViewHostMsg_Resource_Request& request_data); 391 const ViewHostMsg_Resource_Request& request_data);
405 void OnSyncLoad(int request_id, 392 void OnSyncLoad(int request_id,
406 const ViewHostMsg_Resource_Request& request_data, 393 const ViewHostMsg_Resource_Request& request_data,
407 IPC::Message* sync_result); 394 IPC::Message* sync_result);
408 void BeginRequest(int request_id, 395 void BeginRequest(int request_id,
409 const ViewHostMsg_Resource_Request& request_data, 396 const ViewHostMsg_Resource_Request& request_data,
410 IPC::Message* sync_result, // only valid for sync 397 IPC::Message* sync_result, // only valid for sync
411 int route_id); // only valid for async 398 int route_id); // only valid for async
412 void OnDataReceivedACK(int request_id); 399 void OnDataReceivedACK(int request_id);
413 void OnDataDownloadedACK(int request_id);
414 void OnUploadProgressACK(int request_id); 400 void OnUploadProgressACK(int request_id);
415 void OnCancelRequest(int request_id); 401 void OnCancelRequest(int request_id);
416 void OnFollowRedirect(int request_id, 402 void OnFollowRedirect(int request_id,
417 bool has_new_first_party_for_cookies, 403 bool has_new_first_party_for_cookies,
418 const GURL& new_first_party_for_cookies); 404 const GURL& new_first_party_for_cookies);
419 void OnResourceLoaderDeleted(int request_id);
420 405
421 ResourceHandler* CreateSafeBrowsingResourceHandler( 406 ResourceHandler* CreateSafeBrowsingResourceHandler(
422 ResourceHandler* handler, int child_id, int route_id, 407 ResourceHandler* handler, int child_id, int route_id,
423 ResourceType::Type resource_type); 408 ResourceType::Type resource_type);
424 409
425 // Creates ResourceDispatcherHostRequestInfo for a browser-initiated request 410 // Creates ResourceDispatcherHostRequestInfo for a browser-initiated request
426 // (a download or a page save). |download| should be true if the request 411 // (a download or a page save). |download| should be true if the request
427 // is a file download. 412 // is a file download.
428 ResourceDispatcherHostRequestInfo* CreateRequestInfoForBrowserRequest( 413 ResourceDispatcherHostRequestInfo* CreateRequestInfoForBrowserRequest(
429 ResourceHandler* handler, int child_id, int route_id, bool download); 414 ResourceHandler* handler, int child_id, int route_id, bool download);
(...skipping 10 matching lines...) Expand all
440 const GURL& url, 425 const GURL& url,
441 const ResourceType::Type& resource_type, 426 const ResourceType::Type& resource_type,
442 ResourceDispatcherHostRequestInfo* request_info); 427 ResourceDispatcherHostRequestInfo* request_info);
443 428
444 // Determine request priority based on how critical this resource typically 429 // Determine request priority based on how critical this resource typically
445 // is to user-perceived page load performance. 430 // is to user-perceived page load performance.
446 static net::RequestPriority DetermineRequestPriority(ResourceType::Type type); 431 static net::RequestPriority DetermineRequestPriority(ResourceType::Type type);
447 432
448 PendingRequestList pending_requests_; 433 PendingRequestList pending_requests_;
449 434
450 // Collection of temp files downloaded for child processes via
451 // the download_to_file mechanism. We avoid deleting them until
452 // the loader in the client has been deleted.
453 typedef std::map<int, scoped_refptr<webkit_blob::DeletableFileReference> >
454 DeletableFilesMap; // key is request id
455 typedef std::map<int, DeletableFilesMap>
456 RegisteredTempFiles; // key is child process id
457 RegisteredTempFiles registered_temp_files_;
458
459 // A timer that periodically calls UpdateLoadStates while pending_requests_ 435 // A timer that periodically calls UpdateLoadStates while pending_requests_
460 // is not empty. 436 // is not empty.
461 base::RepeatingTimer<ResourceDispatcherHost> update_load_states_timer_; 437 base::RepeatingTimer<ResourceDispatcherHost> update_load_states_timer_;
462 438
463 // Handles the resource requests from the moment we want to start them. 439 // Handles the resource requests from the moment we want to start them.
464 ResourceQueue resource_queue_; 440 ResourceQueue resource_queue_;
465 441
466 // We own the download file writing thread and manager 442 // We own the download file writing thread and manager
467 scoped_refptr<DownloadFileManager> download_file_manager_; 443 scoped_refptr<DownloadFileManager> download_file_manager_;
468 444
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 // Used during IPC message dispatching so that the handlers can get a pointer 497 // Used during IPC message dispatching so that the handlers can get a pointer
522 // to the source of the message. 498 // to the source of the message.
523 Receiver* receiver_; 499 Receiver* receiver_;
524 500
525 static bool is_prefetch_enabled_; 501 static bool is_prefetch_enabled_;
526 502
527 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHost); 503 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHost);
528 }; 504 };
529 505
530 #endif // CHROME_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_ 506 #endif // CHROME_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698