summaryrefslogtreecommitdiffstats
path: root/chrome/common/notification_service.h
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-21 00:34:44 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-21 00:34:44 +0000
commitd9ad8baa4e77fd602f87881db9b7432206a7143f (patch)
tree52d0e758bc65e4b5a090ece741bf6d5ba505a155 /chrome/common/notification_service.h
parent7a70481028d8e7c40796c79d70d8f98604e9d152 (diff)
downloadchromium_src-d9ad8baa4e77fd602f87881db9b7432206a7143f.zip
chromium_src-d9ad8baa4e77fd602f87881db9b7432206a7143f.tar.gz
chromium_src-d9ad8baa4e77fd602f87881db9b7432206a7143f.tar.bz2
Make the NotificationRegistrar safe for use in Singletons, which may outlive the NotificationService instances, by checking whether the service exists before calling RemoveObserver() on it.
Also add comments in NotificationService telling people to use NotificationRegistrar. BUG=2381 Review URL: http://codereview.chromium.org/115601 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16554 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/notification_service.h')
-rw-r--r--chrome/common/notification_service.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/chrome/common/notification_service.h b/chrome/common/notification_service.h
index 706cc945..0f99949 100644
--- a/chrome/common/notification_service.h
+++ b/chrome/common/notification_service.h
@@ -30,6 +30,9 @@ class NotificationService {
NotificationService();
~NotificationService();
+ // NOTE: Rather than using this directly, you you probably want to use a
+ // NotificationRegistrar. It's generally easier and less error-prone.
+ //
// Registers a NotificationObserver to be called whenever a matching
// notification is posted. Observer is a pointer to an object subclassing
// NotificationObserver to be notified when an event matching the other two
@@ -48,6 +51,9 @@ class NotificationService {
void AddObserver(NotificationObserver* observer,
NotificationType type, const NotificationSource& source);
+ // NOTE: Rather than using this directly, you you probably want to use a
+ // NotificationRegistrar. It's generally easier and less error-prone.
+ //
// Removes the object pointed to by observer from receiving notifications
// that match type and source. If no object matching the parameters is
// currently registered, this method is a no-op.