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

Unified Diff: base/prefs/pref_change_registrar.cc

Issue 290083006: Store a stacktrace of PrefService destruction in PrefChangeRegistrar (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compilation 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
« no previous file with comments | « base/prefs/pref_change_registrar.h ('k') | base/prefs/pref_member.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/prefs/pref_change_registrar.cc
diff --git a/base/prefs/pref_change_registrar.cc b/base/prefs/pref_change_registrar.cc
index 28ac37403435f7428670cc032f6f603e7f6ecda6..03768dc9d0a3350aeb71b023e17b848841fbe5ee 100644
--- a/base/prefs/pref_change_registrar.cc
+++ b/base/prefs/pref_change_registrar.cc
@@ -5,6 +5,8 @@
#include "base/prefs/pref_change_registrar.h"
#include "base/bind.h"
+// TODO(battre): Delete this. See crbug.com/373435.
+#include "base/debug/alias.h"
#include "base/logging.h"
#include "base/prefs/pref_service.h"
@@ -48,6 +50,19 @@ void PrefChangeRegistrar::Remove(const char* path) {
}
void PrefChangeRegistrar::RemoveAll() {
+ // TODO(battre): Delete this. See crbug.com/373435.
+ if (!observers_.empty() && !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 stack trace of the destruction in
+ // pref_service_destruction_. We save this on the stack in the minidump to
+ // understand what happens.
+ char tmp[2048] = {};
+ strncat(tmp, pref_service_destruction_.c_str(), sizeof(tmp) - 1u);
+ base::debug::Alias(tmp);
+ CHECK(false) << tmp;
+ }
+
for (ObserverMap::const_iterator it = observers_.begin();
it != observers_.end(); ++it) {
service_->RemovePrefObserver(it->first.c_str(), this);
@@ -81,6 +96,12 @@ void PrefChangeRegistrar::OnPreferenceChanged(PrefService* service,
observers_[pref].Run(pref);
}
+// TODO(battre): Delete this. See crbug.com/373435.
+void PrefChangeRegistrar::SetPrefServiceDestructionTrace(
+ const std::string& stack_trace) {
+ pref_service_destruction_ = stack_trace;
+}
+
void PrefChangeRegistrar::InvokeUnnamedCallback(const base::Closure& callback,
const std::string& pref_name) {
callback.Run();
« no previous file with comments | « base/prefs/pref_change_registrar.h ('k') | base/prefs/pref_member.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698