Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3103)

Unified Diff: base/prefs/pref_member.cc

Issue 290083006: Store a stacktrace of PrefService destruction in PrefChangeRegistrar (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor improvements Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: base/prefs/pref_member.cc
diff --git a/base/prefs/pref_member.cc b/base/prefs/pref_member.cc
index eb708394979964615eec8db0c9222ae0de220632..35cbf3a1a19861e5cccf3a710bb894cbfdb999a6 100644
--- a/base/prefs/pref_member.cc
+++ b/base/prefs/pref_member.cc
@@ -6,6 +6,8 @@
#include "base/callback.h"
#include "base/callback_helpers.h"
+// TODO(battre): Delete this. See crbug.com/373435.
+#include "base/debug/alias.h"
#include "base/location.h"
#include "base/prefs/pref_service.h"
#include "base/value_conversions.h"
@@ -47,6 +49,21 @@ void PrefMemberBase::Init(const char* pref_name,
void PrefMemberBase::Destroy() {
if (prefs_ && !pref_name_.empty()) {
+ // TODO(battre): Delete this. See crbug.com/373435.
+ if (!pref_service_destruction_.empty()) {
+ // The PrefService is already destroyed, so the following call to
+ // service_->RemovePrefObserver would crash anyway. When the PrefService
+ // was destroyed, it stored a stacktrack of the destruction in
+ // pref_service_destruction_. We save this on the stack in the minidump to
+ // understand what happens.
+ char tmp[2048];
+ const int copy =
+ std::min<int>(sizeof(tmp) - 1, pref_service_destruction_.length());
+ memcpy(tmp, pref_service_destruction_.c_str(), copy);
+ tmp[copy] = '\0';
+ base::debug::Alias(tmp);
+ CHECK(false) << tmp;
+ }
prefs_->RemovePrefObserver(pref_name_.c_str(), this);
prefs_ = NULL;
}
@@ -68,6 +85,12 @@ void PrefMemberBase::OnPreferenceChanged(PrefService* service,
base::Bind(observer_, pref_name) : base::Closure());
}
+// TODO(battre): Delete this. See crbug.com/373435.
+void PrefMemberBase::SetPrefServiceDestructionTrace(
+ const std::string& stacktrace) {
+ pref_service_destruction_ = stacktrace;
+}
+
void PrefMemberBase::UpdateValueFromPref(const base::Closure& callback) const {
VerifyValuePrefName();
const PrefService::Preference* pref =

Powered by Google App Engine
This is Rietveld 408576698