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