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

Side by Side Diff: trunk/src/base/prefs/pref_service.cc

Issue 289373006: Revert 271416 "Store a stacktrace of PrefService destruction in ..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « trunk/src/base/prefs/pref_observer.h ('k') | trunk/src/base/prefs/pref_value_store_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/prefs/pref_service.h" 5 #include "base/prefs/pref_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 // TODO(battre): Delete this. See crbug.com/373435.
11 #include "base/debug/stack_trace.h"
12 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
13 #include "base/logging.h" 11 #include "base/logging.h"
14 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
15 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
16 #include "base/prefs/default_pref_store.h" 14 #include "base/prefs/default_pref_store.h"
17 #include "base/prefs/pref_notifier_impl.h" 15 #include "base/prefs/pref_notifier_impl.h"
18 #include "base/prefs/pref_registry.h" 16 #include "base/prefs/pref_registry.h"
19 #include "base/prefs/pref_value_store.h" 17 #include "base/prefs/pref_value_store.h"
20 #include "base/stl_util.h" 18 #include "base/stl_util.h"
21 #include "base/strings/string_number_conversions.h" 19 #include "base/strings/string_number_conversions.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 user_pref_store_(user_prefs), 52 user_pref_store_(user_prefs),
55 read_error_callback_(read_error_callback) { 53 read_error_callback_(read_error_callback) {
56 pref_notifier_->SetPrefService(this); 54 pref_notifier_->SetPrefService(this);
57 55
58 InitFromStorage(async); 56 InitFromStorage(async);
59 } 57 }
60 58
61 PrefService::~PrefService() { 59 PrefService::~PrefService() {
62 DCHECK(CalledOnValidThread()); 60 DCHECK(CalledOnValidThread());
63 61
64 // TODO(battre): Remove the following code. It's purpose is to understand
65 // whether a crash in PrefChangeRegistrar::~PrefChangeRegistrar() is caused
66 // by a PrefService already being dead. See crbug.com/373435.
67 std::string stack_trace = base::debug::StackTrace().ToString();
68 static_cast<PrefNotifier*>(pref_notifier_.get())
69 ->BroadcastPrefServiceDestructionTrace(stack_trace);
70
71 // Reset pointers so accesses after destruction reliably crash. 62 // Reset pointers so accesses after destruction reliably crash.
72 pref_value_store_.reset(); 63 pref_value_store_.reset();
73 pref_registry_ = NULL; 64 pref_registry_ = NULL;
74 user_pref_store_ = NULL; 65 user_pref_store_ = NULL;
75 pref_notifier_.reset(); 66 pref_notifier_.reset();
76 } 67 }
77 68
78 void PrefService::InitFromStorage(bool async) { 69 void PrefService::InitFromStorage(bool async) {
79 if (user_pref_store_->IsInitializationComplete()) { 70 if (user_pref_store_->IsInitializationComplete()) {
80 read_error_callback_.Run(user_pref_store_->GetReadError()); 71 read_error_callback_.Run(user_pref_store_->GetReadError());
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 DCHECK(found_value->IsType(default_type)); 546 DCHECK(found_value->IsType(default_type));
556 return found_value; 547 return found_value;
557 } else { 548 } else {
558 // Every registered preference has at least a default value. 549 // Every registered preference has at least a default value.
559 NOTREACHED() << "no valid value found for registered pref " << path; 550 NOTREACHED() << "no valid value found for registered pref " << path;
560 } 551 }
561 } 552 }
562 553
563 return NULL; 554 return NULL;
564 } 555 }
OLDNEW
« no previous file with comments | « trunk/src/base/prefs/pref_observer.h ('k') | trunk/src/base/prefs/pref_value_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698