Chromium Code Reviews| 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/dom_ui/chrome_url_data_manager.h" | 5 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 224 } | 224 } |
| 225 } | 225 } |
| 226 } | 226 } |
| 227 | 227 |
| 228 void ChromeURLDataManager::DataAvailable( | 228 void ChromeURLDataManager::DataAvailable( |
| 229 RequestID request_id, | 229 RequestID request_id, |
| 230 scoped_refptr<RefCountedBytes> bytes) { | 230 scoped_refptr<RefCountedBytes> bytes) { |
| 231 // Forward this data on to the pending URLRequest, if it exists. | 231 // Forward this data on to the pending URLRequest, if it exists. |
| 232 PendingRequestMap::iterator i = pending_requests_.find(request_id); | 232 PendingRequestMap::iterator i = pending_requests_.find(request_id); |
| 233 if (i != pending_requests_.end()) { | 233 if (i != pending_requests_.end()) { |
| 234 URLRequestChromeJob* job = i->second; | 234 scoped_refptr<URLRequestChromeJob> job = i->second; |
| 235 pending_requests_.erase(i); | 235 pending_requests_.erase(i); |
| 236 job->DataAvailable(bytes); | 236 job->DataAvailable(bytes); |
| 237 } | 237 } |
| 238 } | 238 } |
| 239 | 239 |
| 240 void ChromeURLDataManager::DataSource::SendResponse( | 240 void ChromeURLDataManager::DataSource::SendResponse( |
| 241 RequestID request_id, | 241 RequestID request_id, |
| 242 RefCountedBytes* bytes) { | 242 RefCountedBytes* bytes) { |
| 243 g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE, | 243 g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE, |
| 244 NewRunnableMethod(&chrome_url_data_manager, | 244 NewRunnableMethod(&chrome_url_data_manager, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 284 void URLRequestChromeJob::DataAvailable(RefCountedBytes* bytes) { | 284 void URLRequestChromeJob::DataAvailable(RefCountedBytes* bytes) { |
| 285 if (bytes) { | 285 if (bytes) { |
| 286 // The request completed, and we have all the data. | 286 // The request completed, and we have all the data. |
| 287 // Clear any IO pending status. | 287 // Clear any IO pending status. |
| 288 SetStatus(URLRequestStatus()); | 288 SetStatus(URLRequestStatus()); |
| 289 | 289 |
| 290 data_ = bytes; | 290 data_ = bytes; |
| 291 int bytes_read; | 291 int bytes_read; |
| 292 if (pending_buf_.get()) { | 292 if (pending_buf_.get()) { |
| 293 CompleteRead(pending_buf_, pending_buf_size_, &bytes_read); | 293 CompleteRead(pending_buf_, pending_buf_size_, &bytes_read); |
| 294 pending_buf_ = NULL; | |
|
darin (slow to review)
2009/02/09 22:49:15
so this part of the change is no longer needed rig
rvargas (doing something else)
2009/02/09 23:01:52
Correct, it's not really needed but now I sort of
| |
| 294 NotifyReadComplete(bytes_read); | 295 NotifyReadComplete(bytes_read); |
| 295 pending_buf_ = NULL; | |
| 296 } | 296 } |
| 297 } else { | 297 } else { |
| 298 // The request failed. | 298 // The request failed. |
| 299 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, 0)); | 299 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, 0)); |
| 300 } | 300 } |
| 301 } | 301 } |
| 302 | 302 |
| 303 bool URLRequestChromeJob::ReadRawData(net::IOBuffer* buf, int buf_size, | 303 bool URLRequestChromeJob::ReadRawData(net::IOBuffer* buf, int buf_size, |
| 304 int* bytes_read) { | 304 int* bytes_read) { |
| 305 if (!data_.get()) { | 305 if (!data_.get()) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 339 } | 339 } |
| 340 } | 340 } |
| 341 | 341 |
| 342 URLRequestChromeFileJob::URLRequestChromeFileJob(URLRequest* request, | 342 URLRequestChromeFileJob::URLRequestChromeFileJob(URLRequest* request, |
| 343 const FilePath& path) | 343 const FilePath& path) |
| 344 : URLRequestFileJob(request, path) { | 344 : URLRequestFileJob(request, path) { |
| 345 } | 345 } |
| 346 | 346 |
| 347 URLRequestChromeFileJob::~URLRequestChromeFileJob() { } | 347 URLRequestChromeFileJob::~URLRequestChromeFileJob() { } |
| 348 | 348 |
| OLD | NEW |