Chromium Code Reviews| 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..a645432fe768d3029b9736e51c3055481f0f0210 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 |
|
engedy
2014/05/16 15:19:58
nit: period to the end of the comment.
battre
2014/05/16 15:58:37
Done.
|
| +#include "base/debug/alias.h" |
| #include "base/logging.h" |
| #include "base/prefs/pref_service.h" |
| @@ -48,6 +50,22 @@ 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 stacktrack of the destruction in |
|
engedy
2014/05/16 15:19:58
nit: s/stacktrack/stack trace
battre
2014/05/16 15:58:37
Done.
|
| + // 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()); |
|
engedy
2014/05/16 15:19:58
Could we use strncat() here, like so:
char tmp[20
battre
2014/05/16 15:58:37
Done.
|
| + memcpy(tmp, pref_service_destruction_.c_str(), copy); |
| + tmp[copy] = '\0'; |
| + 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 +99,12 @@ void PrefChangeRegistrar::OnPreferenceChanged(PrefService* service, |
| observers_[pref].Run(pref); |
| } |
| +// TODO(battre): Delete this. See crbug.com/373435. |
| +void PrefChangeRegistrar::SetPrefServiceDestructionTrace( |
| + const std::string& stacktrace) { |
|
engedy
2014/05/16 15:19:58
nit: stack_trace.
battre
2014/05/16 15:58:37
Done.
|
| + pref_service_destruction_ = stacktrace; |
| +} |
| + |
| void PrefChangeRegistrar::InvokeUnnamedCallback(const base::Closure& callback, |
| const std::string& pref_name) { |
| callback.Run(); |