summaryrefslogtreecommitdiffstats
path: root/chrome/browser/dom_ui
diff options
context:
space:
mode:
authorrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-24 02:39:54 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-24 02:39:54 +0000
commite993abfe81feaa374d476828a44942d296bdcc78 (patch)
tree201fffef0ba93ce41afaf2bd6e61e05b61c04028 /chrome/browser/dom_ui
parent0afe80d755b899c188313629ea3f45f0fe5be981 (diff)
downloadchromium_src-e993abfe81feaa374d476828a44942d296bdcc78.zip
chromium_src-e993abfe81feaa374d476828a44942d296bdcc78.tar.gz
chromium_src-e993abfe81feaa374d476828a44942d296bdcc78.tar.bz2
revert r8603
Review URL: http://codereview.chromium.org/18576 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8605 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/dom_ui')
-rw-r--r--chrome/browser/dom_ui/chrome_url_data_manager.cc18
1 files changed, 8 insertions, 10 deletions
diff --git a/chrome/browser/dom_ui/chrome_url_data_manager.cc b/chrome/browser/dom_ui/chrome_url_data_manager.cc
index ce533dd..a180280 100644
--- a/chrome/browser/dom_ui/chrome_url_data_manager.cc
+++ b/chrome/browser/dom_ui/chrome_url_data_manager.cc
@@ -42,7 +42,7 @@ class URLRequestChromeJob : public URLRequestJob {
// URLRequestJob implementation.
virtual void Start();
virtual void Kill();
- virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, int *bytes_read);
+ virtual bool ReadRawData(char* buf, int buf_size, int *bytes_read);
virtual bool GetMimeType(std::string* mime_type);
// Called by ChromeURLDataManager to notify us that the data blob is ready
@@ -60,7 +60,7 @@ class URLRequestChromeJob : public URLRequestJob {
// Do the actual copy from data_ (the data we're serving) into |buf|.
// Separate from ReadRawData so we can handle async I/O.
- void CompleteRead(net::IOBuffer* buf, int buf_size, int* bytes_read);
+ void CompleteRead(char* buf, int buf_size, int* bytes_read);
// The actual data we're serving. NULL until it's been fetched.
scoped_refptr<RefCountedBytes> data_;
@@ -70,7 +70,7 @@ class URLRequestChromeJob : public URLRequestJob {
// For async reads, we keep around a pointer to the buffer that
// we're reading into.
- scoped_refptr<net::IOBuffer> pending_buf_;
+ char* pending_buf_;
int pending_buf_size_;
std::string mime_type_;
@@ -249,7 +249,7 @@ URLRequestJob* ChromeURLDataManager::Factory(URLRequest* request,
}
URLRequestChromeJob::URLRequestChromeJob(URLRequest* request)
- : URLRequestJob(request), data_offset_(0) {}
+ : URLRequestJob(request), data_offset_(0), pending_buf_(NULL) {}
URLRequestChromeJob::~URLRequestChromeJob() {
}
@@ -278,10 +278,9 @@ void URLRequestChromeJob::DataAvailable(RefCountedBytes* bytes) {
data_ = bytes;
int bytes_read;
- if (pending_buf_.get()) {
+ if (pending_buf_) {
CompleteRead(pending_buf_, pending_buf_size_, &bytes_read);
NotifyReadComplete(bytes_read);
- pending_buf_ = NULL;
}
} else {
// The request failed.
@@ -289,11 +288,10 @@ void URLRequestChromeJob::DataAvailable(RefCountedBytes* bytes) {
}
}
-bool URLRequestChromeJob::ReadRawData(net::IOBuffer* buf, int buf_size,
+bool URLRequestChromeJob::ReadRawData(char* buf, int buf_size,
int* bytes_read) {
if (!data_.get()) {
SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0));
- DCHECK(!pending_buf_.get());
pending_buf_ = buf;
pending_buf_size_ = buf_size;
return false; // Tell the caller we're still waiting for data.
@@ -304,13 +302,13 @@ bool URLRequestChromeJob::ReadRawData(net::IOBuffer* buf, int buf_size,
return true;
}
-void URLRequestChromeJob::CompleteRead(net::IOBuffer* buf, int buf_size,
+void URLRequestChromeJob::CompleteRead(char* buf, int buf_size,
int* bytes_read) {
int remaining = static_cast<int>(data_->data.size()) - data_offset_;
if (buf_size > remaining)
buf_size = remaining;
if (buf_size > 0) {
- memcpy(buf->data(), &data_->data[0] + data_offset_, buf_size);
+ memcpy(buf, &data_->data[0] + data_offset_, buf_size);
data_offset_ += buf_size;
}
*bytes_read = buf_size;