27 #ifndef SBBASEMEDIACOREEVENTTARGET_H_
28 #define SBBASEMEDIACOREEVENTTARGET_H_
30 #include <nsAutoPtr.h>
31 #include <nsCOMArray.h>
34 #include <nsIThread.h>
35 #include <nsThreadUtils.h>
39 #include <nsIVariant.h>
40 #include <sbIMediacoreEventTarget.h>
78 PRBool aAsync, PRBool * aDispatched);
85 nsCOMArray<sbIMediacoreEventListener> mListeners;
93 struct DispatchState {
112 : mIndexToRemove(aIndex) {}
116 virtual void* operator()(
void* aObject)
118 sbBaseMediacoreEventTarget::DispatchState *state =
119 (sbBaseMediacoreEventTarget::DispatchState*)aObject;
120 if (state->length > mIndexToRemove) {
123 if (state->index >= mIndexToRemove) {
130 PRInt32 mIndexToRemove;
135 class AsyncDispatchHelper :
public nsIRunnable
144 : mTarget(aTarget), mEvent(aEvent)
146 NS_ASSERTION(aTarget,
"sbMediacoreEventTargetAsyncDispatchHelper: no target");
147 NS_ASSERTION(aEvent,
"sbMediacoreEventTargetAsyncDispatchHelper: no event");
154 NS_ASSERTION(NS_IsMainThread(),
155 "sbMediacoreEventTargetAsyncDispatchHelper: not on main thread!");
158 mTarget->DispatchEvent(mEvent,
164 nsCOMPtr<sbIMediacoreEventTarget> mTarget;
165 nsCOMPtr<sbIMediacoreEvent> mEvent;