OLD | NEW |
---|---|
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_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_ | 12 #ifndef CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_ |
13 #define CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_ | 13 #define CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_ |
14 #pragma once | 14 #pragma once |
15 | 15 |
16 #include <map> | 16 #include <map> |
17 #include <string> | 17 #include <string> |
18 #include <vector> | 18 #include <vector> |
19 | 19 |
20 #include "base/basictypes.h" | 20 #include "base/basictypes.h" |
21 #include "base/gtest_prod_util.h" | 21 #include "base/gtest_prod_util.h" |
22 #include "base/memory/scoped_ptr.h" | 22 #include "base/memory/scoped_ptr.h" |
23 #include "base/memory/weak_ptr.h" | 23 #include "base/memory/weak_ptr.h" |
24 #include "base/time.h" | 24 #include "base/time.h" |
25 #include "base/timer.h" | 25 #include "base/timer.h" |
26 #include "content/browser/download/download_resource_handler.h" | 26 #include "content/browser/download/download_resource_handler.h" |
27 #include "content/browser/ssl/ssl_error_handler.h" | |
27 #include "content/common/content_export.h" | 28 #include "content/common/content_export.h" |
28 #include "content/public/browser/child_process_data.h" | 29 #include "content/public/browser/child_process_data.h" |
29 #include "content/public/browser/notification_types.h" | 30 #include "content/public/browser/notification_types.h" |
30 #include "ipc/ipc_message.h" | 31 #include "ipc/ipc_message.h" |
31 #include "net/url_request/url_request.h" | 32 #include "net/url_request/url_request.h" |
32 #include "webkit/glue/resource_type.h" | 33 #include "webkit/glue/resource_type.h" |
33 | 34 |
34 class DownloadFileManager; | 35 class DownloadFileManager; |
35 class ResourceDispatcherHostRequestInfo; | 36 class ResourceDispatcherHostRequestInfo; |
36 class ResourceHandler; | 37 class ResourceHandler; |
(...skipping 12 matching lines...) Expand all Loading... | |
49 | 50 |
50 namespace net { | 51 namespace net { |
51 class CookieList; | 52 class CookieList; |
52 class URLRequestJobFactory; | 53 class URLRequestJobFactory; |
53 } // namespace net | 54 } // namespace net |
54 | 55 |
55 namespace webkit_blob { | 56 namespace webkit_blob { |
56 class DeletableFileReference; | 57 class DeletableFileReference; |
57 } | 58 } |
58 | 59 |
59 class CONTENT_EXPORT ResourceDispatcherHost : public net::URLRequest::Delegate { | 60 class CONTENT_EXPORT ResourceDispatcherHost |
61 : public net::URLRequest::Delegate, | |
62 public SSLErrorHandler::Delegate { | |
60 public: | 63 public: |
61 ResourceDispatcherHost(); | 64 ResourceDispatcherHost(); |
62 virtual ~ResourceDispatcherHost(); | 65 virtual ~ResourceDispatcherHost(); |
63 | 66 |
64 // Returns the current ResourceDispatcherHost. May return NULL if it hasn't | 67 // Returns the current ResourceDispatcherHost. May return NULL if it hasn't |
65 // been created yet. | 68 // been created yet. |
66 static ResourceDispatcherHost* Get(); | 69 static ResourceDispatcherHost* Get(); |
67 | 70 |
68 // Puts the resource dispatcher host in an inactive state (unable to begin | 71 // Puts the resource dispatcher host in an inactive state (unable to begin |
69 // new requests). Cancels all pending requests. | 72 // new requests). Cancels all pending requests. |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
165 | 168 |
166 // Force cancels any pending requests for the given route id. This method | 169 // Force cancels any pending requests for the given route id. This method |
167 // acts like CancelRequestsForProcess when route_id is -1. | 170 // acts like CancelRequestsForProcess when route_id is -1. |
168 void CancelRequestsForRoute(int child_id, int route_id); | 171 void CancelRequestsForRoute(int child_id, int route_id); |
169 | 172 |
170 // Force cancels any pending requests for the given |context|. This is | 173 // Force cancels any pending requests for the given |context|. This is |
171 // necessary to ensure that before |context| goes away, all requests | 174 // necessary to ensure that before |context| goes away, all requests |
172 // for it are dead. | 175 // for it are dead. |
173 void CancelRequestsForContext(content::ResourceContext* context); | 176 void CancelRequestsForContext(content::ResourceContext* context); |
174 | 177 |
175 // net::URLRequest::Delegate | 178 // net::URLRequest::Delegate: |
176 virtual void OnReceivedRedirect(net::URLRequest* request, | 179 virtual void OnReceivedRedirect(net::URLRequest* request, |
177 const GURL& new_url, | 180 const GURL& new_url, |
178 bool* defer_redirect) OVERRIDE; | 181 bool* defer_redirect) OVERRIDE; |
179 virtual void OnAuthRequired(net::URLRequest* request, | 182 virtual void OnAuthRequired(net::URLRequest* request, |
180 net::AuthChallengeInfo* auth_info) OVERRIDE; | 183 net::AuthChallengeInfo* auth_info) OVERRIDE; |
181 virtual void OnCertificateRequested( | 184 virtual void OnCertificateRequested( |
182 net::URLRequest* request, | 185 net::URLRequest* request, |
183 net::SSLCertRequestInfo* cert_request_info) OVERRIDE; | 186 net::SSLCertRequestInfo* cert_request_info) OVERRIDE; |
184 virtual void OnSSLCertificateError(net::URLRequest* request, | 187 virtual void OnSSLCertificateError(net::URLRequest* request, |
185 const net::SSLInfo& ssl_info, | 188 const net::SSLInfo& ssl_info, |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
272 | 275 |
273 scoped_refptr<ResourceHandler> CreateResourceHandlerForDownload( | 276 scoped_refptr<ResourceHandler> CreateResourceHandlerForDownload( |
274 net::URLRequest* request, | 277 net::URLRequest* request, |
275 content::ResourceContext* context, | 278 content::ResourceContext* context, |
276 int child_id, | 279 int child_id, |
277 int route_id, | 280 int route_id, |
278 int request_id, | 281 int request_id, |
279 const DownloadSaveInfo& save_info, | 282 const DownloadSaveInfo& save_info, |
280 const DownloadResourceHandler::OnStartedCallback& started_cb); | 283 const DownloadResourceHandler::OnStartedCallback& started_cb); |
281 | 284 |
285 // SSLErrorHandler::Delegate: | |
darin (slow to review)
2012/03/09 20:49:03
it seems like it would be better to move these fun
Takashi Toyoshima
2012/03/10 00:24:44
I see.
Also I remove their implementation just bef
| |
286 virtual void CancelSSLRequest(const content::GlobalRequestID& id, | |
287 int error, | |
288 const net::SSLInfo* ssl_info) OVERRIDE; | |
289 virtual void ContinueSSLRequest(const content::GlobalRequestID& id) OVERRIDE; | |
290 | |
282 private: | 291 private: |
283 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, | 292 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, |
284 TestBlockedRequestsProcessDies); | 293 TestBlockedRequestsProcessDies); |
285 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, | 294 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, |
286 IncrementOutstandingRequestsMemoryCost); | 295 IncrementOutstandingRequestsMemoryCost); |
287 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, | 296 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, |
288 CalculateApproximateMemoryCost); | 297 CalculateApproximateMemoryCost); |
289 | 298 |
290 class ShutdownTask; | 299 class ShutdownTask; |
291 | 300 |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
523 // Maps the request ID of request that is being transferred to a new RVH | 532 // Maps the request ID of request that is being transferred to a new RVH |
524 // to the respective request. | 533 // to the respective request. |
525 typedef std::map<content::GlobalRequestID, net::URLRequest*> | 534 typedef std::map<content::GlobalRequestID, net::URLRequest*> |
526 TransferredNavigations; | 535 TransferredNavigations; |
527 TransferredNavigations transferred_navigations_; | 536 TransferredNavigations transferred_navigations_; |
528 | 537 |
529 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHost); | 538 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHost); |
530 }; | 539 }; |
531 | 540 |
532 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_ | 541 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_ |
OLD | NEW |