source: webkit/trunk/Source/WebCore/xml/XMLHttpRequestUpload.h

Last change on this file was 294978, checked in by Chris Dumez, 3 years ago

Refactor opaque root logic in WebCore in preparation for Node GC optimizations
https://bugs.webkit.org/show_bug.cgi?id=240998

Reviewed by Geoffrey Garen.

Refactor opaque root logic in WebCore in preparation for Node GC optimizations.
Introduce addWebCoreOpaqueRoot() / containsWebCoreOpaqueRoot() functions for
WebCore to deal with opaque roots, instead of interacting with the SlotVisitor
directly. This introduce a nice central point in WebCore where we will be
able to set / check flags on Node to speed up GC.

Also introduce a WebCoreOpaqueRoot type to replace void* as type of opaque
roots in WebCore. This is useful because we will need to know whether an
opaque root in a Node or not in a future patch.

There is no expected behavior change from this patch, this is just pure
refactoring to make it a lot easier for us to optimize Node gargabe collection.

  • Source/WebCore/Modules/fetch/FetchRequest.cpp:

(WebCore::root):

  • Source/WebCore/Modules/fetch/FetchRequest.h:
  • Source/WebCore/Modules/indexeddb/IDBIndex.cpp:

(WebCore::IDBIndex::opaqueRoot):
(WebCore::root):

  • Source/WebCore/Modules/indexeddb/IDBIndex.h:
  • Source/WebCore/Modules/indexeddb/IDBIndex.idl:
  • Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp:

(WebCore::IDBObjectStore::visitReferencedIndexes const):
(WebCore::root):

  • Source/WebCore/Modules/indexeddb/IDBObjectStore.h:
  • Source/WebCore/Modules/indexeddb/IDBRequest.cpp:

(WebCore::root):

  • Source/WebCore/Modules/indexeddb/IDBRequest.h:
  • Source/WebCore/Modules/indexeddb/IDBTransaction.cpp:

(WebCore::IDBTransaction::visitReferencedObjectStores const):

  • Source/WebCore/Modules/mediasource/SourceBuffer.cpp:

(WebCore::SourceBuffer::opaqueRoot):

  • Source/WebCore/Modules/mediasource/SourceBuffer.h:
  • Source/WebCore/Modules/mediasource/SourceBufferList.cpp:

(WebCore::root):

  • Source/WebCore/Modules/mediasource/SourceBufferList.h:
  • Source/WebCore/Modules/remoteplayback/RemotePlayback.cpp:

(WebCore::RemotePlayback::opaqueRootConcurrently const):

  • Source/WebCore/Modules/remoteplayback/RemotePlayback.h:
  • Source/WebCore/Modules/webaudio/AudioBuffer.cpp:

(WebCore::root):

  • Source/WebCore/Modules/webaudio/AudioBuffer.h:
  • Source/WebCore/Modules/webaudio/AudioWorkletGlobalScope.cpp:

(WebCore::AudioWorkletGlobalScope::visitProcessors):

  • Source/WebCore/Modules/webaudio/AudioWorkletProcessor.cpp:

(WebCore::root):

  • Source/WebCore/Modules/webaudio/AudioWorkletProcessor.h:
  • Source/WebCore/Modules/webxr/WebXRSession.cpp:

(WebCore::root):

  • Source/WebCore/Modules/webxr/WebXRSession.h:
  • Source/WebCore/Sources.txt:
  • Source/WebCore/WebCore.xcodeproj/project.pbxproj:
  • Source/WebCore/bindings/js/JSAbortSignalCustom.cpp:

(WebCore::JSAbortSignalOwner::isReachableFromOpaqueRoots):

  • Source/WebCore/bindings/js/JSAttrCustom.cpp:

(WebCore::JSAttr::visitAdditionalChildren):

  • Source/WebCore/bindings/js/JSAudioBufferSourceNodeCustom.cpp:

(WebCore::JSAudioBufferSourceNode::visitAdditionalChildren):

  • Source/WebCore/bindings/js/JSCSSRuleCustom.cpp:

(WebCore::JSCSSRule::visitAdditionalChildren):

  • Source/WebCore/bindings/js/JSCSSRuleCustom.h:

(WebCore::root):

  • Source/WebCore/bindings/js/JSCSSRuleListCustom.cpp:

(WebCore::JSCSSRuleListOwner::isReachableFromOpaqueRoots):

  • Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp:

(WebCore::root):
(WebCore::JSCSSStyleDeclaration::visitAdditionalChildren):

  • Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.h:
  • Source/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp:

