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

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: Readability improvements suggested by tyoshino Created 5 years, 6 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 false, // is_async_revalidation
72 NULL); // original_request
71 info->AssociateWithRequest(request); 73 info->AssociateWithRequest(request);
72 } 74 }
73 75
74 // static 76 // static
75 bool ResourceRequestInfo::GetRenderFrameForRequest( 77 bool ResourceRequestInfo::GetRenderFrameForRequest(
76 const net::URLRequest* request, 78 const net::URLRequest* request,
77 int* render_process_id, 79 int* render_process_id,
78 int* render_frame_id) { 80 int* render_frame_id) {
79 URLRequestUserData* user_data = static_cast<URLRequestUserData*>( 81 URLRequestUserData* user_data = static_cast<URLRequestUserData*>(
80 request->GetUserData(URLRequestUserData::kUserDataKey)); 82 request->GetUserData(URLRequestUserData::kUserDataKey));
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 bool is_stream, 120 bool is_stream,
119 bool allow_download, 121 bool allow_download,
120 bool has_user_gesture, 122 bool has_user_gesture,
121 bool enable_load_timing, 123 bool enable_load_timing,
122 bool enable_upload_progress, 124 bool enable_upload_progress,
123 bool do_not_prompt_for_login, 125 bool do_not_prompt_for_login,
124 blink::WebReferrerPolicy referrer_policy, 126 blink::WebReferrerPolicy referrer_policy,
125 blink::WebPageVisibilityState visibility_state, 127 blink::WebPageVisibilityState visibility_state,
126 ResourceContext* context, 128 ResourceContext* context,
127 base::WeakPtr<ResourceMessageFilter> filter, 129 base::WeakPtr<ResourceMessageFilter> filter,
128 bool is_async) 130 bool is_async,
131 bool is_async_revalidation,
132 const ResourceHostMsg_Request* original_request)
129 : cross_site_handler_(NULL), 133 : cross_site_handler_(NULL),
130 detachable_handler_(NULL), 134 detachable_handler_(NULL),
131 process_type_(process_type), 135 process_type_(process_type),
132 child_id_(child_id), 136 child_id_(child_id),
133 route_id_(route_id), 137 route_id_(route_id),
134 frame_tree_node_id_(frame_tree_node_id), 138 frame_tree_node_id_(frame_tree_node_id),
135 origin_pid_(origin_pid), 139 origin_pid_(origin_pid),
136 request_id_(request_id), 140 request_id_(request_id),
137 render_frame_id_(render_frame_id), 141 render_frame_id_(render_frame_id),
138 is_main_frame_(is_main_frame), 142 is_main_frame_(is_main_frame),
139 parent_is_main_frame_(parent_is_main_frame), 143 parent_is_main_frame_(parent_is_main_frame),
140 parent_render_frame_id_(parent_render_frame_id), 144 parent_render_frame_id_(parent_render_frame_id),
141 should_replace_current_entry_(should_replace_current_entry), 145 should_replace_current_entry_(should_replace_current_entry),
142 is_download_(is_download), 146 is_download_(is_download),
143 is_stream_(is_stream), 147 is_stream_(is_stream),
144 allow_download_(allow_download), 148 allow_download_(allow_download),
145 has_user_gesture_(has_user_gesture), 149 has_user_gesture_(has_user_gesture),
146 enable_load_timing_(enable_load_timing), 150 enable_load_timing_(enable_load_timing),
147 enable_upload_progress_(enable_upload_progress), 151 enable_upload_progress_(enable_upload_progress),
148 do_not_prompt_for_login_(do_not_prompt_for_login), 152 do_not_prompt_for_login_(do_not_prompt_for_login),
149 was_ignored_by_handler_(false), 153 was_ignored_by_handler_(false),
150 counted_as_in_flight_request_(false), 154 counted_as_in_flight_request_(false),
151 resource_type_(resource_type), 155 resource_type_(resource_type),
152 transition_type_(transition_type), 156 transition_type_(transition_type),
153 memory_cost_(0), 157 memory_cost_(0),
154 referrer_policy_(referrer_policy), 158 referrer_policy_(referrer_policy),
155 visibility_state_(visibility_state), 159 visibility_state_(visibility_state),
156 context_(context), 160 context_(context),
157 filter_(filter), 161 filter_(filter),
158 is_async_(is_async) { 162 is_async_(is_async),
163 is_async_revalidation_(is_async_revalidation) {
164 if (original_request) {
165 original_request_.reset(new ResourceHostMsg_Request(*original_request));
tyoshino (SeeGerritForStatus) 2015/06/16 13:04:42 write some analysis (maybe in the CL description?)
Adam Rice 2015/06/17 10:05:15 It's not an IPC::Message, it's just a struct, so t
166 }
159 } 167 }
160 168
161 ResourceRequestInfoImpl::~ResourceRequestInfoImpl() { 169 ResourceRequestInfoImpl::~ResourceRequestInfoImpl() {
162 } 170 }
163 171
164 ResourceContext* ResourceRequestInfoImpl::GetContext() const { 172 ResourceContext* ResourceRequestInfoImpl::GetContext() const {
165 return context_; 173 return context_;
166 } 174 }
167 175
168 int ResourceRequestInfoImpl::GetChildID() const { 176 int ResourceRequestInfoImpl::GetChildID() const {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 *render_process_id = child_id_; 244 *render_process_id = child_id_;
237 *render_frame_id = render_frame_id_; 245 *render_frame_id = render_frame_id_;
238 } 246 }
239 return true; 247 return true;
240 } 248 }
241 249
242 bool ResourceRequestInfoImpl::IsAsync() const { 250 bool ResourceRequestInfoImpl::IsAsync() const {
243 return is_async_; 251 return is_async_;
244 } 252 }
245 253
254 bool ResourceRequestInfoImpl::IsAsyncRevalidation() const {
255 return is_async_revalidation_;
256 }
257
246 bool ResourceRequestInfoImpl::IsDownload() const { 258 bool ResourceRequestInfoImpl::IsDownload() const {
247 return is_download_; 259 return is_download_;
248 } 260 }
249 261
250 void ResourceRequestInfoImpl::AssociateWithRequest(net::URLRequest* request) { 262 void ResourceRequestInfoImpl::AssociateWithRequest(net::URLRequest* request) {
251 request->SetUserData(NULL, this); 263 request->SetUserData(NULL, this);
252 int render_process_id; 264 int render_process_id;
253 int render_frame_id; 265 int render_frame_id;
254 if (GetAssociatedRenderFrame(&render_process_id, &render_frame_id)) { 266 if (GetAssociatedRenderFrame(&render_process_id, &render_frame_id)) {
255 request->SetUserData( 267 request->SetUserData(
(...skipping 19 matching lines...) Expand all
275 base::WeakPtr<ResourceMessageFilter> filter) { 287 base::WeakPtr<ResourceMessageFilter> filter) {
276 child_id_ = child_id; 288 child_id_ = child_id;
277 route_id_ = route_id; 289 route_id_ = route_id;
278 origin_pid_ = origin_pid; 290 origin_pid_ = origin_pid;
279 request_id_ = request_id; 291 request_id_ = request_id;
280 parent_render_frame_id_ = parent_render_frame_id; 292 parent_render_frame_id_ = parent_render_frame_id;
281 filter_ = filter; 293 filter_ = filter;
282 } 294 }
283 295
284 } // namespace content 296 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698