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

Side by Side Diff: content/browser/loader/resource_request_info_impl.h

Issue 2496193002: Implement transfer navigation with mojo (Closed)
Patch Set: fix Created 4 years 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
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 #ifndef CONTENT_BROWSER_LOADER_RESOURCE_REQUEST_INFO_IMPL_H_ 5 #ifndef CONTENT_BROWSER_LOADER_RESOURCE_REQUEST_INFO_IMPL_H_
6 #define CONTENT_BROWSER_LOADER_RESOURCE_REQUEST_INFO_IMPL_H_ 6 #define CONTENT_BROWSER_LOADER_RESOURCE_REQUEST_INFO_IMPL_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/callback.h"
12 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
15 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
16 #include "base/supports_user_data.h" 17 #include "base/supports_user_data.h"
17 #include "content/browser/service_worker/service_worker_context_wrapper.h" 18 #include "content/browser/service_worker/service_worker_context_wrapper.h"
18 #include "content/common/resource_request_body_impl.h" 19 #include "content/common/resource_request_body_impl.h"
20 #include "content/common/url_loader.mojom.h"
19 #include "content/public/browser/navigation_ui_data.h" 21 #include "content/public/browser/navigation_ui_data.h"
20 #include "content/public/browser/resource_request_info.h" 22 #include "content/public/browser/resource_request_info.h"
21 #include "content/public/common/referrer.h" 23 #include "content/public/common/referrer.h"
22 #include "content/public/common/resource_type.h" 24 #include "content/public/common/resource_type.h"
23 #include "net/base/load_states.h" 25 #include "net/base/load_states.h"
24 26
25 namespace content { 27 namespace content {
26 class DetachableResourceHandler; 28 class DetachableResourceHandler;
27 class ResourceContext; 29 class ResourceContext;
28 class ResourceMessageFilter; 30 class ResourceMessageFilter;
29 struct GlobalRequestID; 31 struct GlobalRequestID;
30 struct GlobalRoutingID; 32 struct GlobalRoutingID;
31 33
32 // Holds the data ResourceDispatcherHost associates with each request. 34 // Holds the data ResourceDispatcherHost associates with each request.
33 // Retrieve this data by calling ResourceDispatcherHost::InfoForRequest. 35 // Retrieve this data by calling ResourceDispatcherHost::InfoForRequest.
34 class ResourceRequestInfoImpl : public ResourceRequestInfo, 36 class ResourceRequestInfoImpl : public ResourceRequestInfo,
35 public base::SupportsUserData::Data { 37 public base::SupportsUserData::Data {
36 public: 38 public:
39 using TransferCallback =
40 base::Callback<void(mojom::URLLoaderAssociatedRequest,
41 mojom::URLLoaderClientAssociatedPtr)>;
42
37 // Returns the ResourceRequestInfoImpl associated with the given URLRequest. 43 // Returns the ResourceRequestInfoImpl associated with the given URLRequest.
38 CONTENT_EXPORT static ResourceRequestInfoImpl* ForRequest( 44 CONTENT_EXPORT static ResourceRequestInfoImpl* ForRequest(
39 net::URLRequest* request); 45 net::URLRequest* request);
40 46
41 // And, a const version for cases where you only need read access. 47 // And, a const version for cases where you only need read access.
42 CONTENT_EXPORT static const ResourceRequestInfoImpl* ForRequest( 48 CONTENT_EXPORT static const ResourceRequestInfoImpl* ForRequest(
43 const net::URLRequest* request); 49 const net::URLRequest* request);
44 50
45 CONTENT_EXPORT ResourceRequestInfoImpl( 51 CONTENT_EXPORT ResourceRequestInfoImpl(
46 int process_type, 52 int process_type,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 123
118 // Updates the data associated with this request after it is is transferred 124 // Updates the data associated with this request after it is is transferred
119 // to a new renderer process. Not all data will change during a transfer. 125 // to a new renderer process. Not all data will change during a transfer.
120 // We do not expect the ResourceContext to change during navigation, so that 126 // We do not expect the ResourceContext to change during navigation, so that
121 // does not need to be updated. 127 // does not need to be updated.
122 void UpdateForTransfer(int child_id, 128 void UpdateForTransfer(int child_id,
123 int route_id, 129 int route_id,
124 int render_frame_id, 130 int render_frame_id,
125 int origin_pid, 131 int origin_pid,
126 int request_id, 132 int request_id,
127 base::WeakPtr<ResourceMessageFilter> filter); 133 base::WeakPtr<ResourceMessageFilter> filter,
134 mojom::URLLoaderAssociatedRequest url_loader_request,
135 mojom::URLLoaderClientAssociatedPtr url_loader_client);
128 136
129 // Whether this request is part of a navigation that should replace the 137 // Whether this request is part of a navigation that should replace the
130 // current session history entry. This state is shuffled up and down the stack 138 // current session history entry. This state is shuffled up and down the stack
131 // for request transfers. 139 // for request transfers.
132 bool should_replace_current_entry() const { 140 bool should_replace_current_entry() const {
133 return should_replace_current_entry_; 141 return should_replace_current_entry_;
134 } 142 }
135 143
136 // DetachableResourceHandler for this request. May be NULL. 144 // DetachableResourceHandler for this request. May be NULL.
137 DetachableResourceHandler* detachable_handler() const { 145 DetachableResourceHandler* detachable_handler() const {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 // the ResourceMessageFilter will be null in this case. All other requests 210 // the ResourceMessageFilter will be null in this case. All other requests
203 // should access the ServiceWorkerContext through the ResourceMessageFilter. 211 // should access the ServiceWorkerContext through the ResourceMessageFilter.
204 void set_service_worker_context( 212 void set_service_worker_context(
205 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context) { 213 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context) {
206 service_worker_context_ = service_worker_context; 214 service_worker_context_ = service_worker_context;
207 } 215 }
208 ServiceWorkerContextWrapper* service_worker_context() const { 216 ServiceWorkerContextWrapper* service_worker_context() const {
209 return service_worker_context_.get(); 217 return service_worker_context_.get();
210 } 218 }
211 219
220 void set_on_transfer(const TransferCallback& on_transfer) {
221 on_transfer_ = on_transfer;
222 }
223
212 private: 224 private:
213 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, 225 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest,
214 DeletedFilterDetached); 226 DeletedFilterDetached);
215 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, 227 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest,
216 DeletedFilterDetachedRedirect); 228 DeletedFilterDetachedRedirect);
217 // Non-owning, may be NULL. 229 // Non-owning, may be NULL.
218 DetachableResourceHandler* detachable_handler_; 230 DetachableResourceHandler* detachable_handler_;
219 231
220 int process_type_; 232 int process_type_;
221 int child_id_; 233 int child_id_;
(...skipping 25 matching lines...) Expand all
247 base::WeakPtr<ResourceMessageFilter> filter_; 259 base::WeakPtr<ResourceMessageFilter> filter_;
248 bool report_raw_headers_; 260 bool report_raw_headers_;
249 bool is_async_; 261 bool is_async_;
250 bool is_using_lofi_; 262 bool is_using_lofi_;
251 const std::string original_headers_; 263 const std::string original_headers_;
252 scoped_refptr<ResourceRequestBodyImpl> body_; 264 scoped_refptr<ResourceRequestBodyImpl> body_;
253 bool initiated_in_secure_context_; 265 bool initiated_in_secure_context_;
254 std::unique_ptr<NavigationUIData> navigation_ui_data_; 266 std::unique_ptr<NavigationUIData> navigation_ui_data_;
255 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; 267 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_;
256 268
269 // This callback is set by MojoAsyncResourceHandler to update its mojo binding
270 // and remote endpoint. This callback will be removed once PlzNavigate is
271 // shipped.
272 TransferCallback on_transfer_;
273
257 DISALLOW_COPY_AND_ASSIGN(ResourceRequestInfoImpl); 274 DISALLOW_COPY_AND_ASSIGN(ResourceRequestInfoImpl);
258 }; 275 };
259 276
260 } // namespace content 277 } // namespace content
261 278
262 #endif // CONTENT_BROWSER_LOADER_RESOURCE_REQUEST_INFO_IMPL_H_ 279 #endif // CONTENT_BROWSER_LOADER_RESOURCE_REQUEST_INFO_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/loader/resource_dispatcher_host_impl.cc ('k') | content/browser/loader/resource_request_info_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698