Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: content/child/resource_dispatcher.h

Issue 1561563002: Cleanup ResourceDispatcher::PendingRequestInfo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review fix Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/child/resource_dispatcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <string> 14 #include <string>
14 15
15 #include "base/containers/hash_tables.h" 16 #include "base/containers/hash_tables.h"
16 #include "base/macros.h" 17 #include "base/macros.h"
17 #include "base/memory/linked_ptr.h" 18 #include "base/memory/linked_ptr.h"
18 #include "base/memory/scoped_ptr.h" 19 #include "base/memory/scoped_ptr.h"
19 #include "base/memory/shared_memory.h" 20 #include "base/memory/shared_memory.h"
20 #include "base/memory/weak_ptr.h" 21 #include "base/memory/weak_ptr.h"
21 #include "base/single_thread_task_runner.h" 22 #include "base/single_thread_task_runner.h"
22 #include "base/time/time.h" 23 #include "base/time/time.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 } 135 }
135 136
136 void SetResourceSchedulingFilter( 137 void SetResourceSchedulingFilter(
137 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter); 138 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter);
138 139
139 private: 140 private:
140 friend class ResourceDispatcherTest; 141 friend class ResourceDispatcherTest;
141 142
142 typedef std::deque<IPC::Message*> MessageQueue; 143 typedef std::deque<IPC::Message*> MessageQueue;
143 struct PendingRequestInfo { 144 struct PendingRequestInfo {
144 PendingRequestInfo();
145
146 PendingRequestInfo(RequestPeer* peer, 145 PendingRequestInfo(RequestPeer* peer,
147 ResourceType resource_type, 146 ResourceType resource_type,
148 int origin_pid, 147 int origin_pid,
149 const GURL& frame_origin, 148 const GURL& frame_origin,
150 const GURL& request_url, 149 const GURL& request_url,
151 bool download_to_file); 150 bool download_to_file);
152 151
153 ~PendingRequestInfo(); 152 ~PendingRequestInfo();
154 153
155 RequestPeer* peer; 154 RequestPeer* peer;
156 ThreadedDataProvider* threaded_data_provider; 155 ThreadedDataProvider* threaded_data_provider = nullptr;
157 ResourceType resource_type; 156 ResourceType resource_type;
158 // The PID of the original process which issued this request. This gets 157 // The PID of the original process which issued this request. This gets
159 // non-zero only for a request proxied by another renderer, particularly 158 // non-zero only for a request proxied by another renderer, particularly
160 // requests from plugins. 159 // requests from plugins.
161 int origin_pid; 160 int origin_pid;
162 MessageQueue deferred_message_queue; 161 MessageQueue deferred_message_queue;
163 bool is_deferred; 162 bool is_deferred = false;
164 // Original requested url. 163 // Original requested url.
165 GURL url; 164 GURL url;
166 // The security origin of the frame that initiates this request. 165 // The security origin of the frame that initiates this request.
167 GURL frame_origin; 166 GURL frame_origin;
168 // The url of the latest response even in case of redirection. 167 // The url of the latest response even in case of redirection.
169 GURL response_url; 168 GURL response_url;
170 bool download_to_file; 169 bool download_to_file;
171 linked_ptr<IPC::Message> pending_redirect_message; 170 scoped_ptr<IPC::Message> pending_redirect_message;
172 base::TimeTicks request_start; 171 base::TimeTicks request_start;
173 base::TimeTicks response_start; 172 base::TimeTicks response_start;
174 base::TimeTicks completion_time; 173 base::TimeTicks completion_time;
175 linked_ptr<base::SharedMemory> buffer; 174 linked_ptr<base::SharedMemory> buffer;
176 scoped_refptr<SharedMemoryReceivedDataFactory> received_data_factory; 175 scoped_refptr<SharedMemoryReceivedDataFactory> received_data_factory;
177 linked_ptr<SiteIsolationResponseMetaData> site_isolation_metadata; 176 scoped_ptr<SiteIsolationResponseMetaData> site_isolation_metadata;
178 int buffer_size; 177 int buffer_size;
179 178
180 // Debugging for https://code.google.com/p/chromium/issues/detail?id=527588. 179 // Debugging for https://code.google.com/p/chromium/issues/detail?id=527588.
181 int data_offset; 180 int data_offset = -1;
182 }; 181 };
183 typedef base::hash_map<int, PendingRequestInfo> PendingRequestList; 182 using PendingRequestMap = std::map<int, scoped_ptr<PendingRequestInfo>>;
184 183
185 // Helper to lookup the info based on the request_id. 184 // Helper to lookup the info based on the request_id.
186 // May return NULL if the request as been canceled from the client side. 185 // May return NULL if the request as been canceled from the client side.
187 PendingRequestInfo* GetPendingRequestInfo(int request_id); 186 PendingRequestInfo* GetPendingRequestInfo(int request_id);
188 187
189 // Follows redirect, if any, for the given request. 188 // Follows redirect, if any, for the given request.
190 void FollowPendingRedirect(int request_id, PendingRequestInfo& request_info); 189 void FollowPendingRedirect(int request_id, PendingRequestInfo* request_info);
191 190
192 // Message response handlers, called by the message handler for this process. 191 // Message response handlers, called by the message handler for this process.
193 void OnUploadProgress(int request_id, int64_t position, int64_t size); 192 void OnUploadProgress(int request_id, int64_t position, int64_t size);
194 void OnReceivedResponse(int request_id, const ResourceResponseHead&); 193 void OnReceivedResponse(int request_id, const ResourceResponseHead&);
195 void OnReceivedCachedMetadata(int request_id, const std::vector<char>& data); 194 void OnReceivedCachedMetadata(int request_id, const std::vector<char>& data);
196 void OnReceivedRedirect(int request_id, 195 void OnReceivedRedirect(int request_id,
197 const net::RedirectInfo& redirect_info, 196 const net::RedirectInfo& redirect_info,
198 const ResourceResponseHead& response_head); 197 const ResourceResponseHead& response_head);
199 void OnSetDataBuffer(int request_id, 198 void OnSetDataBuffer(int request_id,
200 base::SharedMemoryHandle shm_handle, 199 base::SharedMemoryHandle shm_handle,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 static void ReleaseResourcesInMessageQueue(MessageQueue* queue); 244 static void ReleaseResourcesInMessageQueue(MessageQueue* queue);
246 245
247 scoped_ptr<ResourceHostMsg_Request> CreateRequest( 246 scoped_ptr<ResourceHostMsg_Request> CreateRequest(
248 const RequestInfo& request_info, 247 const RequestInfo& request_info,
249 ResourceRequestBody* request_body, 248 ResourceRequestBody* request_body,
250 GURL* frame_origin); 249 GURL* frame_origin);
251 250
252 IPC::Sender* message_sender_; 251 IPC::Sender* message_sender_;
253 252
254 // All pending requests issued to the host 253 // All pending requests issued to the host
255 PendingRequestList pending_requests_; 254 PendingRequestMap pending_requests_;
256 255
257 ResourceDispatcherDelegate* delegate_; 256 ResourceDispatcherDelegate* delegate_;
258 257
259 // IO thread timestamp for ongoing IPC message. 258 // IO thread timestamp for ongoing IPC message.
260 base::TimeTicks io_timestamp_; 259 base::TimeTicks io_timestamp_;
261 260
262 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; 261 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
263 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter_; 262 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter_;
264 263
265 base::WeakPtrFactory<ResourceDispatcher> weak_factory_; 264 base::WeakPtrFactory<ResourceDispatcher> weak_factory_;
266 265
267 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher); 266 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher);
268 }; 267 };
269 268
270 } // namespace content 269 } // namespace content
271 270
272 #endif // CONTENT_CHILD_RESOURCE_DISPATCHER_H_ 271 #endif // CONTENT_CHILD_RESOURCE_DISPATCHER_H_
OLDNEW
« no previous file with comments | « no previous file | content/child/resource_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698