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/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 "mojo/public/cpp/system/data_pipe.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 #include "url/origin.h" | 33 #include "url/origin.h" |
33 | 34 |
34 namespace net { | 35 namespace net { |
35 struct RedirectInfo; | 36 struct RedirectInfo; |
36 } | 37 } |
37 | 38 |
38 namespace content { | 39 namespace content { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // | 92 // |
92 // You can pass an optional argument |loading_task_runner| to specify task | 93 // You can pass an optional argument |loading_task_runner| to specify task |
93 // queue to execute loading tasks on. | 94 // queue to execute loading tasks on. |
94 virtual int StartAsync( | 95 virtual int StartAsync( |
95 std::unique_ptr<ResourceRequest> request, | 96 std::unique_ptr<ResourceRequest> request, |
96 int routing_id, | 97 int routing_id, |
97 scoped_refptr<base::SingleThreadTaskRunner> loading_task_runner, | 98 scoped_refptr<base::SingleThreadTaskRunner> loading_task_runner, |
98 const url::Origin& frame_origin, | 99 const url::Origin& frame_origin, |
99 std::unique_ptr<RequestPeer> peer, | 100 std::unique_ptr<RequestPeer> peer, |
100 blink::WebURLRequest::LoadingIPCType ipc_type, | 101 blink::WebURLRequest::LoadingIPCType ipc_type, |
101 mojom::URLLoaderFactory* url_loader_factory); | 102 mojom::URLLoaderFactory* url_loader_factory, |
| 103 mojo::ScopedDataPipeConsumerHandle consumer_handle); |
102 | 104 |
103 // Removes a request from the |pending_requests_| list, returning true if the | 105 // Removes a request from the |pending_requests_| list, returning true if the |
104 // request was found and removed. | 106 // request was found and removed. |
105 bool RemovePendingRequest(int request_id); | 107 bool RemovePendingRequest(int request_id); |
106 | 108 |
107 // Cancels a request in the |pending_requests_| list. The request will be | 109 // Cancels a request in the |pending_requests_| list. The request will be |
108 // removed from the dispatcher as well. | 110 // removed from the dispatcher as well. |
109 virtual void Cancel(int request_id); | 111 virtual void Cancel(int request_id); |
110 | 112 |
111 // Toggles the is_deferred attribute for the specified request. | 113 // Toggles the is_deferred attribute for the specified request. |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 | 235 |
234 base::TimeTicks ToRendererCompletionTime( | 236 base::TimeTicks ToRendererCompletionTime( |
235 const PendingRequestInfo& request_info, | 237 const PendingRequestInfo& request_info, |
236 const base::TimeTicks& browser_completion_time) const; | 238 const base::TimeTicks& browser_completion_time) const; |
237 | 239 |
238 // Returns timestamp provided by IO thread. If no timestamp is supplied, | 240 // Returns timestamp provided by IO thread. If no timestamp is supplied, |
239 // then current time is returned. Saved timestamp is reset, so following | 241 // then current time is returned. Saved timestamp is reset, so following |
240 // invocations will return current time until set_io_timestamp is called. | 242 // invocations will return current time until set_io_timestamp is called. |
241 base::TimeTicks ConsumeIOTimestamp(); | 243 base::TimeTicks ConsumeIOTimestamp(); |
242 | 244 |
| 245 void ContinueForNavigation( |
| 246 int request_id, |
| 247 mojo::ScopedDataPipeConsumerHandle consumer_handle); |
| 248 |
243 // Returns true if the message passed in is a resource related message. | 249 // Returns true if the message passed in is a resource related message. |
244 static bool IsResourceDispatcherMessage(const IPC::Message& message); | 250 static bool IsResourceDispatcherMessage(const IPC::Message& message); |
245 | 251 |
246 // ViewHostMsg_Resource_DataReceived is not POD, it has a shared memory | 252 // ViewHostMsg_Resource_DataReceived is not POD, it has a shared memory |
247 // handle in it that we should cleanup it up nicely. This method accepts any | 253 // handle in it that we should cleanup it up nicely. This method accepts any |
248 // message and determine whether the message is | 254 // message and determine whether the message is |
249 // ViewHostMsg_Resource_DataReceived and clean up the shared memory handle. | 255 // ViewHostMsg_Resource_DataReceived and clean up the shared memory handle. |
250 static void ReleaseResourcesInDataMessage(const IPC::Message& message); | 256 static void ReleaseResourcesInDataMessage(const IPC::Message& message); |
251 | 257 |
252 // Iterate through a message queue and clean up the messages by calling | 258 // Iterate through a message queue and clean up the messages by calling |
(...skipping 15 matching lines...) Expand all Loading... |
268 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter_; | 274 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter_; |
269 | 275 |
270 base::WeakPtrFactory<ResourceDispatcher> weak_factory_; | 276 base::WeakPtrFactory<ResourceDispatcher> weak_factory_; |
271 | 277 |
272 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher); | 278 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher); |
273 }; | 279 }; |
274 | 280 |
275 } // namespace content | 281 } // namespace content |
276 | 282 |
277 #endif // CONTENT_CHILD_RESOURCE_DISPATCHER_H_ | 283 #endif // CONTENT_CHILD_RESOURCE_DISPATCHER_H_ |
OLD | NEW |