diff options
author | Brian Smith <brian@dbsoft.org> | 2022-08-25 21:59:08 -0500 |
---|---|---|
committer | Brian Smith <brian@dbsoft.org> | 2022-08-25 21:59:08 -0500 |
commit | d6f18548a664b82489daeebf18fd3051f3edc8ac (patch) | |
tree | 865369a2ddc822f92758edfdb7647348f490b174 /dom/base | |
parent | bbc3e455b064320170be03996a87a493f3c18106 (diff) | |
download | uxp-d6f18548a664b82489daeebf18fd3051f3edc8ac.tar.gz |
Issue #1990 - Part 5 - Common up the skippability implementations that are basically copy/pastes of the DOMEventTargetHelper one.
Mozilla Bug Bug 1333540. Skipped the renamed of various functions, but otherwise a direct port.
Diffstat (limited to 'dom/base')
-rw-r--r-- | dom/base/EventSource.cpp | 32 | ||||
-rw-r--r-- | dom/base/EventSource.h | 4 | ||||
-rw-r--r-- | dom/base/WebSocket.cpp | 32 | ||||
-rw-r--r-- | dom/base/WebSocket.h | 4 |
4 files changed, 16 insertions, 56 deletions
diff --git a/dom/base/EventSource.cpp b/dom/base/EventSource.cpp index 3bd1fae52d..35a7835cf4 100644 --- a/dom/base/EventSource.cpp +++ b/dom/base/EventSource.cpp @@ -2087,32 +2087,6 @@ EventSource::UpdateDontKeepAlive() NS_IMPL_CYCLE_COLLECTION_CLASS(EventSource) -NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(EventSource) - bool isBlack = tmp->IsBlack(); - if (isBlack || tmp->mKeepingAlive) { - if (tmp->mListenerManager) { - tmp->mListenerManager->MarkForCC(); - } - if (!isBlack && tmp->PreservingWrapper()) { - // This marks the wrapper black. - tmp->GetWrapper(); - } - return true; - } -NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_END - -NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_BEGIN(EventSource) - return tmp->IsBlack(); -NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_END - -NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_BEGIN(EventSource) - return tmp->IsBlack(); -NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_END - -NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(EventSource, - DOMEventTargetHelper) -NS_IMPL_CYCLE_COLLECTION_TRACE_END - NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(EventSource, DOMEventTargetHelper) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END @@ -2125,6 +2099,12 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(EventSource, } NS_IMPL_CYCLE_COLLECTION_UNLINK_END +bool +EventSource::IsCertainlyAliveForCC() const +{ + return mKeepingAlive; +} + NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(EventSource) NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper) diff --git a/dom/base/EventSource.h b/dom/base/EventSource.h index cd43481908..e36afac1d6 100644 --- a/dom/base/EventSource.h +++ b/dom/base/EventSource.h @@ -42,8 +42,8 @@ class EventSource final : public DOMEventTargetHelper friend class EventSourceImpl; public: NS_DECL_ISUPPORTS_INHERITED - NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_INHERITED( - EventSource, DOMEventTargetHelper) + NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(EventSource, DOMEventTargetHelper) + virtual bool IsCertainlyAliveForCC() const override; // EventTarget void DisconnectFromOwner() override diff --git a/dom/base/WebSocket.cpp b/dom/base/WebSocket.cpp index 19a687cba3..fe06bc93a4 100644 --- a/dom/base/WebSocket.cpp +++ b/dom/base/WebSocket.cpp @@ -1402,32 +1402,6 @@ WebSocket::ConstructorCommon(const GlobalObject& aGlobal, NS_IMPL_CYCLE_COLLECTION_CLASS(WebSocket) -NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(WebSocket) - bool isBlack = tmp->IsBlack(); - if (isBlack || tmp->mKeepingAlive) { - if (tmp->mListenerManager) { - tmp->mListenerManager->MarkForCC(); - } - if (!isBlack && tmp->PreservingWrapper()) { - // This marks the wrapper black. - tmp->GetWrapper(); - } - return true; - } -NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_END - -NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_BEGIN(WebSocket) - return tmp->IsBlack(); -NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_END - -NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_BEGIN(WebSocket) - return tmp->IsBlack(); -NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_END - -NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(WebSocket, - DOMEventTargetHelper) -NS_IMPL_CYCLE_COLLECTION_TRACE_END - NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(WebSocket, DOMEventTargetHelper) if (tmp->mImpl) { @@ -1444,6 +1418,12 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(WebSocket, } NS_IMPL_CYCLE_COLLECTION_UNLINK_END +bool +WebSocket::IsCertainlyAliveForCC() const +{ + return mKeepingAlive; +} + NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(WebSocket) NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper) diff --git a/dom/base/WebSocket.h b/dom/base/WebSocket.h index 2eedeb3bab..605ef825c1 100644 --- a/dom/base/WebSocket.h +++ b/dom/base/WebSocket.h @@ -45,8 +45,8 @@ public: public: NS_DECL_ISUPPORTS_INHERITED - NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_INHERITED( - WebSocket, DOMEventTargetHelper) + NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(WebSocket, DOMEventTargetHelper) + virtual bool IsCertainlyAliveForCC() const override; // EventTarget virtual void EventListenerAdded(nsIAtom* aType) override; |