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

Side by Side Diff: chrome/common/notification_registrar.cc

Issue 113958: Add more logging on a NOTREACHED() in hopes of getting more data about why we... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 6 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 | « no previous file | no next file » | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/common/notification_registrar.h" 5 #include "chrome/common/notification_registrar.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "chrome/common/notification_service.h" 10 #include "chrome/common/notification_service.h"
(...skipping 30 matching lines...) Expand all
41 NotificationService::current()->AddObserver(observer, type, source); 41 NotificationService::current()->AddObserver(observer, type, source);
42 } 42 }
43 43
44 void NotificationRegistrar::Remove(NotificationObserver* observer, 44 void NotificationRegistrar::Remove(NotificationObserver* observer,
45 NotificationType type, 45 NotificationType type,
46 const NotificationSource& source) { 46 const NotificationSource& source) {
47 Record record = { observer, type, source }; 47 Record record = { observer, type, source };
48 RecordVector::iterator found = std::find( 48 RecordVector::iterator found = std::find(
49 registered_.begin(), registered_.end(), record); 49 registered_.begin(), registered_.end(), record);
50 if (found == registered_.end()) { 50 if (found == registered_.end()) {
51 NOTREACHED(); 51 NOTREACHED() << "Trying to remove unregistered observer of type " <<
52 type.value << " from list of size " << registered_.size() << ".";
52 return; 53 return;
53 } 54 }
54 registered_.erase(found); 55 registered_.erase(found);
55 56
56 // This can be NULL if our owner outlives the NotificationService, e.g. if our 57 // This can be NULL if our owner outlives the NotificationService, e.g. if our
57 // owner is a Singleton. 58 // owner is a Singleton.
58 NotificationService* service = NotificationService::current(); 59 NotificationService* service = NotificationService::current();
59 if (service) 60 if (service)
60 service->RemoveObserver(observer, type, source); 61 service->RemoveObserver(observer, type, source);
61 } 62 }
(...skipping 17 matching lines...) Expand all
79 registered_[i].type, 80 registered_[i].type,
80 registered_[i].source); 81 registered_[i].source);
81 } 82 }
82 } 83 }
83 registered_.clear(); 84 registered_.clear();
84 } 85 }
85 86
86 bool NotificationRegistrar::IsEmpty() const { 87 bool NotificationRegistrar::IsEmpty() const {
87 return registered_.empty(); 88 return registered_.empty();
88 } 89 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698