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

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

Issue 2496193002: Implement transfer navigation with mojo (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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 78
79 class CONTENT_EXPORT ResourceDispatcherHostImpl 79 class CONTENT_EXPORT ResourceDispatcherHostImpl
80 : public ResourceDispatcherHost, 80 : public ResourceDispatcherHost,
81 public ResourceLoaderDelegate { 81 public ResourceLoaderDelegate {
82 public: 82 public:
83 // Used to handle the result of SyncLoad IPC. |result| is null if it's 83 // Used to handle the result of SyncLoad IPC. |result| is null if it's
84 // unavailable due to an error. 84 // unavailable due to an error.
85 using SyncLoadResultCallback = 85 using SyncLoadResultCallback =
86 base::Callback<void(const SyncLoadResult* result)>; 86 base::Callback<void(const SyncLoadResult* result)>;
87 87
88 using TransferCallback =
89 base::Callback<void(mojom::URLLoaderAssociatedRequest,
90 mojom::URLLoaderClientAssociatedPtr)>;
88 // This constructor should be used if we want downloads to work correctly. 91 // This constructor should be used if we want downloads to work correctly.
89 // TODO(ananta) 92 // TODO(ananta)
90 // Work on moving creation of download handlers out of 93 // Work on moving creation of download handlers out of
91 // ResourceDispatcherHostImpl. 94 // ResourceDispatcherHostImpl.
92 ResourceDispatcherHostImpl( 95 ResourceDispatcherHostImpl(
93 CreateDownloadHandlerIntercept download_handler_intercept); 96 CreateDownloadHandlerIntercept download_handler_intercept);
94 ResourceDispatcherHostImpl(); 97 ResourceDispatcherHostImpl();
95 ~ResourceDispatcherHostImpl() override; 98 ~ResourceDispatcherHostImpl() override;
96 99
97 // Returns the current ResourceDispatcherHostImpl. May return NULL if it 100 // Returns the current ResourceDispatcherHostImpl. May return NULL if it
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 ResourceMessageFilter* filter); 141 ResourceMessageFilter* filter);
139 142
140 // Cancels the given request if it still exists. 143 // Cancels the given request if it still exists.
141 void CancelRequest(int child_id, int request_id); 144 void CancelRequest(int child_id, int request_id);
142 145
143 // Marks the request, with its current |response|, as "parked". This 146 // Marks the request, with its current |response|, as "parked". This
144 // happens if a request is redirected cross-site and needs to be 147 // happens if a request is redirected cross-site and needs to be
145 // resumed by a new process. 148 // resumed by a new process.
146 void MarkAsTransferredNavigation( 149 void MarkAsTransferredNavigation(
147 const GlobalRequestID& id, 150 const GlobalRequestID& id,
148 const base::Closure& on_transfer_complete_callback); 151 const TransferCallback& on_transfer_complete_callback);
149 152
150 // Cancels a request previously marked as being transferred, for use when a 153 // Cancels a request previously marked as being transferred, for use when a
151 // navigation was cancelled. 154 // navigation was cancelled.
152 void CancelTransferringNavigation(const GlobalRequestID& id); 155 void CancelTransferringNavigation(const GlobalRequestID& id);
153 156
154 // Resumes the request without transferring it to a new process. 157 // Resumes the request without transferring it to a new process.
155 void ResumeDeferredNavigation(const GlobalRequestID& id); 158 void ResumeDeferredNavigation(const GlobalRequestID& id);
156 159
157 // Returns the number of pending requests. This is designed for the unittests 160 // Returns the number of pending requests. This is designed for the unittests
158 int pending_requests() const { 161 int pending_requests() const {
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 void UpdateRequestForTransfer(int child_id, 550 void UpdateRequestForTransfer(int child_id,
548 int route_id, 551 int route_id,
549 int request_id, 552 int request_id,
550 const ResourceRequest& request_data, 553 const ResourceRequest& request_data,
551 LoaderMap::iterator iter); 554 LoaderMap::iterator iter);
552 555
553 // If |request_data| is for a request being transferred from another process, 556 // If |request_data| is for a request being transferred from another process,
554 // then CompleteTransfer method can be used to complete the transfer. 557 // then CompleteTransfer method can be used to complete the transfer.
555 void CompleteTransfer(int request_id, 558 void CompleteTransfer(int request_id,
556 const ResourceRequest& request_data, 559 const ResourceRequest& request_data,
557 int route_id); 560 int route_id,
561 mojom::URLLoaderAssociatedRequest mojo_request,
562 mojom::URLLoaderClientAssociatedPtr url_loader_client);
558 563
559 void BeginRequest( 564 void BeginRequest(
560 int request_id, 565 int request_id,
561 const ResourceRequest& request_data, 566 const ResourceRequest& request_data,
562 const SyncLoadResultCallback& sync_result_handler, // only valid for sync 567 const SyncLoadResultCallback& sync_result_handler, // only valid for sync
563 int route_id, 568 int route_id,
564 mojom::URLLoaderAssociatedRequest mojo_request, 569 mojom::URLLoaderAssociatedRequest mojo_request,
565 mojom::URLLoaderClientAssociatedPtr url_loader_client); 570 mojom::URLLoaderClientAssociatedPtr url_loader_client);
566 571
567 // There are requests which need decisions to be made like the following: 572 // There are requests which need decisions to be made like the following:
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 // loading and navigation requests. This adds MimeTypeResourceHandler and 606 // loading and navigation requests. This adds MimeTypeResourceHandler and
602 // ResourceThrottles. 607 // ResourceThrottles.
603 std::unique_ptr<ResourceHandler> AddStandardHandlers( 608 std::unique_ptr<ResourceHandler> AddStandardHandlers(
604 net::URLRequest* request, 609 net::URLRequest* request,
605 ResourceType resource_type, 610 ResourceType resource_type,
606 ResourceContext* resource_context, 611 ResourceContext* resource_context,
607 RequestContextType fetch_request_context_type, 612 RequestContextType fetch_request_context_type,
608 AppCacheService* appcache_service, 613 AppCacheService* appcache_service,
609 int child_id, 614 int child_id,
610 int route_id, 615 int route_id,
611 std::unique_ptr<ResourceHandler> handler); 616 std::unique_ptr<ResourceHandler> handler,
617 TransferCallback transfer_callback);
612 618
613 void OnCancelRequest(int request_id); 619 void OnCancelRequest(int request_id);
614 void OnReleaseDownloadedFile(int request_id); 620 void OnReleaseDownloadedFile(int request_id);
615 void OnDidChangePriority(int request_id, 621 void OnDidChangePriority(int request_id,
616 net::RequestPriority new_priority, 622 net::RequestPriority new_priority,
617 int intra_priority_value); 623 int intra_priority_value);
618 624
619 // Creates ResourceRequestInfoImpl for a download or page save. 625 // Creates ResourceRequestInfoImpl for a download or page save.
620 // |download| should be true if the request is a file download. 626 // |download| should be true if the request is a file download.
621 ResourceRequestInfoImpl* CreateRequestInfo( 627 ResourceRequestInfoImpl* CreateRequestInfo(
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 779
774 // Points to the registered download handler intercept. 780 // Points to the registered download handler intercept.
775 CreateDownloadHandlerIntercept create_download_handler_intercept_; 781 CreateDownloadHandlerIntercept create_download_handler_intercept_;
776 782
777 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); 783 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl);
778 }; 784 };
779 785
780 } // namespace content 786 } // namespace content
781 787
782 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ 788 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698