| 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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading | 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading |
| 6 | 6 |
| 7 #ifndef CONTENT_CHILD_RESOURCE_DISPATCHER_H_ | 7 #ifndef CONTENT_CHILD_RESOURCE_DISPATCHER_H_ |
| 8 #define CONTENT_CHILD_RESOURCE_DISPATCHER_H_ | 8 #define CONTENT_CHILD_RESOURCE_DISPATCHER_H_ |
| 9 | 9 |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| 11 | 11 |
| 12 #include <deque> | 12 #include <deque> |
| 13 #include <map> | 13 #include <map> |
| 14 #include <memory> | 14 #include <memory> |
| 15 #include <string> | 15 #include <string> |
| 16 | 16 |
| 17 #include "base/containers/hash_tables.h" | 17 #include "base/containers/hash_tables.h" |
| 18 #include "base/macros.h" | 18 #include "base/macros.h" |
| 19 #include "base/memory/linked_ptr.h" | 19 #include "base/memory/linked_ptr.h" |
| 20 #include "base/memory/shared_memory.h" | 20 #include "base/memory/shared_memory.h" |
| 21 #include "base/memory/weak_ptr.h" | 21 #include "base/memory/weak_ptr.h" |
| 22 #include "base/single_thread_task_runner.h" | 22 #include "base/single_thread_task_runner.h" |
| 23 #include "base/time/time.h" | 23 #include "base/time/time.h" |
| 24 #include "content/common/content_export.h" | 24 #include "content/common/content_export.h" |
| 25 #include "content/common/resource_priority_change_info.h" |
| 25 #include "content/common/url_loader.mojom.h" | 26 #include "content/common/url_loader.mojom.h" |
| 26 #include "content/public/common/resource_type.h" | 27 #include "content/public/common/resource_type.h" |
| 27 #include "ipc/ipc_listener.h" | 28 #include "ipc/ipc_listener.h" |
| 28 #include "ipc/ipc_sender.h" | 29 #include "ipc/ipc_sender.h" |
| 29 #include "net/base/request_priority.h" | 30 #include "net/base/request_priority.h" |
| 30 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 31 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
| 31 #include "url/gurl.h" | 32 #include "url/gurl.h" |
| 32 | 33 |
| 33 namespace mojo { | 34 namespace mojo { |
| 34 class AssociatedGroup; | 35 class AssociatedGroup; |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 // For mojo loading. | 193 // For mojo loading. |
| 193 mojom::URLLoaderAssociatedPtr url_loader; | 194 mojom::URLLoaderAssociatedPtr url_loader; |
| 194 std::unique_ptr<mojom::URLLoaderClient> url_loader_client; | 195 std::unique_ptr<mojom::URLLoaderClient> url_loader_client; |
| 195 }; | 196 }; |
| 196 using PendingRequestMap = std::map<int, std::unique_ptr<PendingRequestInfo>>; | 197 using PendingRequestMap = std::map<int, std::unique_ptr<PendingRequestInfo>>; |
| 197 | 198 |
| 198 // Helper to lookup the info based on the request_id. | 199 // Helper to lookup the info based on the request_id. |
| 199 // May return NULL if the request as been canceled from the client side. | 200 // May return NULL if the request as been canceled from the client side. |
| 200 PendingRequestInfo* GetPendingRequestInfo(int request_id); | 201 PendingRequestInfo* GetPendingRequestInfo(int request_id); |
| 201 | 202 |
| 203 // Priority change requests often come in batches, so store them in a |
| 204 // queue and send them as a batch. |
| 205 std::vector<ResourcePriorityChangeInfo> queued_priority_requests; |
| 206 |
| 207 void DispatchPendingPriorityRequests(); |
| 208 |
| 202 // Follows redirect, if any, for the given request. | 209 // Follows redirect, if any, for the given request. |
| 203 void FollowPendingRedirect(int request_id, PendingRequestInfo* request_info); | 210 void FollowPendingRedirect(int request_id, PendingRequestInfo* request_info); |
| 204 | 211 |
| 205 // Message response handlers, called by the message handler for this process. | 212 // Message response handlers, called by the message handler for this process. |
| 206 void OnUploadProgress(int request_id, int64_t position, int64_t size); | 213 void OnUploadProgress(int request_id, int64_t position, int64_t size); |
| 207 void OnReceivedResponse(int request_id, const ResourceResponseHead&); | 214 void OnReceivedResponse(int request_id, const ResourceResponseHead&); |
| 208 void OnReceivedCachedMetadata(int request_id, const std::vector<char>& data); | 215 void OnReceivedCachedMetadata(int request_id, const std::vector<char>& data); |
| 209 void OnReceivedRedirect(int request_id, | 216 void OnReceivedRedirect(int request_id, |
| 210 const net::RedirectInfo& redirect_info, | 217 const net::RedirectInfo& redirect_info, |
| 211 const ResourceResponseHead& response_head); | 218 const ResourceResponseHead& response_head); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter_; | 285 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter_; |
| 279 | 286 |
| 280 base::WeakPtrFactory<ResourceDispatcher> weak_factory_; | 287 base::WeakPtrFactory<ResourceDispatcher> weak_factory_; |
| 281 | 288 |
| 282 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher); | 289 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher); |
| 283 }; | 290 }; |
| 284 | 291 |
| 285 } // namespace content | 292 } // namespace content |
| 286 | 293 |
| 287 #endif // CONTENT_CHILD_RESOURCE_DISPATCHER_H_ | 294 #endif // CONTENT_CHILD_RESOURCE_DISPATCHER_H_ |
| OLD | NEW |