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

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: +RunUntilIdle 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 namespace base { 42 namespace base {
43 class FilePath; 43 class FilePath;
44 class RepeatingTimer; 44 class RepeatingTimer;
45 } 45 }
46 46
47 namespace net { 47 namespace net {
48 class URLRequest; 48 class URLRequest;
49 class HttpRequestHeaders; 49 class HttpRequestHeaders;
50 } 50 }
51 51
52 namespace storage {
53 class ShareableFileReference;
54 }
55
56 namespace content { 52 namespace content {
57 class AppCacheService; 53 class AppCacheService;
58 class AsyncRevalidationManager; 54 class AsyncRevalidationManager;
55 class DownloadedTempFileImpl;
59 class LoaderDelegate; 56 class LoaderDelegate;
60 class NavigationURLLoaderImplCore; 57 class NavigationURLLoaderImplCore;
61 class NavigationUIData; 58 class NavigationUIData;
62 class RenderFrameHostImpl; 59 class RenderFrameHostImpl;
63 class ResourceContext; 60 class ResourceContext;
64 class ResourceDispatcherHostDelegate; 61 class ResourceDispatcherHostDelegate;
65 class ResourceLoader; 62 class ResourceLoader;
66 class ResourceHandler; 63 class ResourceHandler;
67 class ResourceMessageDelegate; 64 class ResourceMessageDelegate;
68 class ResourceMessageFilter; 65 class ResourceMessageFilter;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 203
207 // Cancels any blocked request for the specified route id. 204 // Cancels any blocked request for the specified route id.
208 void CancelBlockedRequestsForRoute( 205 void CancelBlockedRequestsForRoute(
209 const GlobalFrameRoutingId& global_routing_id); 206 const GlobalFrameRoutingId& global_routing_id);
210 207
211 // Maintains a collection of temp files created in support of 208 // Maintains a collection of temp files created in support of
212 // the download_to_file capability. Used to grant access to the 209 // the download_to_file capability. Used to grant access to the
213 // child process and to defer deletion of the file until it's 210 // child process and to defer deletion of the file until it's
214 // no longer needed. 211 // no longer needed.
215 void RegisterDownloadedTempFile( 212 void RegisterDownloadedTempFile(
216 int child_id, int request_id, 213 std::unique_ptr<DownloadedTempFileImpl> downloaded_temp_file);
217 const base::FilePath& file_path);
218 void UnregisterDownloadedTempFile(int child_id, int request_id); 214 void UnregisterDownloadedTempFile(int child_id, int request_id);
219 215
220 // Needed for the sync IPC message dispatcher macros. 216 // Needed for the sync IPC message dispatcher macros.
221 bool Send(IPC::Message* message); 217 bool Send(IPC::Message* message);
222 218
223 // Indicates whether third-party sub-content can pop-up HTTP basic auth 219 // Indicates whether third-party sub-content can pop-up HTTP basic auth
224 // dialog boxes. 220 // dialog boxes.
225 bool allow_cross_origin_auth_prompt(); 221 bool allow_cross_origin_auth_prompt();
226 222
227 ResourceDispatcherHostDelegate* delegate() { 223 ResourceDispatcherHostDelegate* delegate() {
(...skipping 451 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