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

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

Issue 1693563002: PROTOTYPE: PlzNavigate: use a Mojo data pipe to stream navigation data to the renderer. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Browser sends URLRequest id to the renderer and renderer uses intermediary buffer for data: none he… Created 4 years, 8 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 | « content/child/request_info.h ('k') | 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 <map>
14 #include <string> 14 #include <string>
15 15
16 #include "base/containers/hash_tables.h" 16 #include "base/containers/hash_tables.h"
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "base/memory/linked_ptr.h" 18 #include "base/memory/linked_ptr.h"
19 #include "base/memory/scoped_ptr.h" 19 #include "base/memory/scoped_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/public/common/resource_type.h" 25 #include "content/public/common/resource_type.h"
26 #include "ipc/ipc_listener.h" 26 #include "ipc/ipc_listener.h"
27 #include "ipc/ipc_sender.h" 27 #include "ipc/ipc_sender.h"
28 #include "mojo/public/cpp/system/data_pipe.h"
29 #include "mojo/public/cpp/system/watcher.h"
28 #include "net/base/request_priority.h" 30 #include "net/base/request_priority.h"
29 #include "url/gurl.h" 31 #include "url/gurl.h"
30 32
31 struct ResourceHostMsg_Request; 33 struct ResourceHostMsg_Request;
32 struct ResourceMsg_RequestCompleteData; 34 struct ResourceMsg_RequestCompleteData;
33 35
34 namespace net { 36 namespace net {
35 struct RedirectInfo; 37 struct RedirectInfo;
36 } 38 }
37 39
(...skipping 29 matching lines...) Expand all
67 // use this if you really need it! There is also no way for the caller to 69 // use this if you really need it! There is also no way for the caller to
68 // interrupt this method. Errors are reported via the status field of the 70 // interrupt this method. Errors are reported via the status field of the
69 // response parameter. 71 // response parameter.
70 void StartSync(const RequestInfo& request_info, 72 void StartSync(const RequestInfo& request_info,
71 ResourceRequestBody* request_body, 73 ResourceRequestBody* request_body,
72 SyncLoadResponse* response); 74 SyncLoadResponse* response);
73 75
74 // Call this method to initiate the request. If this method succeeds, then 76 // Call this method to initiate the request. If this method succeeds, then
75 // the peer's methods will be called asynchronously to report various events. 77 // the peer's methods will be called asynchronously to report various events.
76 // Returns the request id. 78 // Returns the request id.
77 virtual int StartAsync(const RequestInfo& request_info, 79 virtual int StartAsync(
78 ResourceRequestBody* request_body, 80 const RequestInfo& request_info,
79 scoped_ptr<RequestPeer> peer); 81 ResourceRequestBody* request_body,
82 scoped_ptr<RequestPeer> peer,
83 mojo::ScopedDataPipeConsumerHandle mojo_data_pipe_handle,
84 int browser_request_id);
80 85
81 // Removes a request from the |pending_requests_| list, returning true if the 86 // Removes a request from the |pending_requests_| list, returning true if the
82 // request was found and removed. 87 // request was found and removed.
83 bool RemovePendingRequest(int request_id); 88 bool RemovePendingRequest(int request_id);
84 89
85 // Cancels a request in the |pending_requests_| list. The request will be 90 // Cancels a request in the |pending_requests_| list. The request will be
86 // removed from the dispatcher as well. 91 // removed from the dispatcher as well.
87 virtual void Cancel(int request_id); 92 virtual void Cancel(int request_id);
88 93
89 // Toggles the is_deferred attribute for the specified request. 94 // Toggles the is_deferred attribute for the specified request.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 GURL response_url; 155 GURL response_url;
151 bool download_to_file; 156 bool download_to_file;
152 scoped_ptr<IPC::Message> pending_redirect_message; 157 scoped_ptr<IPC::Message> pending_redirect_message;
153 base::TimeTicks request_start; 158 base::TimeTicks request_start;
154 base::TimeTicks response_start; 159 base::TimeTicks response_start;
155 base::TimeTicks completion_time; 160 base::TimeTicks completion_time;
156 linked_ptr<base::SharedMemory> buffer; 161 linked_ptr<base::SharedMemory> buffer;
157 scoped_refptr<SharedMemoryReceivedDataFactory> received_data_factory; 162 scoped_refptr<SharedMemoryReceivedDataFactory> received_data_factory;
158 scoped_ptr<SiteIsolationResponseMetaData> site_isolation_metadata; 163 scoped_ptr<SiteIsolationResponseMetaData> site_isolation_metadata;
159 int buffer_size; 164 int buffer_size;
165
166 mojo::ScopedDataPipeConsumerHandle mojo_data_pipe_handle;
167 mojo::Watcher mojo_watcher;
168 uint32_t mojo_total_bytes;
160 }; 169 };
161 using PendingRequestMap = std::map<int, scoped_ptr<PendingRequestInfo>>; 170 using PendingRequestMap = std::map<int, scoped_ptr<PendingRequestInfo>>;
162 171
163 // Helper to lookup the info based on the request_id. 172 // Helper to lookup the info based on the request_id.
164 // May return NULL if the request as been canceled from the client side. 173 // May return NULL if the request as been canceled from the client side.
165 PendingRequestInfo* GetPendingRequestInfo(int request_id); 174 PendingRequestInfo* GetPendingRequestInfo(int request_id);
166 175
167 // Follows redirect, if any, for the given request. 176 // Follows redirect, if any, for the given request.
168 void FollowPendingRedirect(int request_id, PendingRequestInfo* request_info); 177 void FollowPendingRedirect(int request_id, PendingRequestInfo* request_info);
169 178
(...skipping 20 matching lines...) Expand all
190 int request_id, 199 int request_id,
191 const ResourceMsg_RequestCompleteData& request_complete_data); 200 const ResourceMsg_RequestCompleteData& request_complete_data);
192 201
193 // Dispatch the message to one of the message response handlers. 202 // Dispatch the message to one of the message response handlers.
194 void DispatchMessage(const IPC::Message& message); 203 void DispatchMessage(const IPC::Message& message);
195 204
196 // Dispatch any deferred messages for the given request, provided it is not 205 // Dispatch any deferred messages for the given request, provided it is not
197 // again in the deferred state. This method may mutate |pending_requests_|. 206 // again in the deferred state. This method may mutate |pending_requests_|.
198 void FlushDeferredMessages(int request_id); 207 void FlushDeferredMessages(int request_id);
199 208
209 // PlzNavigate: Mojo data streaming methods
210 void WaitForMojoData(int request_id, PendingRequestInfo* request_info);
211 void ReceivedMojoData(int request_id, MojoResult);
212 void AcceptMojoMessage(PendingRequestInfo* request_info,
213 const void* buffer,
214 uint32_t num_bytes);
215
200 void ToResourceResponseInfo(const PendingRequestInfo& request_info, 216 void ToResourceResponseInfo(const PendingRequestInfo& request_info,
201 const ResourceResponseHead& browser_info, 217 const ResourceResponseHead& browser_info,
202 ResourceResponseInfo* renderer_info) const; 218 ResourceResponseInfo* renderer_info) const;
203 219
204 base::TimeTicks ToRendererCompletionTime( 220 base::TimeTicks ToRendererCompletionTime(
205 const PendingRequestInfo& request_info, 221 const PendingRequestInfo& request_info,
206 const base::TimeTicks& browser_completion_time) const; 222 const base::TimeTicks& browser_completion_time) const;
207 223
208 // Returns timestamp provided by IO thread. If no timestamp is supplied, 224 // Returns timestamp provided by IO thread. If no timestamp is supplied,
209 // then current time is returned. Saved timestamp is reset, so following 225 // then current time is returned. Saved timestamp is reset, so following
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter_; 259 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter_;
244 260
245 base::WeakPtrFactory<ResourceDispatcher> weak_factory_; 261 base::WeakPtrFactory<ResourceDispatcher> weak_factory_;
246 262
247 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher); 263 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher);
248 }; 264 };
249 265
250 } // namespace content 266 } // namespace content
251 267
252 #endif // CONTENT_CHILD_RESOURCE_DISPATCHER_H_ 268 #endif // CONTENT_CHILD_RESOURCE_DISPATCHER_H_
OLDNEW
« no previous file with comments | « content/child/request_info.h ('k') | content/child/resource_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698