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 | |
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.
-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 | ||||
-rw-r--r-- | dom/events/DOMEventTargetHelper.cpp | 5 | ||||
-rw-r--r-- | dom/xhr/XMLHttpRequestMainThread.cpp | 31 | ||||
-rw-r--r-- | dom/xhr/XMLHttpRequestMainThread.h | 6 |
7 files changed, 30 insertions, 84 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; diff --git a/dom/events/DOMEventTargetHelper.cpp b/dom/events/DOMEventTargetHelper.cpp index ef5b29fa5c..458d85215f 100644 --- a/dom/events/DOMEventTargetHelper.cpp +++ b/dom/events/DOMEventTargetHelper.cpp @@ -52,11 +52,12 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(DOMEventTargetHelper) NS_IMPL_CYCLE_COLLECTION_UNLINK_END NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(DOMEventTargetHelper) - if (tmp->IsBlack() || tmp->IsCertainlyAliveForCC()) { + bool isBlack = tmp->IsBlack(); + if (isBlack || tmp->IsCertainlyAliveForCC()) { if (tmp->mListenerManager) { tmp->mListenerManager->MarkForCC(); } - if (!tmp->IsBlack() && tmp->PreservingWrapper()) { + if (!isBlack && tmp->PreservingWrapper()) { // This marks the wrapper black. tmp->GetWrapper(); } diff --git a/dom/xhr/XMLHttpRequestMainThread.cpp b/dom/xhr/XMLHttpRequestMainThread.cpp index ad999c3584..2c3c3ce295 100644 --- a/dom/xhr/XMLHttpRequestMainThread.cpp +++ b/dom/xhr/XMLHttpRequestMainThread.cpp @@ -310,30 +310,7 @@ XMLHttpRequestMainThread::SetRequestObserver(nsIRequestObserver* aObserver) mRequestObserver = aObserver; } -NS_IMPL_CYCLE_COLLECTION_CLASS(XMLHttpRequestMainThread) - -NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(XMLHttpRequestMainThread) - bool isBlack = tmp->IsBlack(); - if (isBlack || tmp->mWaitingForOnStopRequest) { - 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(XMLHttpRequestMainThread) - return tmp-> - IsBlackAndDoesNotNeedTracing(static_cast<DOMEventTargetHelper*>(tmp)); -NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_END - -NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_BEGIN(XMLHttpRequestMainThread) - return tmp->IsBlack(); -NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_END + NS_IMPL_CYCLE_COLLECTION_CLASS(XMLHttpRequestMainThread) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(XMLHttpRequestMainThread, XMLHttpRequestEventTarget) @@ -380,6 +357,12 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(XMLHttpRequestMainThread, NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK(mResultJSON) NS_IMPL_CYCLE_COLLECTION_TRACE_END +bool +XMLHttpRequestMainThread::IsCertainlyAliveForCC() const +{ + return mWaitingForOnStopRequest; +} + // QueryInterface implementation for XMLHttpRequestMainThread NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(XMLHttpRequestMainThread) NS_INTERFACE_MAP_ENTRY(nsIXMLHttpRequest) diff --git a/dom/xhr/XMLHttpRequestMainThread.h b/dom/xhr/XMLHttpRequestMainThread.h index 5f1a729011..4a6eeec2ef 100644 --- a/dom/xhr/XMLHttpRequestMainThread.h +++ b/dom/xhr/XMLHttpRequestMainThread.h @@ -525,8 +525,10 @@ public: void SetRequestObserver(nsIRequestObserver* aObserver); - NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_INHERITED(XMLHttpRequestMainThread, - XMLHttpRequest) + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(XMLHttpRequestMainThread, + XMLHttpRequest) + virtual bool IsCertainlyAliveForCC() const override; + bool AllowUploadProgress(); virtual void DisconnectFromOwner() override; |