(WebCore::JSCanvasRenderingContext2DOwner::isReachableFromOpaqueRoots):
(WebCore::JSCanvasRenderingContext2D::visitAdditionalChildren):

  • Source/WebCore/bindings/js/JSDOMQuadCustom.cpp:

(WebCore::JSDOMQuad::visitAdditionalChildren):

  • Source/WebCore/bindings/js/JSDOMWindowCustom.cpp:

(WebCore::JSDOMWindow::visitAdditionalChildren):

  • Source/WebCore/bindings/js/JSDeprecatedCSSOMValueCustom.cpp:

(WebCore::JSDeprecatedCSSOMValueOwner::isReachableFromOpaqueRoots):

  • Source/WebCore/bindings/js/JSDocumentCustom.cpp:

(WebCore::JSDocument::visitAdditionalChildren):

  • Source/WebCore/bindings/js/JSFetchEventCustom.cpp:

(WebCore::JSFetchEvent::visitAdditionalChildren):

  • Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp:

(WebCore::JSHTMLCanvasElement::visitAdditionalChildren):

  • Source/WebCore/bindings/js/JSHTMLTemplateElementCustom.cpp:

(WebCore::JSHTMLTemplateElement::visitAdditionalChildren):

  • Source/WebCore/bindings/js/JSIDBCursorCustom.cpp:

(WebCore::JSIDBCursor::visitAdditionalChildren):

  • Source/WebCore/bindings/js/JSIDBIndexCustom.cpp: Removed.

(WebCore::JSIDBIndex::visitAdditionalChildren): Deleted.

  • Source/WebCore/bindings/js/JSIntersectionObserverCustom.cpp:

(WebCore::JSIntersectionObserver::visitAdditionalChildren):

  • Source/WebCore/bindings/js/JSIntersectionObserverEntryCustom.cpp:

(WebCore::JSIntersectionObserverEntry::visitAdditionalChildren):

  • Source/WebCore/bindings/js/JSMediaListCustom.h:

(WebCore::root):

  • Source/WebCore/bindings/js/JSMessageChannelCustom.cpp:

(WebCore::JSMessageChannel::visitAdditionalChildren):

  • Source/WebCore/bindings/js/JSMessagePortCustom.cpp:

(WebCore::JSMessagePort::visitAdditionalChildren):

  • Source/WebCore/bindings/js/JSNavigatorCustom.cpp:

(WebCore::JSNavigator::visitAdditionalChildren):

  • Source/WebCore/bindings/js/JSNodeCustom.cpp:

(WebCore::JSNodeOwner::isReachableFromOpaqueRoots):
(WebCore::JSNode::visitAdditionalChildren):

  • Source/WebCore/bindings/js/JSNodeCustom.h:

(WebCore::root):

  • Source/WebCore/bindings/js/JSNodeIteratorCustom.cpp:

(WebCore::JSNodeIterator::visitAdditionalChildren):

  • Source/WebCore/bindings/js/JSNodeListCustom.cpp:

(WebCore::JSNodeListOwner::isReachableFromOpaqueRoots):

  • Source/WebCore/bindings/js/JSOffscreenCanvasRenderingContext2DCustom.cpp:

(WebCore::root):
(WebCore::JSOffscreenCanvasRenderingContext2DOwner::isReachableFromOpaqueRoots):
(WebCore::JSOffscreenCanvasRenderingContext2D::visitAdditionalChildren):

  • Source/WebCore/bindings/js/JSPaintRenderingContext2DCustom.cpp:

(WebCore::root):
(WebCore::JSPaintRenderingContext2DOwner::isReachableFromOpaqueRoots):
(WebCore::JSPaintRenderingContext2D::visitAdditionalChildren):

  • Source/WebCore/bindings/js/JSResizeObserverEntryCustom.cpp:

(WebCore::JSResizeObserverEntry::visitAdditionalChildren):

  • Source/WebCore/bindings/js/JSSVGViewSpecCustom.cpp:

(WebCore::JSSVGViewSpec::visitAdditionalChildren):

  • Source/WebCore/bindings/js/JSServiceWorkerGlobalScopeCustom.cpp:

(WebCore::JSServiceWorkerGlobalScope::visitAdditionalChildren):

  • Source/WebCore/bindings/js/JSStyleSheetCustom.cpp:

(WebCore::JSStyleSheet::visitAdditionalChildren):

  • Source/WebCore/bindings/js/JSStyleSheetCustom.h:

(WebCore::root):

  • Source/WebCore/bindings/js/JSTextTrackCueCustom.cpp:

