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

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

Issue 2062263002: Remove debugging code for fixed bugs. Also clean up unused includes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge again Created 4 years, 6 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
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
11 11
12 #ifndef CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ 12 #ifndef CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_
13 #define CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ 13 #define CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_
14 14
15 #include <stdint.h> 15 #include <stdint.h>
16 16
17 #include <map> 17 #include <map>
18 #include <memory> 18 #include <memory>
19 #include <set>
20 #include <string> 19 #include <string>
21 #include <vector> 20 #include <vector>
22 21
23 #include "base/gtest_prod_util.h" 22 #include "base/gtest_prod_util.h"
24 #include "base/macros.h" 23 #include "base/macros.h"
25 #include "base/observer_list.h" 24 #include "base/observer_list.h"
26 #include "base/time/time.h" 25 #include "base/time/time.h"
27 #include "base/timer/timer.h" 26 #include "base/timer/timer.h"
28 #include "content/browser/download/download_resource_handler.h" 27 #include "content/browser/download/download_resource_handler.h"
29 #include "content/browser/download/save_types.h" 28 #include "content/browser/download/save_types.h"
30 #include "content/browser/loader/global_routing_id.h" 29 #include "content/browser/loader/global_routing_id.h"
31 #include "content/browser/loader/resource_loader.h" 30 #include "content/browser/loader/resource_loader.h"
32 #include "content/browser/loader/resource_loader_delegate.h" 31 #include "content/browser/loader/resource_loader_delegate.h"
33 #include "content/browser/loader/resource_scheduler.h" 32 #include "content/browser/loader/resource_scheduler.h"
34 #include "content/common/content_export.h" 33 #include "content/common/content_export.h"
35 #include "content/common/resource_request_body.h" 34 #include "content/common/resource_request_body.h"
36 #include "content/public/browser/child_process_data.h"
37 #include "content/public/browser/download_item.h"
38 #include "content/public/browser/download_url_parameters.h"
39 #include "content/public/browser/global_request_id.h" 35 #include "content/public/browser/global_request_id.h"
40 #include "content/public/browser/notification_types.h" 36 #include "content/public/browser/notification_types.h"
41 #include "content/public/browser/resource_dispatcher_host.h" 37 #include "content/public/browser/resource_dispatcher_host.h"
42 #include "content/public/browser/web_contents_observer.h" 38 #include "content/public/browser/web_contents_observer.h"
43 #include "content/public/common/resource_type.h" 39 #include "content/public/common/resource_type.h"
44 #include "ipc/ipc_message.h" 40 #include "ipc/ipc_message.h"
45 #include "net/base/request_priority.h" 41 #include "net/base/request_priority.h"
46 #include "net/cookies/canonical_cookie.h" 42 #include "net/cookies/canonical_cookie.h"
47 #include "net/url_request/url_request.h" 43 #include "net/url_request/url_request.h"
48 44
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 124
129 // ResourceDispatcherHost implementation: 125 // ResourceDispatcherHost implementation:
130 void SetDelegate(ResourceDispatcherHostDelegate* delegate) override; 126 void SetDelegate(ResourceDispatcherHostDelegate* delegate) override;
131 void SetAllowCrossOriginAuthPrompt(bool value) override; 127 void SetAllowCrossOriginAuthPrompt(bool value) override;
132 void ClearLoginDelegateForRequest(net::URLRequest* request) override; 128 void ClearLoginDelegateForRequest(net::URLRequest* request) override;
133 129
134 // Puts the resource dispatcher host in an inactive state (unable to begin 130 // Puts the resource dispatcher host in an inactive state (unable to begin
135 // new requests). Cancels all pending requests. 131 // new requests). Cancels all pending requests.
136 void Shutdown(); 132 void Shutdown();
137 133
138 // Notify the ResourceDispatcherHostImpl of a new resource context.
139 void AddResourceContext(ResourceContext* context);
140
141 // Notify the ResourceDispatcherHostImpl of a resource context destruction.
142 void RemoveResourceContext(ResourceContext* context);
143
144 // Force cancels any pending requests for the given |context|. This is 134 // Force cancels any pending requests for the given |context|. This is
145 // necessary to ensure that before |context| goes away, all requests 135 // necessary to ensure that before |context| goes away, all requests
146 // for it are dead. 136 // for it are dead.
147 void CancelRequestsForContext(ResourceContext* context); 137 void CancelRequestsForContext(ResourceContext* context);
148 138
149 // Returns true if the message was a resource message that was processed. 139 // Returns true if the message was a resource message that was processed.
150 bool OnMessageReceived(const IPC::Message& message, 140 bool OnMessageReceived(const IPC::Message& message,
151 ResourceMessageFilter* filter); 141 ResourceMessageFilter* filter);
152 142
153 DownloadInterruptReason BeginDownload( 143 DownloadInterruptReason BeginDownload(
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 // Indicates whether third-party sub-content can pop-up HTTP basic auth 251 // Indicates whether third-party sub-content can pop-up HTTP basic auth
262 // dialog boxes. 252 // dialog boxes.
263 bool allow_cross_origin_auth_prompt(); 253 bool allow_cross_origin_auth_prompt();
264 254
265 ResourceDispatcherHostDelegate* delegate() { 255 ResourceDispatcherHostDelegate* delegate() {
266 return delegate_; 256 return delegate_;
267 } 257 }
268 258
269 // Must be called after the ResourceRequestInfo has been created 259 // Must be called after the ResourceRequestInfo has been created
270 // and associated with the request. 260 // and associated with the request.
271 // |id| should be |content::DownloadItem::kInvalidId| to request automatic 261 // This is marked virtual so it can be overriden in testing.
272 // assignment. This is marked virtual so it can be overriden in testing.
273 virtual std::unique_ptr<ResourceHandler> CreateResourceHandlerForDownload( 262 virtual std::unique_ptr<ResourceHandler> CreateResourceHandlerForDownload(
274 net::URLRequest* request, 263 net::URLRequest* request,
275 bool is_content_initiated, 264 bool is_content_initiated,
276 bool must_download); 265 bool must_download);
277 266
278 // Called to determine whether the response to |request| should be intercepted 267 // Called to determine whether the response to |request| should be intercepted
279 // and handled as a stream. Streams are used to pass direct access to a 268 // and handled as a stream. Streams are used to pass direct access to a
280 // resource response to another application (e.g. a web page) without being 269 // resource response to another application (e.g. a web page) without being
281 // handled by the browser itself. If the request should be intercepted as a 270 // handled by the browser itself. If the request should be intercepted as a
282 // stream, a StreamResourceHandler is returned which provides access to the 271 // stream, a StreamResourceHandler is returned which provides access to the
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 ResourceMessageFilter* filter_; 631 ResourceMessageFilter* filter_;
643 632
644 ResourceDispatcherHostDelegate* delegate_; 633 ResourceDispatcherHostDelegate* delegate_;
645 634
646 bool allow_cross_origin_auth_prompt_; 635 bool allow_cross_origin_auth_prompt_;
647 636
648 // AsyncRevalidationManager is non-NULL if and only if 637 // AsyncRevalidationManager is non-NULL if and only if
649 // stale-while-revalidate is enabled. 638 // stale-while-revalidate is enabled.
650 std::unique_ptr<AsyncRevalidationManager> async_revalidation_manager_; 639 std::unique_ptr<AsyncRevalidationManager> async_revalidation_manager_;
651 640
652 // http://crbug.com/90971 - Assists in tracking down use-after-frees on
653 // shutdown.
654 std::set<const ResourceContext*> active_resource_contexts_;
655
656 typedef std::map<GlobalRequestID, 641 typedef std::map<GlobalRequestID,
657 base::ObserverList<ResourceMessageDelegate>*> DelegateMap; 642 base::ObserverList<ResourceMessageDelegate>*> DelegateMap;
658 DelegateMap delegate_map_; 643 DelegateMap delegate_map_;
659 644
660 std::unique_ptr<ResourceScheduler> scheduler_; 645 std::unique_ptr<ResourceScheduler> scheduler_;
661 646
662 // Allows tests to use a mock CertStore. If set, the CertStore must 647 // Allows tests to use a mock CertStore. If set, the CertStore must
663 // outlive this ResourceDispatcherHostImpl. 648 // outlive this ResourceDispatcherHostImpl.
664 CertStore* cert_store_for_testing_; 649 CertStore* cert_store_for_testing_;
665 650
666 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); 651 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl);
667 }; 652 };
668 653
669 } // namespace content 654 } // namespace content
670 655
671 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ 656 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/loader/async_resource_handler.cc ('k') | content/browser/loader/resource_dispatcher_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698