| 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> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 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/url_loader.mojom.h" | 25 #include "content/common/url_loader.mojom.h" |
| 26 #include "content/public/common/resource_type.h" | 26 #include "content/public/common/resource_type.h" |
| 27 #include "ipc/ipc_listener.h" | 27 #include "ipc/ipc_listener.h" |
| 28 #include "ipc/ipc_sender.h" | 28 #include "ipc/ipc_sender.h" |
| 29 #include "net/base/request_priority.h" | 29 #include "net/base/request_priority.h" |
| 30 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 30 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
| 31 #include "url/gurl.h" | 31 #include "url/gurl.h" |
| 32 | 32 |
| 33 namespace mojo { |
| 34 class AssociatedGroup; |
| 35 } // namespace mojo |
| 36 |
| 33 namespace net { | 37 namespace net { |
| 34 struct RedirectInfo; | 38 struct RedirectInfo; |
| 35 } | 39 } |
| 36 | 40 |
| 37 namespace content { | 41 namespace content { |
| 38 class RequestPeer; | 42 class RequestPeer; |
| 39 class ResourceDispatcherDelegate; | 43 class ResourceDispatcherDelegate; |
| 40 class ResourceRequestBodyImpl; | 44 class ResourceRequestBodyImpl; |
| 41 class ResourceSchedulingFilter; | 45 class ResourceSchedulingFilter; |
| 42 struct ResourceResponseInfo; | 46 struct ResourceResponseInfo; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 // | 95 // |
| 92 // You can pass an optional argument |loading_task_runner| to specify task | 96 // You can pass an optional argument |loading_task_runner| to specify task |
| 93 // queue to execute loading tasks on. | 97 // queue to execute loading tasks on. |
| 94 virtual int StartAsync( | 98 virtual int StartAsync( |
| 95 std::unique_ptr<ResourceRequest> request, | 99 std::unique_ptr<ResourceRequest> request, |
| 96 int routing_id, | 100 int routing_id, |
| 97 scoped_refptr<base::SingleThreadTaskRunner> loading_task_runner, | 101 scoped_refptr<base::SingleThreadTaskRunner> loading_task_runner, |
| 98 const GURL& frame_origin, | 102 const GURL& frame_origin, |
| 99 std::unique_ptr<RequestPeer> peer, | 103 std::unique_ptr<RequestPeer> peer, |
| 100 blink::WebURLRequest::LoadingIPCType ipc_type, | 104 blink::WebURLRequest::LoadingIPCType ipc_type, |
| 101 mojom::URLLoaderFactory* url_loader_factory); | 105 mojom::URLLoaderFactory* url_loader_factory, |
| 106 mojo::AssociatedGroup* associated_group); |
| 102 | 107 |
| 103 // Removes a request from the |pending_requests_| list, returning true if the | 108 // Removes a request from the |pending_requests_| list, returning true if the |
| 104 // request was found and removed. | 109 // request was found and removed. |
| 105 bool RemovePendingRequest(int request_id); | 110 bool RemovePendingRequest(int request_id); |
| 106 | 111 |
| 107 // Cancels a request in the |pending_requests_| list. The request will be | 112 // Cancels a request in the |pending_requests_| list. The request will be |
| 108 // removed from the dispatcher as well. | 113 // removed from the dispatcher as well. |
| 109 virtual void Cancel(int request_id); | 114 virtual void Cancel(int request_id); |
| 110 | 115 |
| 111 // Toggles the is_deferred attribute for the specified request. | 116 // Toggles the is_deferred attribute for the specified request. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 std::unique_ptr<IPC::Message> pending_redirect_message; | 179 std::unique_ptr<IPC::Message> pending_redirect_message; |
| 175 base::TimeTicks request_start; | 180 base::TimeTicks request_start; |
| 176 base::TimeTicks response_start; | 181 base::TimeTicks response_start; |
| 177 base::TimeTicks completion_time; | 182 base::TimeTicks completion_time; |
| 178 linked_ptr<base::SharedMemory> buffer; | 183 linked_ptr<base::SharedMemory> buffer; |
| 179 scoped_refptr<SharedMemoryReceivedDataFactory> received_data_factory; | 184 scoped_refptr<SharedMemoryReceivedDataFactory> received_data_factory; |
| 180 std::unique_ptr<SiteIsolationResponseMetaData> site_isolation_metadata; | 185 std::unique_ptr<SiteIsolationResponseMetaData> site_isolation_metadata; |
| 181 int buffer_size; | 186 int buffer_size; |
| 182 | 187 |
| 183 // For mojo loading. | 188 // For mojo loading. |
| 184 mojom::URLLoaderPtr url_loader; | 189 mojom::URLLoaderAssociatedPtr url_loader; |
| 185 std::unique_ptr<mojom::URLLoaderClient> url_loader_client; | 190 std::unique_ptr<mojom::URLLoaderClient> url_loader_client; |
| 186 }; | 191 }; |
| 187 using PendingRequestMap = std::map<int, std::unique_ptr<PendingRequestInfo>>; | 192 using PendingRequestMap = std::map<int, std::unique_ptr<PendingRequestInfo>>; |
| 188 | 193 |
| 189 // Helper to lookup the info based on the request_id. | 194 // Helper to lookup the info based on the request_id. |
| 190 // May return NULL if the request as been canceled from the client side. | 195 // May return NULL if the request as been canceled from the client side. |
| 191 PendingRequestInfo* GetPendingRequestInfo(int request_id); | 196 PendingRequestInfo* GetPendingRequestInfo(int request_id); |
| 192 | 197 |
| 193 // Follows redirect, if any, for the given request. | 198 // Follows redirect, if any, for the given request. |
| 194 void FollowPendingRedirect(int request_id, PendingRequestInfo* request_info); | 199 void FollowPendingRedirect(int request_id, PendingRequestInfo* request_info); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter_; | 276 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter_; |
| 272 | 277 |
| 273 base::WeakPtrFactory<ResourceDispatcher> weak_factory_; | 278 base::WeakPtrFactory<ResourceDispatcher> weak_factory_; |
| 274 | 279 |
| 275 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher); | 280 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher); |
| 276 }; | 281 }; |
| 277 | 282 |
| 278 } // namespace content | 283 } // namespace content |
| 279 | 284 |
| 280 #endif // CONTENT_CHILD_RESOURCE_DISPATCHER_H_ | 285 #endif // CONTENT_CHILD_RESOURCE_DISPATCHER_H_ |
| OLD | NEW |