summaryrefslogtreecommitdiffstats
path: root/chrome/browser/net
diff options
context:
space:
mode:
authoreroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-10 01:23:24 +0000
committereroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-10 01:23:24 +0000
commit3fa65fc215c6b5c0a4f71db51627d24d6dff5188 (patch)
tree78a67cb18bbcc431c2d681d4ad5774288b9bc764 /chrome/browser/net
parent0a30dea444313d860a430f99ebdc67546810d7ff (diff)
downloadchromium_src-3fa65fc215c6b5c0a4f71db51627d24d6dff5188.zip
chromium_src-3fa65fc215c6b5c0a4f71db51627d24d6dff5188.tar.gz
chromium_src-3fa65fc215c6b5c0a4f71db51627d24d6dff5188.tar.bz2
Add instrumentation to track down a crash.
Promotes some DCHECKs to CHECKs, to figure out who is calling URLFetcher::Start() without having first set a valid request context. Also adds a |was_cancelled_| variable to rule out that Start() isn't called after the request was already cancelled. This change can be reverted once we get the data. BUG=27074 Review URL: http://codereview.chromium.org/377041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31526 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net')
-rw-r--r--chrome/browser/net/url_fetcher.cc15
1 files changed, 12 insertions, 3 deletions
diff --git a/chrome/browser/net/url_fetcher.cc b/chrome/browser/net/url_fetcher.cc
index 600fb73..563b5ff 100644
--- a/chrome/browser/net/url_fetcher.cc
+++ b/chrome/browser/net/url_fetcher.cc
@@ -95,6 +95,11 @@ class URLFetcher::Core
// specified by the protection manager, we'll give up.
int num_retries_;
+ // Temporary member variable to test whether requests are being started
+ // after they have already been cancelled.
+ // TODO(eroman): Remove this after done investigating 27074.
+ bool was_cancelled_;
+
friend class URLFetcher;
DISALLOW_COPY_AND_ASSIGN(Core);
};
@@ -135,12 +140,13 @@ URLFetcher::Core::Core(URLFetcher* fetcher,
buffer_(new net::IOBuffer(kBufferSize)),
protect_entry_(URLFetcherProtectManager::GetInstance()->Register(
original_url_.host())),
- num_retries_(0) {
+ num_retries_(0),
+ was_cancelled_(false) {
}
void URLFetcher::Core::Start() {
DCHECK(delegate_loop_);
- DCHECK(request_context_getter_) << "We need an URLRequestContext!";
+ CHECK(request_context_getter_) << "We need an URLRequestContext!";
ChromeThread::PostDelayedTask(
ChromeThread::IO, FROM_HERE,
NewRunnableMethod(this, &Core::StartURLRequest),
@@ -199,7 +205,9 @@ void URLFetcher::Core::OnReadCompleted(URLRequest* request, int bytes_read) {
void URLFetcher::Core::StartURLRequest() {
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
- DCHECK(!request_);
+ CHECK(!was_cancelled_);
+ CHECK(request_context_getter_);
+ CHECK(!request_);
request_ = new URLRequest(original_url_, this);
int flags = request_->load_flags() | load_flags_;
@@ -252,6 +260,7 @@ void URLFetcher::Core::CancelURLRequest() {
// delete the object, but we cannot delay the destruction of the request
// context.
request_context_getter_ = NULL;
+ was_cancelled_ = true;
}
void URLFetcher::Core::OnCompletedURLRequest(const URLRequestStatus& status) {