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

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

Issue 1041993004: content::ResourceDispatcherHostImpl changes for stale-while-revalidate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@s-w-r-yhirano-patch
Patch Set: Workaround iwyu bug in prerender_resource Created 5 years, 4 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
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 #include "content/browser/loader/resource_request_info_impl.h" 5 #include "content/browser/loader/resource_request_info_impl.h"
6 6
7 #include "content/browser/loader/global_routing_id.h" 7 #include "content/browser/loader/global_routing_id.h"
8 #include "content/browser/loader/resource_message_filter.h" 8 #include "content/browser/loader/resource_message_filter.h"
9 #include "content/common/net/url_request_user_data.h" 9 #include "content/common/net/url_request_user_data.h"
10 #include "content/common/resource_messages.h"
10 #include "content/public/browser/global_request_id.h" 11 #include "content/public/browser/global_request_id.h"
11 #include "content/public/common/process_type.h" 12 #include "content/public/common/process_type.h"
12 #include "net/url_request/url_request.h" 13 #include "net/url_request/url_request.h"
13 14
14 namespace content { 15 namespace content {
15 16
16 // ---------------------------------------------------------------------------- 17 // ----------------------------------------------------------------------------
17 // ResourceRequestInfo 18 // ResourceRequestInfo
18 19
19 // static 20 // static
(...skipping 14 matching lines...) Expand all
34 bool allow_download, 35 bool allow_download,
35 bool is_async) { 36 bool is_async) {
36 // Make sure both |is_main_frame| and |parent_is_main_frame| aren't set at the 37 // Make sure both |is_main_frame| and |parent_is_main_frame| aren't set at the
37 // same time. 38 // same time.
38 DCHECK(!(is_main_frame && parent_is_main_frame)); 39 DCHECK(!(is_main_frame && parent_is_main_frame));
39 40
40 // Make sure RESOURCE_TYPE_MAIN_FRAME is declared as being fetched as part of 41 // Make sure RESOURCE_TYPE_MAIN_FRAME is declared as being fetched as part of
41 // the main frame. 42 // the main frame.
42 DCHECK(resource_type != RESOURCE_TYPE_MAIN_FRAME || is_main_frame); 43 DCHECK(resource_type != RESOURCE_TYPE_MAIN_FRAME || is_main_frame);
43 44
44 ResourceRequestInfoImpl* info = 45 ResourceRequestInfoImpl* info = new ResourceRequestInfoImpl(
45 new ResourceRequestInfoImpl( 46 PROCESS_TYPE_RENDERER, // process_type
46 PROCESS_TYPE_RENDERER, // process_type 47 render_process_id, // child_id
47 render_process_id, // child_id 48 render_view_id, // route_id
48 render_view_id, // route_id 49 -1, // frame_tree_node_id
49 -1, // frame_tree_node_id 50 0, // origin_pid
50 0, // origin_pid 51 0, // request_id
51 0, // request_id 52 render_frame_id, // render_frame_id
52 render_frame_id, // render_frame_id 53 is_main_frame, // is_main_frame
53 is_main_frame, // is_main_frame 54 parent_is_main_frame, // parent_is_main_frame
54 parent_is_main_frame, // parent_is_main_frame 55 0, // parent_render_frame_id
55 0, // parent_render_frame_id 56 resource_type, // resource_type
56 resource_type, // resource_type 57 ui::PAGE_TRANSITION_LINK, // transition_type
57 ui::PAGE_TRANSITION_LINK, // transition_type 58 false, // should_replace_current_entry
58 false, // should_replace_current_entry 59 false, // is_download
59 false, // is_download 60 false, // is_stream
60 false, // is_stream 61 allow_download, // allow_download
61 allow_download, // allow_download 62 false, // has_user_gesture
62 false, // has_user_gesture 63 false, // enable load timing
63 false, // enable load timing 64 request->has_upload(), // enable upload progress
64 request->has_upload(), // enable upload progress 65 false, // do_not_prompt_for_login
65 false, // do_not_prompt_for_login 66 blink::WebReferrerPolicyDefault, // referrer_policy
66 blink::WebReferrerPolicyDefault, // referrer_policy 67 blink::WebPageVisibilityStateVisible, // visibility_state
67 blink::WebPageVisibilityStateVisible, // visibility_state 68 context, // context
68 context, // context 69 base::WeakPtr<ResourceMessageFilter>(), // filter
69 base::WeakPtr<ResourceMessageFilter>(), // filter 70 is_async, // is_async
70 is_async); // is_async 71 NULL); // original_request
davidben 2015/10/08 21:57:52 nullptr
Adam Rice 2015/10/13 22:53:17 Done.
71 info->AssociateWithRequest(request); 72 info->AssociateWithRequest(request);
72 } 73 }
73 74
74 // static 75 // static
75 bool ResourceRequestInfo::GetRenderFrameForRequest( 76 bool ResourceRequestInfo::GetRenderFrameForRequest(
76 const net::URLRequest* request, 77 const net::URLRequest* request,
77 int* render_process_id, 78 int* render_process_id,
78 int* render_frame_id) { 79 int* render_frame_id) {
79 URLRequestUserData* user_data = static_cast<URLRequestUserData*>( 80 URLRequestUserData* user_data = static_cast<URLRequestUserData*>(
80 request->GetUserData(URLRequestUserData::kUserDataKey)); 81 request->GetUserData(URLRequestUserData::kUserDataKey));
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 bool is_stream, 119 bool is_stream,
119 bool allow_download, 120 bool allow_download,
120 bool has_user_gesture, 121 bool has_user_gesture,
121 bool enable_load_timing, 122 bool enable_load_timing,
122 bool enable_upload_progress, 123 bool enable_upload_progress,
123 bool do_not_prompt_for_login, 124 bool do_not_prompt_for_login,
124 blink::WebReferrerPolicy referrer_policy, 125 blink::WebReferrerPolicy referrer_policy,
125 blink::WebPageVisibilityState visibility_state, 126 blink::WebPageVisibilityState visibility_state,
126 ResourceContext* context, 127 ResourceContext* context,
127 base::WeakPtr<ResourceMessageFilter> filter, 128 base::WeakPtr<ResourceMessageFilter> filter,
128 bool is_async) 129 bool is_async,
130 const ResourceHostMsg_Request* original_request)
129 : cross_site_handler_(NULL), 131 : cross_site_handler_(NULL),
130 detachable_handler_(NULL), 132 detachable_handler_(NULL),
131 process_type_(process_type), 133 process_type_(process_type),
132 child_id_(child_id), 134 child_id_(child_id),
133 route_id_(route_id), 135 route_id_(route_id),
134 frame_tree_node_id_(frame_tree_node_id), 136 frame_tree_node_id_(frame_tree_node_id),
135 origin_pid_(origin_pid), 137 origin_pid_(origin_pid),
136 request_id_(request_id), 138 request_id_(request_id),
137 render_frame_id_(render_frame_id), 139 render_frame_id_(render_frame_id),
138 is_main_frame_(is_main_frame), 140 is_main_frame_(is_main_frame),
(...skipping 10 matching lines...) Expand all
149 was_ignored_by_handler_(false), 151 was_ignored_by_handler_(false),
150 counted_as_in_flight_request_(false), 152 counted_as_in_flight_request_(false),
151 resource_type_(resource_type), 153 resource_type_(resource_type),
152 transition_type_(transition_type), 154 transition_type_(transition_type),
153 memory_cost_(0), 155 memory_cost_(0),
154 referrer_policy_(referrer_policy), 156 referrer_policy_(referrer_policy),
155 visibility_state_(visibility_state), 157 visibility_state_(visibility_state),
156 context_(context), 158 context_(context),
157 filter_(filter), 159 filter_(filter),
158 is_async_(is_async) { 160 is_async_(is_async) {
161 if (original_request) {
162 // ResourceHostMsg_Request can be safely copied because it is a struct with
163 // only copyable types as members. The only potentially dangerous member is
164 // request_body, and ResourceDispatcherHostImpl ensures that is never set
165 // for an asynchronous revalidation.
davidben 2015/10/08 21:57:52 This class cannot depend on ResourceDispatcherHost
Adam Rice 2015/10/13 22:53:17 Done.
166 DCHECK(!original_request->request_body);
167 original_request_.reset(new ResourceHostMsg_Request(*original_request));
168 }
159 } 169 }
160 170
161 ResourceRequestInfoImpl::~ResourceRequestInfoImpl() { 171 ResourceRequestInfoImpl::~ResourceRequestInfoImpl() {
162 } 172 }
163 173
164 ResourceContext* ResourceRequestInfoImpl::GetContext() const { 174 ResourceContext* ResourceRequestInfoImpl::GetContext() const {
165 return context_; 175 return context_;
166 } 176 }
167 177
168 int ResourceRequestInfoImpl::GetChildID() const { 178 int ResourceRequestInfoImpl::GetChildID() const {
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 base::WeakPtr<ResourceMessageFilter> filter) { 285 base::WeakPtr<ResourceMessageFilter> filter) {
276 child_id_ = child_id; 286 child_id_ = child_id;
277 route_id_ = route_id; 287 route_id_ = route_id;
278 origin_pid_ = origin_pid; 288 origin_pid_ = origin_pid;
279 request_id_ = request_id; 289 request_id_ = request_id;
280 parent_render_frame_id_ = parent_render_frame_id; 290 parent_render_frame_id_ = parent_render_frame_id;
281 filter_ = filter; 291 filter_ = filter;
282 } 292 }
283 293
284 } // namespace content 294 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698