summaryrefslogtreecommitdiffstats
path: root/chrome/browser/dom_ui
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-06 18:31:42 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-06 18:31:42 +0000
commitedb7a3f0bbc8d0de72757c883023d0fcdf180986 (patch)
treed43ce3a16c229af42a911c99e7470f5ebb41a607 /chrome/browser/dom_ui
parentae46ab8546f732b80e70a59b3806cc899cd21316 (diff)
downloadchromium_src-edb7a3f0bbc8d0de72757c883023d0fcdf180986.zip
chromium_src-edb7a3f0bbc8d0de72757c883023d0fcdf180986.tar.gz
chromium_src-edb7a3f0bbc8d0de72757c883023d0fcdf180986.tar.bz2
Reapply r19950. Turns out it wasn't at fault for breaking the vista tests.
This reverts commit 6c6d8665c114217a14fea346cca97006e4c3daa7. BUG=none TEST=none TBR=nsylvain Review URL: http://codereview.chromium.org/155097 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19961 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/dom_ui')
-rw-r--r--chrome/browser/dom_ui/chrome_url_data_manager.cc13
-rw-r--r--chrome/browser/dom_ui/chrome_url_data_manager.h5
2 files changed, 18 insertions, 0 deletions
diff --git a/chrome/browser/dom_ui/chrome_url_data_manager.cc b/chrome/browser/dom_ui/chrome_url_data_manager.cc
index ff4fa9f..2537a12 100644
--- a/chrome/browser/dom_ui/chrome_url_data_manager.cc
+++ b/chrome/browser/dom_ui/chrome_url_data_manager.cc
@@ -199,6 +199,16 @@ void ChromeURLDataManager::RemoveFileSource(const std::string& source_name) {
file_sources_.erase(source_name);
}
+bool ChromeURLDataManager::HasPendingJob(URLRequestChromeJob* job) const {
+ for (PendingRequestMap::const_iterator i = pending_requests_.begin();
+ i != pending_requests_.end(); ++i) {
+ if (i->second == job)
+ return true;
+ }
+
+ return false;
+}
+
bool ChromeURLDataManager::StartRequest(const GURL& url,
URLRequestChromeJob* job) {
// Parse the URL into a request for a source and path.
@@ -293,6 +303,7 @@ URLRequestChromeJob::URLRequestChromeJob(URLRequest* request)
: URLRequestJob(request), data_offset_(0) {}
URLRequestChromeJob::~URLRequestChromeJob() {
+ CHECK(!chrome_url_data_manager.HasPendingJob(this));
}
void URLRequestChromeJob::Start() {
@@ -320,6 +331,7 @@ void URLRequestChromeJob::DataAvailable(RefCountedBytes* bytes) {
data_ = bytes;
int bytes_read;
if (pending_buf_.get()) {
+ CHECK(pending_buf_->data());
CompleteRead(pending_buf_, pending_buf_size_, &bytes_read);
pending_buf_ = NULL;
NotifyReadComplete(bytes_read);
@@ -335,6 +347,7 @@ bool URLRequestChromeJob::ReadRawData(net::IOBuffer* buf, int buf_size,
if (!data_.get()) {
SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0));
DCHECK(!pending_buf_.get());
+ CHECK(buf->data());
pending_buf_ = buf;
pending_buf_size_ = buf_size;
return false; // Tell the caller we're still waiting for data.
diff --git a/chrome/browser/dom_ui/chrome_url_data_manager.h b/chrome/browser/dom_ui/chrome_url_data_manager.h
index f11045c..49e8fd1 100644
--- a/chrome/browser/dom_ui/chrome_url_data_manager.h
+++ b/chrome/browser/dom_ui/chrome_url_data_manager.h
@@ -112,6 +112,11 @@ private:
// Remove a request from the list of pending requests.
void RemoveRequest(URLRequestChromeJob* job);
+ // Returns true if the job exists in |pending_requests_|. False otherwise.
+ // Called by ~URLRequestChromeJob to verify that |pending_requests_| is kept
+ // up to date.
+ bool HasPendingJob(URLRequestChromeJob* job) const;
+
// Sent by Request::SendResponse.
void DataAvailable(RequestID request_id,
scoped_refptr<RefCountedBytes> bytes);