| OLD | NEW |
| 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 #include "content/child/resource_dispatcher.h" | 7 #include "content/child/resource_dispatcher.h" |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 RequestPeer* new_peer = | 154 RequestPeer* new_peer = |
| 155 delegate_->OnReceivedResponse( | 155 delegate_->OnReceivedResponse( |
| 156 request_info->peer, response_head.mime_type, request_info->url); | 156 request_info->peer, response_head.mime_type, request_info->url); |
| 157 if (new_peer) | 157 if (new_peer) |
| 158 request_info->peer = new_peer; | 158 request_info->peer = new_peer; |
| 159 } | 159 } |
| 160 | 160 |
| 161 ResourceResponseInfo renderer_response_info; | 161 ResourceResponseInfo renderer_response_info; |
| 162 ToResourceResponseInfo(*request_info, response_head, &renderer_response_info); | 162 ToResourceResponseInfo(*request_info, response_head, &renderer_response_info); |
| 163 request_info->site_isolation_metadata = | 163 request_info->site_isolation_metadata = |
| 164 SiteIsolationPolicy::OnReceivedResponse(request_info->frame_origin, | 164 SiteIsolationStatsGatherer::OnReceivedResponse( |
| 165 request_info->response_url, | 165 request_info->frame_origin, request_info->response_url, |
| 166 request_info->resource_type, | 166 request_info->resource_type, request_info->origin_pid, |
| 167 request_info->origin_pid, | 167 renderer_response_info); |
| 168 renderer_response_info); | |
| 169 request_info->peer->OnReceivedResponse(renderer_response_info); | 168 request_info->peer->OnReceivedResponse(renderer_response_info); |
| 170 } | 169 } |
| 171 | 170 |
| 172 void ResourceDispatcher::OnReceivedCachedMetadata( | 171 void ResourceDispatcher::OnReceivedCachedMetadata( |
| 173 int request_id, const std::vector<char>& data) { | 172 int request_id, const std::vector<char>& data) { |
| 174 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); | 173 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); |
| 175 if (!request_info) | 174 if (!request_info) |
| 176 return; | 175 return; |
| 177 | 176 |
| 178 if (data.size()) | 177 if (data.size()) |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 base::TimeTicks time_start = base::TimeTicks::Now(); | 233 base::TimeTicks time_start = base::TimeTicks::Now(); |
| 235 | 234 |
| 236 const char* data_start = static_cast<char*>(request_info->buffer->memory()); | 235 const char* data_start = static_cast<char*>(request_info->buffer->memory()); |
| 237 CHECK(data_start); | 236 CHECK(data_start); |
| 238 CHECK(data_start + data_offset); | 237 CHECK(data_start + data_offset); |
| 239 const char* data_ptr = data_start + data_offset; | 238 const char* data_ptr = data_start + data_offset; |
| 240 | 239 |
| 241 // Check whether this response data is compliant with our cross-site | 240 // Check whether this response data is compliant with our cross-site |
| 242 // document blocking policy. We only do this for the first chunk of data. | 241 // document blocking policy. We only do this for the first chunk of data. |
| 243 if (request_info->site_isolation_metadata.get()) { | 242 if (request_info->site_isolation_metadata.get()) { |
| 244 SiteIsolationPolicy::OnReceivedFirstChunk( | 243 SiteIsolationStatsGatherer::OnReceivedFirstChunk( |
| 245 request_info->site_isolation_metadata, data_ptr, data_length); | 244 request_info->site_isolation_metadata, data_ptr, data_length); |
| 246 request_info->site_isolation_metadata.reset(); | 245 request_info->site_isolation_metadata.reset(); |
| 247 } | 246 } |
| 248 | 247 |
| 249 if (request_info->threaded_data_provider) { | 248 if (request_info->threaded_data_provider) { |
| 250 // A threaded data provider will take care of its own ACKing, as the data | 249 // A threaded data provider will take care of its own ACKing, as the data |
| 251 // may be processed later on another thread. | 250 // may be processed later on another thread. |
| 252 send_ack = false; | 251 send_ack = false; |
| 253 request_info->threaded_data_provider->OnReceivedDataOnForegroundThread( | 252 request_info->threaded_data_provider->OnReceivedDataOnForegroundThread( |
| 254 data_ptr, data_length, encoded_data_length); | 253 data_ptr, data_length, encoded_data_length); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 ResourceResponseInfo renderer_response_info; | 294 ResourceResponseInfo renderer_response_info; |
| 296 ToResourceResponseInfo(*request_info, response_head, &renderer_response_info); | 295 ToResourceResponseInfo(*request_info, response_head, &renderer_response_info); |
| 297 if (request_info->peer->OnReceivedRedirect(redirect_info, | 296 if (request_info->peer->OnReceivedRedirect(redirect_info, |
| 298 renderer_response_info)) { | 297 renderer_response_info)) { |
| 299 // Double-check if the request is still around. The call above could | 298 // Double-check if the request is still around. The call above could |
| 300 // potentially remove it. | 299 // potentially remove it. |
| 301 request_info = GetPendingRequestInfo(request_id); | 300 request_info = GetPendingRequestInfo(request_id); |
| 302 if (!request_info) | 301 if (!request_info) |
| 303 return; | 302 return; |
| 304 // We update the response_url here so that we can send it to | 303 // We update the response_url here so that we can send it to |
| 305 // SiteIsolationPolicy later when OnReceivedResponse is called. | 304 // SiteIsolationStatsGatherer later when OnReceivedResponse is called. |
| 306 request_info->response_url = redirect_info.new_url; | 305 request_info->response_url = redirect_info.new_url; |
| 307 request_info->pending_redirect_message.reset( | 306 request_info->pending_redirect_message.reset( |
| 308 new ResourceHostMsg_FollowRedirect(request_id)); | 307 new ResourceHostMsg_FollowRedirect(request_id)); |
| 309 if (!request_info->is_deferred) { | 308 if (!request_info->is_deferred) { |
| 310 FollowPendingRedirect(request_id, *request_info); | 309 FollowPendingRedirect(request_id, *request_info); |
| 311 } | 310 } |
| 312 } else { | 311 } else { |
| 313 Cancel(request_id); | 312 Cancel(request_id); |
| 314 } | 313 } |
| 315 } | 314 } |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 extra_data->transferred_request_request_id(); | 788 extra_data->transferred_request_request_id(); |
| 790 request->service_worker_provider_id = | 789 request->service_worker_provider_id = |
| 791 extra_data->service_worker_provider_id(); | 790 extra_data->service_worker_provider_id(); |
| 792 request->request_body = request_body; | 791 request->request_body = request_body; |
| 793 if (frame_origin) | 792 if (frame_origin) |
| 794 *frame_origin = extra_data->frame_origin(); | 793 *frame_origin = extra_data->frame_origin(); |
| 795 return request.Pass(); | 794 return request.Pass(); |
| 796 } | 795 } |
| 797 | 796 |
| 798 } // namespace content | 797 } // namespace content |
| OLD | NEW |