| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/common/resource_dispatcher.h" | 7 #include "chrome/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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 | 335 |
| 336 void ResourceDispatcher::OnReceivedData(int request_id, | 336 void ResourceDispatcher::OnReceivedData(int request_id, |
| 337 base::SharedMemoryHandle shm_handle, | 337 base::SharedMemoryHandle shm_handle, |
| 338 int data_len) { | 338 int data_len) { |
| 339 // Acknowlegde the reception of this data. | 339 // Acknowlegde the reception of this data. |
| 340 IPC::Message::Sender* sender = message_sender(); | 340 IPC::Message::Sender* sender = message_sender(); |
| 341 if (sender) | 341 if (sender) |
| 342 sender->Send( | 342 sender->Send( |
| 343 new ViewHostMsg_DataReceived_ACK(MSG_ROUTING_NONE, request_id)); | 343 new ViewHostMsg_DataReceived_ACK(MSG_ROUTING_NONE, request_id)); |
| 344 | 344 |
| 345 DCHECK((shm_handle && data_len > 0) || (!shm_handle && !data_len)); | 345 const bool shm_valid = base::SharedMemory::IsHandleValid(shm_handle); |
| 346 DCHECK((shm_valid && data_len > 0) || (!shm_valid && !data_len)); |
| 346 base::SharedMemory shared_mem(shm_handle, true); // read only | 347 base::SharedMemory shared_mem(shm_handle, true); // read only |
| 347 | 348 |
| 348 PendingRequestList::iterator it = pending_requests_.find(request_id); | 349 PendingRequestList::iterator it = pending_requests_.find(request_id); |
| 349 if (it == pending_requests_.end()) { | 350 if (it == pending_requests_.end()) { |
| 350 // this might happen for kill()ed requests on the webkit end, so perhaps | 351 // this might happen for kill()ed requests on the webkit end, so perhaps |
| 351 // it shouldn't be a warning... | 352 // it shouldn't be a warning... |
| 352 DLOG(WARNING) << "Got data for a nonexistant or finished request"; | 353 DLOG(WARNING) << "Got data for a nonexistant or finished request"; |
| 353 return; | 354 return; |
| 354 } | 355 } |
| 355 | 356 |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 case ViewMsg_Resource_RequestComplete::ID: | 512 case ViewMsg_Resource_RequestComplete::ID: |
| 512 return true; | 513 return true; |
| 513 | 514 |
| 514 default: | 515 default: |
| 515 break; | 516 break; |
| 516 } | 517 } |
| 517 | 518 |
| 518 return false; | 519 return false; |
| 519 } | 520 } |
| 520 | 521 |
| OLD | NEW |