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

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

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

Powered by Google App Engine
This is Rietveld 408576698