| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/common/resource_dispatcher.h" | 7 #include "content/common/resource_dispatcher.h" |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 return; | 205 return; |
| 206 } | 206 } |
| 207 | 207 |
| 208 response->status = result.status; | 208 response->status = result.status; |
| 209 response->url = result.final_url; | 209 response->url = result.final_url; |
| 210 response->headers = result.headers; | 210 response->headers = result.headers; |
| 211 response->mime_type = result.mime_type; | 211 response->mime_type = result.mime_type; |
| 212 response->charset = result.charset; | 212 response->charset = result.charset; |
| 213 response->request_time = result.request_time; | 213 response->request_time = result.request_time; |
| 214 response->response_time = result.response_time; | 214 response->response_time = result.response_time; |
| 215 response->raw_data_length = result.raw_data_length; |
| 215 response->connection_id = result.connection_id; | 216 response->connection_id = result.connection_id; |
| 216 response->connection_reused = result.connection_reused; | 217 response->connection_reused = result.connection_reused; |
| 217 response->load_timing = result.load_timing; | 218 response->load_timing = result.load_timing; |
| 218 response->devtools_info = result.devtools_info; | 219 response->devtools_info = result.devtools_info; |
| 219 response->data.swap(result.data); | 220 response->data.swap(result.data); |
| 220 response->download_file_path = result.download_file_path; | 221 response->download_file_path = result.download_file_path; |
| 221 } | 222 } |
| 222 | 223 |
| 223 } // namespace webkit_glue | 224 } // namespace webkit_glue |
| 224 | 225 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 if (!request_info) | 330 if (!request_info) |
| 330 return; | 331 return; |
| 331 | 332 |
| 332 if (data.size()) | 333 if (data.size()) |
| 333 request_info->peer->OnReceivedCachedMetadata(&data.front(), data.size()); | 334 request_info->peer->OnReceivedCachedMetadata(&data.front(), data.size()); |
| 334 } | 335 } |
| 335 | 336 |
| 336 void ResourceDispatcher::OnReceivedData(const IPC::Message& message, | 337 void ResourceDispatcher::OnReceivedData(const IPC::Message& message, |
| 337 int request_id, | 338 int request_id, |
| 338 base::SharedMemoryHandle shm_handle, | 339 base::SharedMemoryHandle shm_handle, |
| 339 int data_len) { | 340 int data_len, |
| 341 int raw_data_length) { |
| 340 // Acknowledge the reception of this data. | 342 // Acknowledge the reception of this data. |
| 341 message_sender()->Send( | 343 message_sender()->Send( |
| 342 new ResourceHostMsg_DataReceived_ACK(message.routing_id(), request_id)); | 344 new ResourceHostMsg_DataReceived_ACK(message.routing_id(), request_id)); |
| 343 | 345 |
| 344 const bool shm_valid = base::SharedMemory::IsHandleValid(shm_handle); | 346 const bool shm_valid = base::SharedMemory::IsHandleValid(shm_handle); |
| 345 DCHECK((shm_valid && data_len > 0) || (!shm_valid && !data_len)); | 347 DCHECK((shm_valid && data_len > 0) || (!shm_valid && !data_len)); |
| 346 base::SharedMemory shared_mem(shm_handle, true); // read only | 348 base::SharedMemory shared_mem(shm_handle, true); // read only |
| 347 | 349 |
| 348 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); | 350 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); |
| 349 if (!request_info) | 351 if (!request_info) |
| 350 return; | 352 return; |
| 351 | 353 |
| 352 if (data_len > 0 && shared_mem.Map(data_len)) { | 354 if (data_len > 0 && shared_mem.Map(data_len)) { |
| 353 const char* data = static_cast<char*>(shared_mem.memory()); | 355 const char* data = static_cast<char*>(shared_mem.memory()); |
| 354 request_info->peer->OnReceivedData(data, data_len); | 356 request_info->peer->OnReceivedData(data, data_len, raw_data_length); |
| 355 } | 357 } |
| 356 } | 358 } |
| 357 | 359 |
| 358 void ResourceDispatcher::OnDownloadedData(const IPC::Message& message, | 360 void ResourceDispatcher::OnDownloadedData(const IPC::Message& message, |
| 359 int request_id, | 361 int request_id, |
| 360 int data_len) { | 362 int data_len) { |
| 361 // Acknowledge the reception of this message. | 363 // Acknowledge the reception of this message. |
| 362 message_sender()->Send( | 364 message_sender()->Send( |
| 363 new ResourceHostMsg_DataDownloaded_ACK(message.routing_id(), request_id)); | 365 new ResourceHostMsg_DataDownloaded_ACK(message.routing_id(), request_id)); |
| 364 | 366 |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 | 586 |
| 585 // static | 587 // static |
| 586 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) { | 588 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) { |
| 587 while (!queue->empty()) { | 589 while (!queue->empty()) { |
| 588 IPC::Message* message = queue->front(); | 590 IPC::Message* message = queue->front(); |
| 589 ReleaseResourcesInDataMessage(*message); | 591 ReleaseResourcesInDataMessage(*message); |
| 590 queue->pop_front(); | 592 queue->pop_front(); |
| 591 delete message; | 593 delete message; |
| 592 } | 594 } |
| 593 } | 595 } |
| OLD | NEW |