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

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

Issue 2449933003: Use Associated interfaces for mojo-loading (Closed)
Patch Set: fix Created 4 years, 1 month 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
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 // 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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 // transferred. The LoaderDelegate should be interacted with on the IO thread. 297 // transferred. The LoaderDelegate should be interacted with on the IO thread.
298 void SetLoaderDelegate(LoaderDelegate* loader_delegate); 298 void SetLoaderDelegate(LoaderDelegate* loader_delegate);
299 299
300 void OnRenderFrameDeleted(const GlobalFrameRoutingId& global_routing_id); 300 void OnRenderFrameDeleted(const GlobalFrameRoutingId& global_routing_id);
301 301
302 // Called when loading a request with mojo. 302 // Called when loading a request with mojo.
303 void OnRequestResourceWithMojo( 303 void OnRequestResourceWithMojo(
304 int routing_id, 304 int routing_id,
305 int request_id, 305 int request_id,
306 const ResourceRequest& request, 306 const ResourceRequest& request,
307 mojo::InterfaceRequest<mojom::URLLoader> mojo_request, 307 mojom::URLLoaderAssociatedRequest mojo_request,
308 mojom::URLLoaderClientPtr url_loader_client, 308 mojom::URLLoaderClientAssociatedPtr url_loader_client,
309 ResourceMessageFilter* filter); 309 ResourceMessageFilter* filter);
310 310
311 void OnSyncLoadWithMojo(int routing_id, 311 void OnSyncLoadWithMojo(int routing_id,
312 int request_id, 312 int request_id,
313 const ResourceRequest& request_data, 313 const ResourceRequest& request_data,
314 ResourceMessageFilter* filter, 314 ResourceMessageFilter* filter,
315 const SyncLoadResultCallback& result_handler); 315 const SyncLoadResultCallback& result_handler);
316 316
317 // Helper function for initializing the |request| passed in. By initializing 317 // Helper function for initializing the |request| passed in. By initializing
318 // we mean setting the |referrer| on the |request|, associating the 318 // we mean setting the |referrer| on the |request|, associating the
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 bool cancel_requests); 525 bool cancel_requests);
526 526
527 void OnRequestResource(int routing_id, 527 void OnRequestResource(int routing_id,
528 int request_id, 528 int request_id,
529 const ResourceRequest& request_data); 529 const ResourceRequest& request_data);
530 530
531 void OnRequestResourceInternal( 531 void OnRequestResourceInternal(
532 int routing_id, 532 int routing_id,
533 int request_id, 533 int request_id,
534 const ResourceRequest& request_data, 534 const ResourceRequest& request_data,
535 mojo::InterfaceRequest<mojom::URLLoader> mojo_request, 535 mojom::URLLoaderAssociatedRequest mojo_request,
536 mojom::URLLoaderClientPtr url_loader_client); 536 mojom::URLLoaderClientAssociatedPtr url_loader_client);
537 537
538 void OnSyncLoad(int request_id, 538 void OnSyncLoad(int request_id,
539 const ResourceRequest& request_data, 539 const ResourceRequest& request_data,
540 IPC::Message* sync_result); 540 IPC::Message* sync_result);
541 541
542 bool IsRequestIDInUse(const GlobalRequestID& id) const; 542 bool IsRequestIDInUse(const GlobalRequestID& id) const;
543 543
544 // Update the ResourceRequestInfo and internal maps when a request is 544 // Update the ResourceRequestInfo and internal maps when a request is
545 // transferred from one process to another. 545 // transferred from one process to another.
546 void UpdateRequestForTransfer(int child_id, 546 void UpdateRequestForTransfer(int child_id,
547 int route_id, 547 int route_id,
548 int request_id, 548 int request_id,
549 const ResourceRequest& request_data, 549 const ResourceRequest& request_data,
550 LoaderMap::iterator iter); 550 LoaderMap::iterator iter);
551 551
552 // If |request_data| is for a request being transferred from another process, 552 // If |request_data| is for a request being transferred from another process,
553 // then CompleteTransfer method can be used to complete the transfer. 553 // then CompleteTransfer method can be used to complete the transfer.
554 void CompleteTransfer(int request_id, 554 void CompleteTransfer(int request_id,
555 const ResourceRequest& request_data, 555 const ResourceRequest& request_data,
556 int route_id); 556 int route_id);
557 557
558 void BeginRequest( 558 void BeginRequest(
559 int request_id, 559 int request_id,
560 const ResourceRequest& request_data, 560 const ResourceRequest& request_data,
561 const SyncLoadResultCallback& sync_result_handler, // only valid for sync 561 const SyncLoadResultCallback& sync_result_handler, // only valid for sync
562 int route_id, 562 int route_id,
563 mojo::InterfaceRequest<mojom::URLLoader> mojo_request, 563 mojom::URLLoaderAssociatedRequest mojo_request,
564 mojom::URLLoaderClientPtr url_loader_client); 564 mojom::URLLoaderClientAssociatedPtr url_loader_client);
565 565
566 // There are requests which need decisions to be made like the following: 566 // There are requests which need decisions to be made like the following:
567 // Whether the presence of certain HTTP headers like the Origin header are 567 // Whether the presence of certain HTTP headers like the Origin header are
568 // valid, etc. These requests may need to be aborted based on these 568 // valid, etc. These requests may need to be aborted based on these
569 // decisions which could be time consuming. We allow for these decisions 569 // decisions which could be time consuming. We allow for these decisions
570 // to be made asynchronously. The request proceeds when we hear back from 570 // to be made asynchronously. The request proceeds when we hear back from
571 // the interceptors about whether to continue or not. 571 // the interceptors about whether to continue or not.
572 // The |continue_request| parameter in the function indicates whether the 572 // The |continue_request| parameter in the function indicates whether the
573 // request should be continued or aborted. The |error_code| parameter is set 573 // request should be continued or aborted. The |error_code| parameter is set
574 // if |continue_request| is false. 574 // if |continue_request| is false.
575 void ContinuePendingBeginRequest( 575 void ContinuePendingBeginRequest(
576 int request_id, 576 int request_id,
577 const ResourceRequest& request_data, 577 const ResourceRequest& request_data,
578 const SyncLoadResultCallback& sync_result_handler, // only valid for sync 578 const SyncLoadResultCallback& sync_result_handler, // only valid for sync
579 int route_id, 579 int route_id,
580 const net::HttpRequestHeaders& headers, 580 const net::HttpRequestHeaders& headers,
581 mojo::InterfaceRequest<mojom::URLLoader> mojo_request, 581 mojom::URLLoaderAssociatedRequest mojo_request,
582 mojom::URLLoaderClientPtr url_loader_client, 582 mojom::URLLoaderClientAssociatedPtr url_loader_client,
583 bool continue_request, 583 bool continue_request,
584 int error_code); 584 int error_code);
585 585
586 // Creates a ResourceHandler to be used by BeginRequest() for normal resource 586 // Creates a ResourceHandler to be used by BeginRequest() for normal resource
587 // loading. 587 // loading.
588 std::unique_ptr<ResourceHandler> CreateResourceHandler( 588 std::unique_ptr<ResourceHandler> CreateResourceHandler(
589 net::URLRequest* request, 589 net::URLRequest* request,
590 const ResourceRequest& request_data, 590 const ResourceRequest& request_data,
591 const SyncLoadResultCallback& sync_result_handler, 591 const SyncLoadResultCallback& sync_result_handler,
592 int route_id, 592 int route_id,
593 int process_type, 593 int process_type,
594 int child_id, 594 int child_id,
595 ResourceContext* resource_context, 595 ResourceContext* resource_context,
596 mojo::InterfaceRequest<mojom::URLLoader> mojo_request, 596 mojom::URLLoaderAssociatedRequest mojo_request,
597 mojom::URLLoaderClientPtr url_loader_client); 597 mojom::URLLoaderClientAssociatedPtr url_loader_client);
598 598
599 // Wraps |handler| in the standard resource handlers for normal resource 599 // Wraps |handler| in the standard resource handlers for normal resource
600 // loading and navigation requests. This adds MimeTypeResourceHandler and 600 // loading and navigation requests. This adds MimeTypeResourceHandler and
601 // ResourceThrottles. 601 // ResourceThrottles.
602 std::unique_ptr<ResourceHandler> AddStandardHandlers( 602 std::unique_ptr<ResourceHandler> AddStandardHandlers(
603 net::URLRequest* request, 603 net::URLRequest* request,
604 ResourceType resource_type, 604 ResourceType resource_type,
605 ResourceContext* resource_context, 605 ResourceContext* resource_context,
606 RequestContextType fetch_request_context_type, 606 RequestContextType fetch_request_context_type,
607 AppCacheService* appcache_service, 607 AppCacheService* appcache_service,
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 773
774 // Points to the registered download handler intercept. 774 // Points to the registered download handler intercept.
775 CreateDownloadHandlerIntercept create_download_handler_intercept_; 775 CreateDownloadHandlerIntercept create_download_handler_intercept_;
776 776
777 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); 777 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl);
778 }; 778 };
779 779
780 } // namespace content 780 } // namespace content
781 781
782 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ 782 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698