(WebCore::JSTextTrackCueOwner::isReachableFromOpaqueRoots):
(WebCore::JSTextTrackCue::visitAdditionalChildren):

  • Source/WebCore/bindings/js/JSTreeWalkerCustom.cpp:

(WebCore::JSTreeWalker::visitAdditionalChildren):

  • Source/WebCore/bindings/js/JSUndoItemCustom.cpp:

(WebCore::JSUndoItemOwner::isReachableFromOpaqueRoots):

  • Source/WebCore/bindings/js/JSWebGL2RenderingContextCustom.cpp:

(WebCore::JSWebGL2RenderingContext::visitAdditionalChildren):

  • Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp:

(WebCore::JSWebGLRenderingContext::visitAdditionalChildren):

  • Source/WebCore/bindings/js/JSWebXRSessionCustom.cpp:

(WebCore::JSWebXRSession::visitAdditionalChildren):

  • Source/WebCore/bindings/js/JSWorkerGlobalScopeCustom.cpp:

(WebCore::JSWorkerGlobalScope::visitAdditionalChildren):

  • Source/WebCore/bindings/js/JSWorkerNavigatorCustom.cpp:

(WebCore::JSWorkerNavigator::visitAdditionalChildren):

  • Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp:

(WebCore::JSXMLHttpRequest::visitAdditionalChildren):

  • Source/WebCore/bindings/js/JSXPathResultCustom.cpp:

(WebCore::JSXPathResult::visitAdditionalChildren):

  • Source/WebCore/bindings/js/WebCoreOpaqueRoot.h: Added.

(WebCore::WebCoreOpaqueRoot::WebCoreOpaqueRoot):
(WebCore::WebCoreOpaqueRoot::isNode const):
(WebCore::WebCoreOpaqueRoot::pointer const):
(WebCore::addWebCoreOpaqueRoot):
(WebCore::containsWebCoreOpaqueRoot):

  • Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:

(GenerateImplementation):

  • Source/WebCore/bindings/scripts/test/JS/JSTestGenerateAddOpaqueRoot.cpp:

(WebCore::JSTestGenerateAddOpaqueRoot::visitChildrenImpl):

  • Source/WebCore/bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:

(WebCore::JSTestGenerateIsReachableOwner::isReachableFromOpaqueRoots):

  • Source/WebCore/crypto/CryptoKey.cpp:

(WebCore::root):

  • Source/WebCore/crypto/CryptoKey.h:
  • Source/WebCore/dom/AbortController.cpp:

(WebCore::AbortController::opaqueRoot):

  • Source/WebCore/dom/AbortController.h:
  • Source/WebCore/dom/AbortController.idl:
  • Source/WebCore/dom/AbortSignal.cpp:

(WebCore::root):

  • Source/WebCore/dom/AbortSignal.h:
  • Source/WebCore/dom/DOMPointReadOnly.cpp:

(WebCore::root):

  • Source/WebCore/dom/DOMPointReadOnly.h:
  • Source/WebCore/dom/DOMRectReadOnly.cpp:

(WebCore::root):

  • Source/WebCore/dom/DOMRectReadOnly.h:
  • Source/WebCore/dom/DocumentInlines.h:

(WebCore::Node::opaqueRoot const):

  • Source/WebCore/dom/MessagePort.cpp:

(WebCore::root):

  • Source/WebCore/dom/MessagePort.h:
  • Source/WebCore/dom/MutationObserverRegistration.cpp:

(WebCore::MutationObserverRegistration::isReachableFromOpaqueRoots const):

  • Source/WebCore/dom/MutationRecord.cpp:
  • Source/WebCore/dom/Node.cpp:

(WebCore::Node::traverseToOpaqueRoot const):

  • Source/WebCore/dom/Node.h:

(WebCore::Node::opaqueRoot const): Deleted.

  • Source/WebCore/dom/NodeFilter.h:

(WebCore::root):

  • Source/WebCore/dom/Range.cpp:

(WebCore::Range::visitNodesConcurrently const):

  • Source/WebCore/dom/ScriptExecutionContext.cpp:

(WebCore::root):

  • Source/WebCore/dom/ScriptExecutionContext.h:
  • Source/WebCore/dom/StaticRange.cpp:

(WebCore::StaticRange::visitNodesConcurrently const):

  • Source/WebCore/fileapi/Blob.cpp:

(WebCore::root):

  • Source/WebCore/fileapi/Blob.h:
  • Source/WebCore/html/CanvasBase.cpp:

(WebCore::root):

  • Source/WebCore/html/CanvasBase.h:
  • Source/WebCore/html/HTMLCanvasElement.cpp:

