Commit b29700d0 authored by apatrick@chromium.org's avatar apatrick@chromium.org

Store information about invoked RunnableFunction on stack to aid debugging of...

Store information about invoked RunnableFunction on stack to aid debugging of canary channel crashes.

TEST=compiles
BUG=81449
Review URL: http://codereview.chromium.org/7066006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86447 0039d316-1c4b-4281-b951-d872f2087c98
parent bddd0bd5
...@@ -6,13 +6,15 @@ ...@@ -6,13 +6,15 @@
#define BASE_DEBUG_ALIAS_H_ #define BASE_DEBUG_ALIAS_H_
#pragma once #pragma once
#include "base/base_api.h"
namespace base { namespace base {
namespace debug { namespace debug {
// Make the optimizer think that var is aliased. This is to prevent it from // Make the optimizer think that var is aliased. This is to prevent it from
// optimizing out variables that that would not otherwise be live at the point // optimizing out variables that that would not otherwise be live at the point
// of a potential crash. // of a potential crash.
void Alias(const void* var); void BASE_API Alias(const void* var);
} // namespace debug } // namespace debug
} // namespace base } // namespace base
......
...@@ -7,11 +7,16 @@ ...@@ -7,11 +7,16 @@
#pragma once #pragma once
#include "base/base_api.h" #include "base/base_api.h"
#include "base/debug/alias.h"
#include "base/memory/raw_scoped_refptr_mismatch_checker.h" #include "base/memory/raw_scoped_refptr_mismatch_checker.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/tracked.h" #include "base/tracked.h"
#include "base/tuple.h" #include "base/tuple.h"
namespace base {
const size_t kDeadTask = 0xDEAD7A53;
}
// Task ------------------------------------------------------------------------ // Task ------------------------------------------------------------------------
// //
// A task is a generic runnable thingy, usually used for running code on a // A task is a generic runnable thingy, usually used for running code on a
...@@ -325,6 +330,7 @@ class RunnableMethod : public CancelableTask { ...@@ -325,6 +330,7 @@ class RunnableMethod : public CancelableTask {
~RunnableMethod() { ~RunnableMethod() {
ReleaseCallee(); ReleaseCallee();
obj_ = reinterpret_cast<T*>(base::kDeadTask);
} }
virtual void Run() { virtual void Run() {
...@@ -452,9 +458,18 @@ class RunnableFunction : public Task { ...@@ -452,9 +458,18 @@ class RunnableFunction : public Task {
} }
~RunnableFunction() { ~RunnableFunction() {
function_ = reinterpret_cast<Function>(base::kDeadTask);
} }
virtual void Run() { virtual void Run() {
// TODO(apatrick): Remove this ASAP. This ensures that the function pointer
// is available in minidumps for the purpose of diagnosing
// http://crbug.com/81449.
Function function = function_;
base::debug::Alias(&function);
Params params = params_;
base::debug::Alias(&params);
if (function_) if (function_)
DispatchToFunction(function_, params_); DispatchToFunction(function_, params_);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment