summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-12 01:29:27 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-12 01:29:27 +0000
commit4eee045cef873bb481b5addc0abc8d0deac89604 (patch)
tree41be89706cc38780932a39e13e661bd6608274f2 /net
parent75de721b7a3aa1b97189dac543487cf06080ec42 (diff)
downloadchromium_src-4eee045cef873bb481b5addc0abc8d0deac89604.zip
chromium_src-4eee045cef873bb481b5addc0abc8d0deac89604.tar.gz
chromium_src-4eee045cef873bb481b5addc0abc8d0deac89604.tar.bz2
Add the StackTrace to the URLFetcher crash dumps.
This will help me in narrowing down which URLFetcher is leaking the URLRequest in these crashes. BUG= 90971,127860 TBR=eroman TEST=none Review URL: https://chromiumcodereview.appspot.com/10383145 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136736 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/url_request/url_request.cc12
-rw-r--r--net/url_request/url_request.h14
-rw-r--r--net/url_request/url_request_context.cc5
3 files changed, 31 insertions, 0 deletions
diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc
index c2c2c5e4..fef10fb 100644
--- a/net/url_request/url_request.cc
+++ b/net/url_request/url_request.cc
@@ -8,6 +8,7 @@
#include "base/bind_helpers.h"
#include "base/callback.h"
#include "base/compiler_specific.h"
+#include "base/debug/stack_trace.h"
#include "base/lazy_instance.h"
#include "base/memory/singleton.h"
#include "base/message_loop.h"
@@ -916,4 +917,15 @@ void URLRequest::SetUnblockedOnDelegate() {
net_log_.EndEvent(NetLog::TYPE_URL_REQUEST_BLOCKED_ON_DELEGATE, NULL);
}
+void URLRequest::set_stack_trace(const base::debug::StackTrace& stack_trace) {
+ base::debug::StackTrace* stack_trace_copy =
+ new base::debug::StackTrace(NULL, 0);
+ *stack_trace_copy = stack_trace;
+ stack_trace_.reset(stack_trace_copy);
+}
+
+const base::debug::StackTrace* URLRequest::stack_trace() const {
+ return stack_trace_.get();
+}
+
} // namespace net
diff --git a/net/url_request/url_request.h b/net/url_request/url_request.h
index df466d5..1bae37d 100644
--- a/net/url_request/url_request.h
+++ b/net/url_request/url_request.h
@@ -38,6 +38,12 @@ class TestAutomationProvider;
class URLRequestAutomationJob;
class UserScriptListenerTest;
+namespace base {
+namespace debug {
+class StackTrace;
+}
+}
+
// Temporary layering violation to allow existing users of a deprecated
// interface.
namespace appcache {
@@ -611,6 +617,12 @@ class NET_EXPORT URLRequest : NON_EXPORTED_BASE(public base::NonThreadSafe),
// TODO(willchan): Undo this. Only temporarily public.
bool has_delegate() const { return delegate_ != NULL; }
+ // NOTE(willchan): This is just temporary for debugging
+ // http://crbug.com/90971.
+ // Allows to setting debug info into the URLRequest.
+ void set_stack_trace(const base::debug::StackTrace& stack_trace);
+ const base::debug::StackTrace* stack_trace() const;
+
protected:
// Allow the URLRequestJob class to control the is_pending() flag.
void set_is_pending(bool value) { is_pending_ = value; }
@@ -788,6 +800,8 @@ class NET_EXPORT URLRequest : NON_EXPORTED_BASE(public base::NonThreadSafe),
base::TimeTicks creation_time_;
+ scoped_ptr<const base::debug::StackTrace> stack_trace_;
+
DISALLOW_COPY_AND_ASSIGN(URLRequest);
};
diff --git a/net/url_request/url_request_context.cc b/net/url_request/url_request_context.cc
index 105fcdc..40dad2b 100644
--- a/net/url_request/url_request_context.cc
+++ b/net/url_request/url_request_context.cc
@@ -6,6 +6,7 @@
#include "base/compiler_specific.h"
#include "base/debug/alias.h"
+#include "base/debug/stack_trace.h"
#include "base/string_util.h"
#include "net/base/host_resolver.h"
#include "net/cookies/cookie_store.h"
@@ -80,10 +81,14 @@ void URLRequestContext::AssertNoURLRequests() const {
base::strlcpy(url_buf, request->url().spec().c_str(), arraysize(url_buf));
bool has_delegate = request->has_delegate();
int load_flags = request->load_flags();
+ base::debug::StackTrace stack_trace(NULL, 0);
+ if (request->stack_trace())
+ stack_trace = *request->stack_trace();
base::debug::Alias(url_buf);
base::debug::Alias(&num_requests);
base::debug::Alias(&has_delegate);
base::debug::Alias(&load_flags);
+ base::debug::Alias(&stack_trace);
CHECK(false);
}
}