(WebCore::root):

  • Source/WebCore/html/HTMLCanvasElement.h:
  • Source/WebCore/html/HTMLMediaElement.h:
  • Source/WebCore/html/canvas/WebGL2RenderingContext.cpp:

(WebCore::WebGL2RenderingContext::addMembersToOpaqueRoots):

  • Source/WebCore/html/canvas/WebGLFramebuffer.cpp:
  • Source/WebCore/html/canvas/WebGLObject.cpp:

(WebCore::root):

  • Source/WebCore/html/canvas/WebGLObject.h:
  • Source/WebCore/html/canvas/WebGLProgram.cpp:

(WebCore::WebGLProgram::addMembersToOpaqueRoots):

  • Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:

(WebCore::WebGLRenderingContextBase::addMembersToOpaqueRoots):
(WebCore::root):

  • Source/WebCore/html/canvas/WebGLRenderingContextBase.h:
  • Source/WebCore/html/canvas/WebGLTransformFeedback.cpp:

(WebCore::WebGLTransformFeedback::addMembersToOpaqueRoots):

  • Source/WebCore/html/canvas/WebGLVertexArrayObjectBase.cpp:

(WebCore::WebGLVertexArrayObjectBase::addMembersToOpaqueRoots):
(WebCore::root):

  • Source/WebCore/html/canvas/WebGLVertexArrayObjectBase.h:
  • Source/WebCore/html/track/TrackBase.cpp:

(WebCore::TrackBase::opaqueRoot):

  • Source/WebCore/html/track/TrackBase.h:

(WebCore::root):

  • Source/WebCore/html/track/TrackListBase.cpp:

(WebCore::TrackListBase::opaqueRoot):

  • Source/WebCore/html/track/TrackListBase.h:

(WebCore::root):

  • Source/WebCore/page/DOMWindow.cpp:

(WebCore::root):

  • Source/WebCore/page/DOMWindow.h:
  • Source/WebCore/page/IntersectionObserver.cpp:

(WebCore::IntersectionObserver::isReachableFromOpaqueRoots const):

  • Source/WebCore/page/NavigatorBase.cpp:

(WebCore::root):

  • Source/WebCore/page/NavigatorBase.h:
  • Source/WebCore/page/ResizeObserver.cpp:

(WebCore::ResizeObserver::isReachableFromOpaqueRoots const):

  • Source/WebCore/workers/WorkerLocation.cpp:

(WebCore::root):

  • Source/WebCore/workers/WorkerLocation.h:

(WebCore::WorkerLocation::create):
(WebCore::WorkerLocation::url const):
(WebCore::WorkerLocation::WorkerLocation):

  • Source/WebCore/workers/service/ServiceWorkerClients.cpp:

(WebCore::root):

  • Source/WebCore/workers/service/ServiceWorkerClients.h:
  • Source/WebCore/workers/service/ServiceWorkerRegistration.cpp:

(WebCore::root):

  • Source/WebCore/workers/service/ServiceWorkerRegistration.h:
  • Source/WebCore/xml/XMLHttpRequestUpload.cpp:

(WebCore::root):

  • Source/WebCore/xml/XMLHttpRequestUpload.h:

Canonical link: https://commits.webkit.org/251082@main

  • Property svn:eol-style set to native
File size: 2.3 KB
Line 
1/*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#pragma once
27
28#include "XMLHttpRequest.h"
29#include <wtf/Forward.h>
30
31namespace WebCore {
32
33class WebCoreOpaqueRoot;
34
35class XMLHttpRequestUpload final : public XMLHttpRequestEventTarget {
36 WTF_MAKE_ISO_ALLOCATED(XMLHttpRequestUpload);
37public:
38 explicit XMLHttpRequestUpload(XMLHttpRequest&);
39
40 void ref() { m_request.ref(); }
41 void deref() { m_request.deref(); }
42
43 void dispatchProgressEvent(const AtomString& type, unsigned long long loaded, unsigned long long total);
44
45 bool hasRelevantEventListener() const;
46
47private:
48 // EventTarget.
49 void eventListenersDidChange() final;
50 void refEventTarget() final { ref(); }
51 void derefEventTarget() final { deref(); }
52
53 EventTargetInterface eventTargetInterface() const final { return XMLHttpRequestUploadEventTargetInterfaceType; }
54 ScriptExecutionContext* scriptExecutionContext() const final { return m_request.scriptExecutionContext(); }
55
56 XMLHttpRequest& m_request;
57};
58
59WebCoreOpaqueRoot root(XMLHttpRequestUpload*);
60
61} // namespace WebCore
Note: See TracBrowser for help on using the repository browser.