diff options
-rw-r--r-- | base/debug/stack_trace_android.cc | 5 | ||||
-rw-r--r-- | content/common/net/url_fetcher_core.cc | 1 | ||||
-rw-r--r-- | content/common/net/url_fetcher_core.h | 4 | ||||
-rw-r--r-- | net/url_request/url_request.cc | 12 | ||||
-rw-r--r-- | net/url_request/url_request.h | 14 | ||||
-rw-r--r-- | net/url_request/url_request_context.cc | 5 |
6 files changed, 40 insertions, 1 deletions
diff --git a/base/debug/stack_trace_android.cc b/base/debug/stack_trace_android.cc index 2ccf406..c3db4c8 100644 --- a/base/debug/stack_trace_android.cc +++ b/base/debug/stack_trace_android.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -16,6 +16,9 @@ namespace debug { StackTrace::StackTrace() { } +StackTrace::StackTrace(const void* const* trace, size_t count) { +} + StackTrace::~StackTrace() { } diff --git a/content/common/net/url_fetcher_core.cc b/content/common/net/url_fetcher_core.cc index a96c5da..07b060f 100644 --- a/content/common/net/url_fetcher_core.cc +++ b/content/common/net/url_fetcher_core.cc @@ -724,6 +724,7 @@ void URLFetcherCore::StartURLRequest() { g_registry.Get().AddURLFetcherCore(this); current_response_bytes_ = 0; request_.reset(new net::URLRequest(original_url_, this)); + request_->set_stack_trace(stack_trace_); int flags = request_->load_flags() | load_flags_; if (!g_interception_enabled) flags = flags | net::LOAD_DISABLE_INTERCEPT; diff --git a/content/common/net/url_fetcher_core.h b/content/common/net/url_fetcher_core.h index 387c75c..6578569 100644 --- a/content/common/net/url_fetcher_core.h +++ b/content/common/net/url_fetcher_core.h @@ -12,6 +12,7 @@ #include "base/basictypes.h" #include "base/callback_forward.h" #include "base/compiler_specific.h" +#include "base/debug/stack_trace.h" #include "base/file_path.h" #include "base/lazy_instance.h" #include "base/memory/ref_counted.h" @@ -394,6 +395,9 @@ class URLFetcherCore // Total expected bytes to receive (-1 if it cannot be determined). int64 total_response_bytes_; + // TODO(willchan): Get rid of this after debugging crbug.com/90971. + base::debug::StackTrace stack_trace_; + static base::LazyInstance<Registry> g_registry; DISALLOW_COPY_AND_ASSIGN(URLFetcherCore); 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); } } |