| 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 #include "chrome/browser/renderer_host/async_resource_handler.h" | 5 #include "chrome/browser/renderer_host/async_resource_handler.h" |
| 6 | 6 |
| 7 #include "base/process.h" | 7 #include "base/process.h" |
| 8 #include "base/shared_memory.h" | 8 #include "base/shared_memory.h" |
| 9 #include "chrome/common/render_messages.h" | 9 #include "chrome/common/render_messages.h" |
| 10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 } | 109 } |
| 110 // We just unmapped the memory. | 110 // We just unmapped the memory. |
| 111 read_buffer_ = NULL; | 111 read_buffer_ = NULL; |
| 112 | 112 |
| 113 receiver_->Send(new ViewMsg_Resource_DataReceived( | 113 receiver_->Send(new ViewMsg_Resource_DataReceived( |
| 114 routing_id_, request_id, handle, *bytes_read)); | 114 routing_id_, request_id, handle, *bytes_read)); |
| 115 | 115 |
| 116 return true; | 116 return true; |
| 117 } | 117 } |
| 118 | 118 |
| 119 bool AsyncResourceHandler::OnResponseCompleted(int request_id, | 119 bool AsyncResourceHandler::OnResponseCompleted( |
| 120 const URLRequestStatus& status) { | 120 int request_id, |
| 121 const URLRequestStatus& status, |
| 122 const std::string& security_info) { |
| 121 receiver_->Send(new ViewMsg_Resource_RequestComplete(routing_id_, | 123 receiver_->Send(new ViewMsg_Resource_RequestComplete(routing_id_, |
| 122 request_id, status)); | 124 request_id, |
| 125 status, |
| 126 security_info)); |
| 123 | 127 |
| 124 // If we still have a read buffer, then see about caching it for later... | 128 // If we still have a read buffer, then see about caching it for later... |
| 125 if (spare_read_buffer_) { | 129 if (spare_read_buffer_) { |
| 126 read_buffer_ = NULL; | 130 read_buffer_ = NULL; |
| 127 } else if (read_buffer_.get()) { | 131 } else if (read_buffer_.get()) { |
| 128 read_buffer_.swap(&spare_read_buffer_); | 132 read_buffer_.swap(&spare_read_buffer_); |
| 129 } | 133 } |
| 130 return true; | 134 return true; |
| 131 } | 135 } |
| 132 | 136 |
| 133 // static | 137 // static |
| 134 void AsyncResourceHandler::GlobalCleanup() { | 138 void AsyncResourceHandler::GlobalCleanup() { |
| 135 if (spare_read_buffer_) { | 139 if (spare_read_buffer_) { |
| 136 spare_read_buffer_->Release(); | 140 spare_read_buffer_->Release(); |
| 137 spare_read_buffer_ = NULL; | 141 spare_read_buffer_ = NULL; |
| 138 } | 142 } |
| 139 } | 143 } |
| OLD | NEW |