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

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

Issue 2503813002: Fix and refactor downloaded file handling in the loading stack (Closed)
Patch Set: -Release 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 30 matching lines...) Expand all
41 #include "ipc/ipc_message.h" 41 #include "ipc/ipc_message.h"
42 #include "mojo/public/cpp/system/data_pipe.h" 42 #include "mojo/public/cpp/system/data_pipe.h"
43 #include "net/base/request_priority.h" 43 #include "net/base/request_priority.h"
44 #include "net/cookies/canonical_cookie.h" 44 #include "net/cookies/canonical_cookie.h"
45 #include "net/url_request/url_request.h" 45 #include "net/url_request/url_request.h"
46 46
47 namespace base { 47 namespace base {
48 class FilePath; 48 class FilePath;
49 } 49 }
50 50
51 namespace storage {
52 class ShareableFileReference;
53 }
54
55 namespace content { 51 namespace content {
56 class AppCacheService; 52 class AppCacheService;
57 class AsyncRevalidationManager; 53 class AsyncRevalidationManager;
54 class DownloadedTempFileImpl;
58 class LoaderDelegate; 55 class LoaderDelegate;
59 class NavigationURLLoaderImplCore; 56 class NavigationURLLoaderImplCore;
60 class NavigationUIData; 57 class NavigationUIData;
61 class RenderFrameHostImpl; 58 class RenderFrameHostImpl;
62 class ResourceContext; 59 class ResourceContext;
63 class ResourceDispatcherHostDelegate; 60 class ResourceDispatcherHostDelegate;
64 class ResourceHandler; 61 class ResourceHandler;
65 class ResourceMessageDelegate; 62 class ResourceMessageDelegate;
66 class ResourceMessageFilter; 63 class ResourceMessageFilter;
67 class ResourceRequestInfoImpl; 64 class ResourceRequestInfoImpl;
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 204
208 // Cancels any blocked request for the specified route id. 205 // Cancels any blocked request for the specified route id.
209 void CancelBlockedRequestsForRoute( 206 void CancelBlockedRequestsForRoute(
210 const GlobalFrameRoutingId& global_routing_id); 207 const GlobalFrameRoutingId& global_routing_id);
211 208
212 // Maintains a collection of temp files created in support of 209 // Maintains a collection of temp files created in support of
213 // the download_to_file capability. Used to grant access to the 210 // the download_to_file capability. Used to grant access to the
214 // child process and to defer deletion of the file until it's 211 // child process and to defer deletion of the file until it's
215 // no longer needed. 212 // no longer needed.
216 void RegisterDownloadedTempFile( 213 void RegisterDownloadedTempFile(
217 int child_id, int request_id, 214 std::unique_ptr<DownloadedTempFileImpl> downloaded_temp_file);
218 const base::FilePath& file_path);
219 void UnregisterDownloadedTempFile(int child_id, int request_id); 215 void UnregisterDownloadedTempFile(int child_id, int request_id);
220 216
221 // Needed for the sync IPC message dispatcher macros. 217 // Needed for the sync IPC message dispatcher macros.
222 bool Send(IPC::Message* message); 218 bool Send(IPC::Message* message);
223 219
224 // Indicates whether third-party sub-content can pop-up HTTP basic auth 220 // Indicates whether third-party sub-content can pop-up HTTP basic auth
225 // dialog boxes. 221 // dialog boxes.
226 bool allow_cross_origin_auth_prompt(); 222 bool allow_cross_origin_auth_prompt();
227 223
228 ResourceDispatcherHostDelegate* delegate() { 224 ResourceDispatcherHostDelegate* delegate() {
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 std::unique_ptr<ResourceHandler> handler, 675 std::unique_ptr<ResourceHandler> handler,
680 bool is_content_initiated, 676 bool is_content_initiated,
681 bool must_download, 677 bool must_download,
682 bool is_new_request); 678 bool is_new_request);
683 679
684 LoaderMap pending_loaders_; 680 LoaderMap pending_loaders_;
685 681
686 // Collection of temp files downloaded for child processes via 682 // Collection of temp files downloaded for child processes via
687 // the download_to_file mechanism. We avoid deleting them until 683 // the download_to_file mechanism. We avoid deleting them until
688 // the client no longer needs them. 684 // the client no longer needs them.
689 typedef std::map<int, scoped_refptr<storage::ShareableFileReference> > 685 typedef std::map<int, std::unique_ptr<DownloadedTempFileImpl>>
690 DeletableFilesMap; // key is request id 686 DeletableFilesMap; // key is request id
691 typedef std::map<int, DeletableFilesMap> 687 typedef std::map<int, DeletableFilesMap>
692 RegisteredTempFiles; // key is child process id 688 RegisteredTempFiles; // key is child process id
693 RegisteredTempFiles registered_temp_files_; 689 RegisteredTempFiles registered_temp_files_;
694 690
695 // A timer that periodically calls UpdateLoadInfo while pending_loaders_ is 691 // A timer that periodically calls UpdateLoadInfo while pending_loaders_ is
696 // not empty and at least one RenderViewHost is loading. 692 // not empty and at least one RenderViewHost is loading.
697 std::unique_ptr<base::RepeatingTimer> update_load_states_timer_; 693 std::unique_ptr<base::RepeatingTimer> update_load_states_timer_;
698 694
699 // Request ID for browser initiated requests. request_ids generated by 695 // Request ID for browser initiated requests. request_ids generated by
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 769
774 // Points to the registered download handler intercept. 770 // Points to the registered download handler intercept.
775 CreateDownloadHandlerIntercept create_download_handler_intercept_; 771 CreateDownloadHandlerIntercept create_download_handler_intercept_;
776 772
777 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); 773 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl);
778 }; 774 };
779 775
780 } // namespace content 776 } // namespace content
781 777
782 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ 778 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698