Skip to content

Commit

Permalink
Bug 1123523 - Part 4: Add macro for notifying observers only when the…
Browse files Browse the repository at this point in the history
…y implement a specific derived interface. r=smaug
  • Loading branch information
rmottola committed Aug 4, 2019
1 parent d146779 commit 3871400
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions xpcom/glue/nsTObserverArray.h
Expand Up @@ -487,4 +487,17 @@ ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback,
obs_ -> func_ params_ ; \
} \
PR_END_MACRO

#define NS_OBSERVER_ARRAY_NOTIFY_OBSERVERS_WITH_QI(array_, basetype_, obstype_, func_, params_) \
PR_BEGIN_MACRO \
nsTObserverArray<basetype_ *>::ForwardIterator iter_(array_); \
basetype_* obsbase_; \
while (iter_.HasMore()) { \
obsbase_ = iter_.GetNext(); \
nsCOMPtr<obstype_> obs_ = do_QueryInterface(obsbase_); \
if (obs_) { \
obs_ -> func_ params_ ; \
} \
} \
PR_END_MACRO
#endif // nsTObserverArray_h___

0 comments on commit 3871400

Please sign in to comment.