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 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 class ResourceContext; | 55 class ResourceContext; |
56 class ResourceDispatcherHostDelegate; | 56 class ResourceDispatcherHostDelegate; |
57 class ResourceMessageFilter; | 57 class ResourceMessageFilter; |
58 class ResourceRequestInfoImpl; | 58 class ResourceRequestInfoImpl; |
59 struct DownloadSaveInfo; | 59 struct DownloadSaveInfo; |
60 struct GlobalRequestID; | 60 struct GlobalRequestID; |
61 struct Referrer; | 61 struct Referrer; |
62 | 62 |
63 class CONTENT_EXPORT ResourceDispatcherHostImpl | 63 class CONTENT_EXPORT ResourceDispatcherHostImpl |
64 : public ResourceDispatcherHost, | 64 : public ResourceDispatcherHost, |
65 public ResourceLoaderDelegate, | 65 public ResourceLoaderDelegate { |
66 public base::SupportsWeakPtr<ResourceDispatcherHostImpl> { | |
67 public: | 66 public: |
68 ResourceDispatcherHostImpl(); | 67 ResourceDispatcherHostImpl(); |
69 virtual ~ResourceDispatcherHostImpl(); | 68 virtual ~ResourceDispatcherHostImpl(); |
70 | 69 |
71 // Returns the current ResourceDispatcherHostImpl. May return NULL if it | 70 // Returns the current ResourceDispatcherHostImpl. May return NULL if it |
72 // hasn't been created yet. | 71 // hasn't been created yet. |
73 static ResourceDispatcherHostImpl* Get(); | 72 static ResourceDispatcherHostImpl* Get(); |
74 | 73 |
75 // ResourceDispatcherHost implementation: | 74 // ResourceDispatcherHost implementation: |
76 virtual void SetDelegate(ResourceDispatcherHostDelegate* delegate) OVERRIDE; | 75 virtual void SetDelegate(ResourceDispatcherHostDelegate* delegate) OVERRIDE; |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 void ProcessBlockedRequestsForRoute(int child_id, | 292 void ProcessBlockedRequestsForRoute(int child_id, |
294 int route_id, | 293 int route_id, |
295 bool cancel_requests); | 294 bool cancel_requests); |
296 | 295 |
297 void OnRequestResource(const IPC::Message& msg, | 296 void OnRequestResource(const IPC::Message& msg, |
298 int request_id, | 297 int request_id, |
299 const ResourceHostMsg_Request& request_data); | 298 const ResourceHostMsg_Request& request_data); |
300 void OnSyncLoad(int request_id, | 299 void OnSyncLoad(int request_id, |
301 const ResourceHostMsg_Request& request_data, | 300 const ResourceHostMsg_Request& request_data, |
302 IPC::Message* sync_result); | 301 IPC::Message* sync_result); |
303 void BeginRequest(int request_id, | 302 // If request_data comes with upload data, gets the content length and passes |
| 303 // it to BeginRequest(). Otherwise, calls BeginRequest() directly. |
| 304 void PrepareToBeginRequest( |
| 305 int request_id, |
| 306 const ResourceHostMsg_Request& request_data, |
| 307 IPC::Message* sync_result, |
| 308 int route_id); |
| 309 void BeginRequest(scoped_refptr<ResourceMessageFilter> filter, |
| 310 int request_id, |
304 const ResourceHostMsg_Request& request_data, | 311 const ResourceHostMsg_Request& request_data, |
305 IPC::Message* sync_result, // only valid for sync | 312 IPC::Message* sync_result, // only valid for sync |
306 int route_id); // only valid for async | 313 int route_id, // only valid for async |
| 314 uint64 upload_size); |
307 void OnDataReceivedACK(int request_id); | 315 void OnDataReceivedACK(int request_id); |
308 void OnDataDownloadedACK(int request_id); | 316 void OnDataDownloadedACK(int request_id); |
309 void OnUploadProgressACK(int request_id); | 317 void OnUploadProgressACK(int request_id); |
310 void OnCancelRequest(int request_id); | 318 void OnCancelRequest(int request_id); |
311 void OnFollowRedirect(int request_id, | 319 void OnFollowRedirect(int request_id, |
312 bool has_new_first_party_for_cookies, | 320 bool has_new_first_party_for_cookies, |
313 const GURL& new_first_party_for_cookies); | 321 const GURL& new_first_party_for_cookies); |
314 void OnReleaseDownloadedFile(int request_id); | 322 void OnReleaseDownloadedFile(int request_id); |
315 | 323 |
316 // Creates ResourceRequestInfoImpl for a download or page save. | 324 // Creates ResourceRequestInfoImpl for a download or page save. |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 ResourceMessageFilter* filter_; | 413 ResourceMessageFilter* filter_; |
406 | 414 |
407 ResourceDispatcherHostDelegate* delegate_; | 415 ResourceDispatcherHostDelegate* delegate_; |
408 | 416 |
409 bool allow_cross_origin_auth_prompt_; | 417 bool allow_cross_origin_auth_prompt_; |
410 | 418 |
411 // http://crbug.com/90971 - Assists in tracking down use-after-frees on | 419 // http://crbug.com/90971 - Assists in tracking down use-after-frees on |
412 // shutdown. | 420 // shutdown. |
413 std::set<const ResourceContext*> active_resource_contexts_; | 421 std::set<const ResourceContext*> active_resource_contexts_; |
414 | 422 |
| 423 // WeakPtrFactory to be used on IO thread. |
| 424 base::WeakPtrFactory<ResourceDispatcherHostImpl> weak_ptr_factory_; |
| 425 |
415 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); | 426 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); |
416 }; | 427 }; |
417 | 428 |
418 } // namespace content | 429 } // namespace content |
419 | 430 |
420 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_IMPL_H_ | 431 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_IMPL_H_ |
OLD | NEW |