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 <deque> | 10 #include <deque> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/containers/hash_tables.h" | 13 #include "base/containers/hash_tables.h" |
14 #include "base/memory/linked_ptr.h" | 14 #include "base/memory/linked_ptr.h" |
15 #include "base/memory/shared_memory.h" | 15 #include "base/memory/shared_memory.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
18 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
19 #include "ipc/ipc_listener.h" | 19 #include "ipc/ipc_listener.h" |
20 #include "ipc/ipc_sender.h" | 20 #include "ipc/ipc_sender.h" |
21 #include "net/base/request_priority.h" | 21 #include "net/base/request_priority.h" |
22 #include "webkit/common/resource_type.h" | 22 #include "webkit/common/resource_type.h" |
23 | 23 |
24 struct ResourceMsg_RequestCompleteData; | 24 struct ResourceMsg_RequestCompleteData; |
25 | 25 |
| 26 namespace blink { |
| 27 class WebThreadedDataReceiver; |
| 28 } |
| 29 |
26 namespace webkit_glue { | 30 namespace webkit_glue { |
27 class ResourceLoaderBridge; | 31 class ResourceLoaderBridge; |
28 } | 32 } |
29 | 33 |
30 namespace content { | 34 namespace content { |
31 class RequestPeer; | 35 class RequestPeer; |
32 class ResourceDispatcherDelegate; | 36 class ResourceDispatcherDelegate; |
| 37 class ThreadedDataProvider; |
33 struct ResourceResponseInfo; | 38 struct ResourceResponseInfo; |
34 struct RequestInfo; | 39 struct RequestInfo; |
35 struct ResourceResponseHead; | 40 struct ResourceResponseHead; |
36 struct SiteIsolationResponseMetaData; | 41 struct SiteIsolationResponseMetaData; |
37 | 42 |
38 // This class serves as a communication interface between the | 43 // This class serves as a communication interface between the |
39 // ResourceDispatcherHost in the browser process and the ResourceLoaderBridge in | 44 // ResourceDispatcherHost in the browser process and the ResourceLoaderBridge in |
40 // the child process. It can be used from any child process. | 45 // the child process. It can be used from any child process. |
41 class CONTENT_EXPORT ResourceDispatcher : public IPC::Listener { | 46 class CONTENT_EXPORT ResourceDispatcher : public IPC::Listener { |
42 public: | 47 public: |
(...skipping 26 matching lines...) Expand all Loading... |
69 void CancelPendingRequest(int request_id); | 74 void CancelPendingRequest(int request_id); |
70 | 75 |
71 // Toggles the is_deferred attribute for the specified request. | 76 // Toggles the is_deferred attribute for the specified request. |
72 void SetDefersLoading(int request_id, bool value); | 77 void SetDefersLoading(int request_id, bool value); |
73 | 78 |
74 // Indicates the priority of the specified request changed. | 79 // Indicates the priority of the specified request changed. |
75 void DidChangePriority(int request_id, | 80 void DidChangePriority(int request_id, |
76 net::RequestPriority new_priority, | 81 net::RequestPriority new_priority, |
77 int intra_priority_value); | 82 int intra_priority_value); |
78 | 83 |
| 84 // The provided data receiver will receive incoming resource data rather |
| 85 // than the resource bridge. |
| 86 bool AttachThreadedDataReceiver( |
| 87 int request_id, blink::WebThreadedDataReceiver* threaded_data_receiver); |
| 88 |
79 IPC::Sender* message_sender() const { return message_sender_; } | 89 IPC::Sender* message_sender() const { return message_sender_; } |
80 | 90 |
81 // This does not take ownership of the delegate. It is expected that the | 91 // This does not take ownership of the delegate. It is expected that the |
82 // delegate have a longer lifetime than the ResourceDispatcher. | 92 // delegate have a longer lifetime than the ResourceDispatcher. |
83 void set_delegate(ResourceDispatcherDelegate* delegate) { | 93 void set_delegate(ResourceDispatcherDelegate* delegate) { |
84 delegate_ = delegate; | 94 delegate_ = delegate; |
85 } | 95 } |
86 | 96 |
87 // Remembers IO thread timestamp for next resource message. | 97 // Remembers IO thread timestamp for next resource message. |
88 void set_io_timestamp(base::TimeTicks io_timestamp) { | 98 void set_io_timestamp(base::TimeTicks io_timestamp) { |
(...skipping 10 matching lines...) Expand all Loading... |
99 PendingRequestInfo(RequestPeer* peer, | 109 PendingRequestInfo(RequestPeer* peer, |
100 ResourceType::Type resource_type, | 110 ResourceType::Type resource_type, |
101 int origin_pid, | 111 int origin_pid, |
102 const GURL& frame_origin, | 112 const GURL& frame_origin, |
103 const GURL& request_url, | 113 const GURL& request_url, |
104 bool download_to_file); | 114 bool download_to_file); |
105 | 115 |
106 ~PendingRequestInfo(); | 116 ~PendingRequestInfo(); |
107 | 117 |
108 RequestPeer* peer; | 118 RequestPeer* peer; |
| 119 ThreadedDataProvider* threaded_data_provider; |
109 ResourceType::Type resource_type; | 120 ResourceType::Type resource_type; |
110 // The PID of the original process which issued this request. This gets | 121 // The PID of the original process which issued this request. This gets |
111 // non-zero only for a request proxied by another renderer, particularly | 122 // non-zero only for a request proxied by another renderer, particularly |
112 // requests from plugins. | 123 // requests from plugins. |
113 int origin_pid; | 124 int origin_pid; |
114 MessageQueue deferred_message_queue; | 125 MessageQueue deferred_message_queue; |
115 bool is_deferred; | 126 bool is_deferred; |
116 // Original requested url. | 127 // Original requested url. |
117 GURL url; | 128 GURL url; |
118 // The security origin of the frame that initiates this request. | 129 // The security origin of the frame that initiates this request. |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 | 215 |
205 // IO thread timestamp for ongoing IPC message. | 216 // IO thread timestamp for ongoing IPC message. |
206 base::TimeTicks io_timestamp_; | 217 base::TimeTicks io_timestamp_; |
207 | 218 |
208 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher); | 219 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher); |
209 }; | 220 }; |
210 | 221 |
211 } // namespace content | 222 } // namespace content |
212 | 223 |
213 #endif // CONTENT_CHILD_RESOURCE_DISPATCHER_H_ | 224 #endif // CONTENT_CHILD_RESOURCE_DISPATCHER_H_ |
OLD | NEW |