intl/icu/source/common/servnotf.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 /**
michael@0 2 *******************************************************************************
michael@0 3 * Copyright (C) 2001-2011, International Business Machines Corporation and *
michael@0 4 * others. All Rights Reserved. *
michael@0 5 *******************************************************************************
michael@0 6 */
michael@0 7 #ifndef ICUNOTIF_H
michael@0 8 #define ICUNOTIF_H
michael@0 9
michael@0 10 #include "unicode/utypes.h"
michael@0 11
michael@0 12 #if UCONFIG_NO_SERVICE
michael@0 13
michael@0 14 U_NAMESPACE_BEGIN
michael@0 15
michael@0 16 /*
michael@0 17 * Allow the declaration of APIs with pointers to BreakIterator
michael@0 18 * even when break iteration is removed from the build.
michael@0 19 */
michael@0 20 class ICUNotifier;
michael@0 21
michael@0 22 U_NAMESPACE_END
michael@0 23
michael@0 24 #else
michael@0 25
michael@0 26 #include "unicode/uobject.h"
michael@0 27 #include "unicode/unistr.h"
michael@0 28
michael@0 29 #include "mutex.h"
michael@0 30 #include "uvector.h"
michael@0 31
michael@0 32 U_NAMESPACE_BEGIN
michael@0 33
michael@0 34 class U_COMMON_API EventListener : public UObject {
michael@0 35 public:
michael@0 36 virtual ~EventListener();
michael@0 37
michael@0 38 public:
michael@0 39 static UClassID U_EXPORT2 getStaticClassID();
michael@0 40
michael@0 41 virtual UClassID getDynamicClassID() const;
michael@0 42
michael@0 43 public:
michael@0 44 #ifdef SERVICE_DEBUG
michael@0 45 virtual UnicodeString& debug(UnicodeString& result) const {
michael@0 46 return debugClass(result);
michael@0 47 }
michael@0 48
michael@0 49 virtual UnicodeString& debugClass(UnicodeString& result) const {
michael@0 50 return result.append("Key");
michael@0 51 }
michael@0 52 #endif
michael@0 53 };
michael@0 54
michael@0 55 /**
michael@0 56 * <p>Abstract implementation of a notification facility. Clients add
michael@0 57 * EventListeners with addListener and remove them with removeListener.
michael@0 58 * Notifiers call notifyChanged when they wish to notify listeners.
michael@0 59 * This queues the listener list on the notification thread, which
michael@0 60 * eventually dequeues the list and calls notifyListener on each
michael@0 61 * listener in the list.</p>
michael@0 62 *
michael@0 63 * <p>Subclasses override acceptsListener and notifyListener
michael@0 64 * to add type-safe notification. AcceptsListener should return
michael@0 65 * true if the listener is of the appropriate type; ICUNotifier
michael@0 66 * itself will ensure the listener is non-null and that the
michael@0 67 * identical listener is not already registered with the Notifier.
michael@0 68 * NotifyListener should cast the listener to the appropriate
michael@0 69 * type and call the appropriate method on the listener.
michael@0 70 */
michael@0 71
michael@0 72 class U_COMMON_API ICUNotifier : public UMemory {
michael@0 73 private: UVector* listeners;
michael@0 74
michael@0 75 public:
michael@0 76 ICUNotifier(void);
michael@0 77
michael@0 78 virtual ~ICUNotifier(void);
michael@0 79
michael@0 80 /**
michael@0 81 * Add a listener to be notified when notifyChanged is called.
michael@0 82 * The listener must not be null. AcceptsListener must return
michael@0 83 * true for the listener. Attempts to concurrently
michael@0 84 * register the identical listener more than once will be
michael@0 85 * silently ignored.
michael@0 86 */
michael@0 87 virtual void addListener(const EventListener* l, UErrorCode& status);
michael@0 88
michael@0 89 /**
michael@0 90 * Stop notifying this listener. The listener must
michael@0 91 * not be null. Attemps to remove a listener that is
michael@0 92 * not registered will be silently ignored.
michael@0 93 */
michael@0 94 virtual void removeListener(const EventListener* l, UErrorCode& status);
michael@0 95
michael@0 96 /**
michael@0 97 * ICU doesn't spawn its own threads. All listeners are notified in
michael@0 98 * the thread of the caller. Misbehaved listeners can therefore
michael@0 99 * indefinitely block the calling thread. Callers should beware of
michael@0 100 * deadlock situations.
michael@0 101 */
michael@0 102 virtual void notifyChanged(void);
michael@0 103
michael@0 104 protected:
michael@0 105 /**
michael@0 106 * Subclasses implement this to return TRUE if the listener is
michael@0 107 * of the appropriate type.
michael@0 108 */
michael@0 109 virtual UBool acceptsListener(const EventListener& l) const = 0;
michael@0 110
michael@0 111 /**
michael@0 112 * Subclasses implement this to notify the listener.
michael@0 113 */
michael@0 114 virtual void notifyListener(EventListener& l) const = 0;
michael@0 115 };
michael@0 116
michael@0 117 U_NAMESPACE_END
michael@0 118
michael@0 119 /* UCONFIG_NO_SERVICE */
michael@0 120 #endif
michael@0 121
michael@0 122 /* ICUNOTIF_H */
michael@0 123 #endif

mercurial