27 #ifndef __SB_LOCALDATABASE_MEDIALISTLISTENER_H__
28 #define __SB_LOCALDATABASE_MEDIALISTLISTENER_H__
30 #include <nsAutoPtr.h>
32 #include <nsCOMArray.h>
33 #include <nsTHashtable.h>
34 #include <nsHashKeys.h>
37 #include <sbIMediaList.h>
38 #include <sbIMediaListListener.h>
39 #include <sbIPropertyArray.h>
41 class nsIProxyObjectManager;
42 class nsIWeakReference;
43 class nsIWeakReference;
55 nsresult
Init(nsIProxyObjectManager *aProxyObjMgr,
57 PRUint32 aCurrentBatchDepth,
60 nsresult
Init(nsIProxyObjectManager *aProxyObjMgr,
61 nsIWeakReference* aWeakListener,
62 PRUint32 aCurrentBatchDepth,
78 nsCOMPtr<nsISupports> mRef;
79 nsCOMPtr<nsIWeakReference> mWeak;
80 nsCOMPtr<sbIMediaListListener> mProxy;
82 PRBool mHasPropertyFilter;
83 nsTHashtable<nsStringHashKey> mPropertyFilter;
84 nsTArray<PRUint32> mStopNotifiyingStack;
85 nsString mDebugAddress;
92 NS_DECL_SBIMEDIALISTLISTENER
98 already_AddRefed<sbIMediaListListener> GetListener();
100 nsCOMPtr<nsIWeakReference> mWrappedWeak;
107 struct ListenerAndDebugAddress {
109 const nsAString& aDebugAddress) :
111 debugAddress(aDebugAddress)
114 nsCOMPtr<sbIMediaListListener>
listener;
115 nsString debugAddress;
119 struct StopNotifyFlags {
121 PRUint32 aListenerFlags,
124 listenerFlags(aListenerFlags),
127 nsCOMPtr<sbIMediaListListener>
listener;
128 PRUint32 listenerFlags;
132 typedef nsTArray<ListenerAndDebugAddress> sbMediaListListenersArray;
133 typedef nsTArray<StopNotifyFlags> sbStopNotifyArray;
134 typedef nsAutoPtr<sbListenerInfo> sbListenerInfoAutoPtr;
147 PRBool aOwnsWeak = PR_FALSE,
185 PRBool aExcludeLists);
189 PRBool aExcludeLists);
199 nsresult SnapshotListenerArray(sbMediaListListenersArray& aArray,
202 void SweepListenerArray(sbStopNotifyArray& aStopNotifying);
204 nsTArray<sbListenerInfoAutoPtr> mListenerArray;
206 PRLock* mListenerArrayLock;
208 PRUint32 mBatchDepth;
Simple class to make sure we notify listeners that a batch operation has completed every time they ar...
void GetDebugAddress(nsAString &mDebugAddress)
void SetShouldStopNotifying(PRUint32 aFlag)
PRBool ShouldNotify(PRUint32 aFlag, sbIPropertyArray *aProperties=nsnull)
An interface to carry around arrays of nsIProperty instances. Users of this interface should only QI ...
nsresult Init(nsIProxyObjectManager *aProxyObjMgr, sbIMediaListListener *aListener, PRUint32 aCurrentBatchDepth, PRUint32 aFlags, sbIPropertyArray *aPropertyFilter)