| 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> |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 main_thread_task_runner_ = main_thread_task_runner; | 129 main_thread_task_runner_ = main_thread_task_runner; |
| 130 } | 130 } |
| 131 | 131 |
| 132 private: | 132 private: |
| 133 friend class ResourceDispatcherTest; | 133 friend class ResourceDispatcherTest; |
| 134 | 134 |
| 135 typedef std::deque<IPC::Message*> MessageQueue; | 135 typedef std::deque<IPC::Message*> MessageQueue; |
| 136 struct PendingRequestInfo { | 136 struct PendingRequestInfo { |
| 137 PendingRequestInfo(); | 137 PendingRequestInfo(); |
| 138 | 138 |
| 139 PendingRequestInfo(RequestPeer* peer, | 139 PendingRequestInfo( |
| 140 ResourceType resource_type, | 140 RequestPeer* peer, |
| 141 int origin_pid, | 141 ResourceType resource_type, |
| 142 const GURL& frame_origin, | 142 int origin_pid, |
| 143 const GURL& request_url, | 143 const GURL& frame_origin, |
| 144 bool download_to_file); | 144 const GURL& request_url, |
| 145 bool download_to_file, |
| 146 scoped_refptr<base::SingleThreadTaskRunner> loading_task_queue); |
| 145 | 147 |
| 146 ~PendingRequestInfo(); | 148 ~PendingRequestInfo(); |
| 147 | 149 |
| 148 RequestPeer* peer; | 150 RequestPeer* peer; |
| 149 ThreadedDataProvider* threaded_data_provider; | 151 ThreadedDataProvider* threaded_data_provider; |
| 150 ResourceType resource_type; | 152 ResourceType resource_type; |
| 151 // The PID of the original process which issued this request. This gets | 153 // The PID of the original process which issued this request. This gets |
| 152 // non-zero only for a request proxied by another renderer, particularly | 154 // non-zero only for a request proxied by another renderer, particularly |
| 153 // requests from plugins. | 155 // requests from plugins. |
| 154 int origin_pid; | 156 int origin_pid; |
| 155 MessageQueue deferred_message_queue; | 157 MessageQueue deferred_message_queue; |
| 156 bool is_deferred; | 158 bool is_deferred; |
| 157 // Original requested url. | 159 // Original requested url. |
| 158 GURL url; | 160 GURL url; |
| 159 // The security origin of the frame that initiates this request. | 161 // The security origin of the frame that initiates this request. |
| 160 GURL frame_origin; | 162 GURL frame_origin; |
| 161 // The url of the latest response even in case of redirection. | 163 // The url of the latest response even in case of redirection. |
| 162 GURL response_url; | 164 GURL response_url; |
| 163 bool download_to_file; | 165 bool download_to_file; |
| 164 linked_ptr<IPC::Message> pending_redirect_message; | 166 linked_ptr<IPC::Message> pending_redirect_message; |
| 165 base::TimeTicks request_start; | 167 base::TimeTicks request_start; |
| 166 base::TimeTicks response_start; | 168 base::TimeTicks response_start; |
| 167 base::TimeTicks completion_time; | 169 base::TimeTicks completion_time; |
| 168 linked_ptr<base::SharedMemory> buffer; | 170 linked_ptr<base::SharedMemory> buffer; |
| 169 scoped_refptr<SharedMemoryReceivedDataFactory> received_data_factory; | 171 scoped_refptr<SharedMemoryReceivedDataFactory> received_data_factory; |
| 170 linked_ptr<SiteIsolationResponseMetaData> site_isolation_metadata; | 172 linked_ptr<SiteIsolationResponseMetaData> site_isolation_metadata; |
| 171 int buffer_size; | 173 int buffer_size; |
| 174 scoped_refptr<base::SingleThreadTaskRunner> loading_task_queue; |
| 172 }; | 175 }; |
| 173 typedef base::hash_map<int, PendingRequestInfo> PendingRequestList; | 176 typedef base::hash_map<int, PendingRequestInfo> PendingRequestList; |
| 174 | 177 |
| 175 // Helper to lookup the info based on the request_id. | 178 // Helper to lookup the info based on the request_id. |
| 176 // May return NULL if the request as been canceled from the client side. | 179 // May return NULL if the request as been canceled from the client side. |
| 177 PendingRequestInfo* GetPendingRequestInfo(int request_id); | 180 PendingRequestInfo* GetPendingRequestInfo(int request_id); |
| 178 | 181 |
| 179 // Follows redirect, if any, for the given request. | 182 // Follows redirect, if any, for the given request. |
| 180 void FollowPendingRedirect(int request_id, PendingRequestInfo& request_info); | 183 void FollowPendingRedirect(int request_id, PendingRequestInfo& request_info); |
| 181 | 184 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; | 254 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
| 252 | 255 |
| 253 base::WeakPtrFactory<ResourceDispatcher> weak_factory_; | 256 base::WeakPtrFactory<ResourceDispatcher> weak_factory_; |
| 254 | 257 |
| 255 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher); | 258 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher); |
| 256 }; | 259 }; |
| 257 | 260 |
| 258 } // namespace content | 261 } // namespace content |
| 259 | 262 |
| 260 #endif // CONTENT_CHILD_RESOURCE_DISPATCHER_H_ | 263 #endif // CONTENT_CHILD_RESOURCE_DISPATCHER_H_ |
| OLD | NEW |