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

Side by Side Diff: chrome/browser/prefs/pref_notifier_impl.cc

Issue 7574002: Be able to print items that do window.print(); window.close() (airline tix e.g.) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 9 years, 4 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/prefs/pref_notifier_impl.h" 5 #include "chrome/browser/prefs/pref_notifier_impl.h"
6 6
7 #include "base/debug/stack_trace.h"
7 #include "base/stl_util.h" 8 #include "base/stl_util.h"
8 #include "chrome/browser/prefs/pref_service.h" 9 #include "chrome/browser/prefs/pref_service.h"
9 #include "chrome/common/chrome_notification_types.h" 10 #include "chrome/common/chrome_notification_types.h"
10 #include "content/common/notification_observer.h" 11 #include "content/common/notification_observer.h"
11 #include "content/common/notification_service.h" 12 #include "content/common/notification_service.h"
12 13
13 PrefNotifierImpl::PrefNotifierImpl(PrefService* service) 14 PrefNotifierImpl::PrefNotifierImpl(PrefService* service)
14 : pref_service_(service) { 15 : pref_service_(service) {
15 } 16 }
16 17
17 PrefNotifierImpl::~PrefNotifierImpl() { 18 PrefNotifierImpl::~PrefNotifierImpl() {
18 DCHECK(CalledOnValidThread()); 19 DCHECK(CalledOnValidThread());
19 20
21 bool already_printed_stacktrace = false;
20 // Verify that there are no pref observers when we shut down. 22 // Verify that there are no pref observers when we shut down.
21 for (PrefObserverMap::iterator it = pref_observers_.begin(); 23 for (PrefObserverMap::iterator it = pref_observers_.begin();
22 it != pref_observers_.end(); ++it) { 24 it != pref_observers_.end(); ++it) {
23 NotificationObserverList::Iterator obs_iterator(*(it->second)); 25 NotificationObserverList::Iterator obs_iterator(*(it->second));
24 if (obs_iterator.GetNext()) { 26 if (obs_iterator.GetNext()) {
27 if (!already_printed_stacktrace) {
28 already_printed_stacktrace = true;
29 base::debug::StackTrace().PrintBacktrace();
30 }
25 LOG(WARNING) << "pref observer found at shutdown " << it->first; 31 LOG(WARNING) << "pref observer found at shutdown " << it->first;
26 } 32 }
27 } 33 }
28 34
29 STLDeleteContainerPairSecondPointers(pref_observers_.begin(), 35 STLDeleteContainerPairSecondPointers(pref_observers_.begin(),
30 pref_observers_.end()); 36 pref_observers_.end());
31 pref_observers_.clear(); 37 pref_observers_.clear();
32 } 38 }
33 39
34 void PrefNotifierImpl::AddPrefObserver(const char* path, 40 void PrefNotifierImpl::AddPrefObserver(const char* path,
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 return; 103 return;
98 104
99 NotificationObserverList::Iterator it(*(observer_iterator->second)); 105 NotificationObserverList::Iterator it(*(observer_iterator->second));
100 NotificationObserver* observer; 106 NotificationObserver* observer;
101 while ((observer = it.GetNext()) != NULL) { 107 while ((observer = it.GetNext()) != NULL) {
102 observer->Observe(chrome::NOTIFICATION_PREF_CHANGED, 108 observer->Observe(chrome::NOTIFICATION_PREF_CHANGED,
103 Source<PrefService>(pref_service_), 109 Source<PrefService>(pref_service_),
104 Details<const std::string>(&path)); 110 Details<const std::string>(&path));
105 } 111 }
106 } 112 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698