WebKit Bugzilla
Attachment 341904 Details for
Bug 186269
: Make it possible to track unbalanced ref()/deref()
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Hacky patch
reftokens.patch (text/plain), 212.81 KB, created by
Simon Fraser (smfr)
on 2018-06-04 08:23:57 PDT
(
hide
)
Description:
Hacky patch
Filename:
MIME Type:
Creator:
Simon Fraser (smfr)
Created:
2018-06-04 08:23:57 PDT
Size:
212.81 KB
patch
obsolete
>commit 1de9925e791d747c5ad8db6a154e0f7319e593bc >Author: Simon Fraser <simon.fraser@apple.com> >Date: Sun Jun 3 22:16:38 2018 -0700 > > RefToken tracking > >diff --git a/Source/JavaScriptCore/API/JSContextRef.cpp b/Source/JavaScriptCore/API/JSContextRef.cpp >index 025eba4e99c..4246b580c2c 100644 >--- a/Source/JavaScriptCore/API/JSContextRef.cpp >+++ b/Source/JavaScriptCore/API/JSContextRef.cpp >@@ -81,7 +81,7 @@ void JSContextGroupRelease(JSContextGroupRef group) > VM& vm = *toJS(group); > > JSLockHolder locker(&vm); >- vm.deref(); >+ vm.deref(DEREF_DEFAULT_ARGUMENTS); > } > > static bool internalScriptTimeoutCallback(ExecState* exec, void* callbackPtr, void* callbackData) >@@ -179,7 +179,7 @@ void JSGlobalContextRelease(JSGlobalContextRef ctx) > bool protectCountIsZero = Heap::heap(exec->vmEntryGlobalObject())->unprotect(exec->vmEntryGlobalObject()); > if (protectCountIsZero) > vm.heap.reportAbandonedObjectGraph(); >- vm.deref(); >+ vm.deref(DEREF_DEFAULT_ARGUMENTS); > } > > JSObjectRef JSContextGetGlobalObject(JSContextRef ctx) >diff --git a/Source/JavaScriptCore/API/JSObjectRef.cpp b/Source/JavaScriptCore/API/JSObjectRef.cpp >index d80a070b7ab..d36d0ec6b17 100644 >--- a/Source/JavaScriptCore/API/JSObjectRef.cpp >+++ b/Source/JavaScriptCore/API/JSObjectRef.cpp >@@ -79,7 +79,7 @@ JSClassRef JSClassRetain(JSClassRef jsClass) > > void JSClassRelease(JSClassRef jsClass) > { >- jsClass->deref(); >+ jsClass->deref(DEREF_DEFAULT_ARGUMENTS); > } > > JSObjectRef JSObjectMake(JSContextRef ctx, JSClassRef jsClass, void* data) >diff --git a/Source/JavaScriptCore/API/JSScriptRef.cpp b/Source/JavaScriptCore/API/JSScriptRef.cpp >index 33f59a36334..cdb34f99649 100644 >--- a/Source/JavaScriptCore/API/JSScriptRef.cpp >+++ b/Source/JavaScriptCore/API/JSScriptRef.cpp >@@ -139,7 +139,7 @@ void JSScriptRetain(JSScriptRef script) > void JSScriptRelease(JSScriptRef script) > { > JSLockHolder locker(&script->vm()); >- script->deref(); >+ script->deref(DEREF_DEFAULT_ARGUMENTS); > } > > JSValueRef JSScriptEvaluate(JSContextRef context, JSScriptRef script, JSValueRef thisValueRef, JSValueRef* exception) >diff --git a/Source/JavaScriptCore/API/JSStringRef.cpp b/Source/JavaScriptCore/API/JSStringRef.cpp >index 909540481da..44d3065f194 100644 >--- a/Source/JavaScriptCore/API/JSStringRef.cpp >+++ b/Source/JavaScriptCore/API/JSStringRef.cpp >@@ -73,7 +73,7 @@ JSStringRef JSStringRetain(JSStringRef string) > > void JSStringRelease(JSStringRef string) > { >- string->deref(); >+ string->deref(DEREF_DEFAULT_ARGUMENTS); > } > > size_t JSStringGetLength(JSStringRef string) >diff --git a/Source/JavaScriptCore/API/JSWeakPrivate.cpp b/Source/JavaScriptCore/API/JSWeakPrivate.cpp >index 246649f59e3..e35f0d99e14 100644 >--- a/Source/JavaScriptCore/API/JSWeakPrivate.cpp >+++ b/Source/JavaScriptCore/API/JSWeakPrivate.cpp >@@ -60,7 +60,7 @@ void JSWeakRelease(JSContextGroupRef contextGroup, JSWeakRef weakRef) > { > VM* vm = toJS(contextGroup); > JSLockHolder locker(vm); >- weakRef->deref(); >+ weakRef->deref(DEREF_DEFAULT_ARGUMENTS); > } > > JSObjectRef JSWeakGetObject(JSWeakRef weakRef) >diff --git a/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp b/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp >index e7fc761dbed..b5d326db5f6 100644 >--- a/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp >+++ b/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp >@@ -41,7 +41,9 @@ > > namespace JSC { > >+#ifndef ALLOW_REF_TRACING > static_assert(sizeof(UnlinkedFunctionExecutable) <= 160, "UnlinkedFunctionExecutable should fit in a 160-byte cell. If you increase the size of this class, consider making a size class that perfectly fits it."); >+#endif > > const ClassInfo UnlinkedFunctionExecutable::s_info = { "UnlinkedFunctionExecutable", nullptr, nullptr, nullptr, CREATE_METHOD_TABLE(UnlinkedFunctionExecutable) }; > >diff --git a/Source/JavaScriptCore/bytecode/Watchpoint.cpp b/Source/JavaScriptCore/bytecode/Watchpoint.cpp >index 7ab385f585c..ad47ba603fb 100644 >--- a/Source/JavaScriptCore/bytecode/Watchpoint.cpp >+++ b/Source/JavaScriptCore/bytecode/Watchpoint.cpp >@@ -175,7 +175,7 @@ WatchpointSet* InlineWatchpointSet::inflateSlow() > void InlineWatchpointSet::freeFat() > { > ASSERT(isFat()); >- fat()->deref(); >+ fat()->deref(DEREF_DEFAULT_ARGUMENTS); > } > > DeferredWatchpointFire::DeferredWatchpointFire(VM& vm) >diff --git a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp >index 651759f24ef..55fc31ba2ce 100644 >--- a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp >+++ b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp >@@ -2292,14 +2292,14 @@ void BytecodeGenerator::popLexicalScopeInternal(VariableEnvironment& environment > VarOffset offset = symbolTableEntry.varOffset(); > ASSERT(offset.isStack()); > RegisterID* local = ®isterFor(offset.stackOffset()); >- local->deref(); >+ local->deref(DEREF_DEFAULT_ARGUMENTS); > } > > if (hasCapturedVariables) { > RELEASE_ASSERT(stackEntry.m_scope); > emitPopScope(scopeRegister(), stackEntry.m_scope); > popLocalControlFlowScope(); >- stackEntry.m_scope->deref(); >+ stackEntry.m_scope->deref(DEREF_DEFAULT_ARGUMENTS); > } > > m_TDZStack.removeLast(); >@@ -2372,7 +2372,7 @@ void BytecodeGenerator::prepareLexicalScopeForNextForLoopIteration(VariableEnvir > RELEASE_ASSERT(!entry.isNull()); > RegisterID* transitionValue = pair.first; > emitPutToScope(loopScope, variableForLocalEntry(identifier, entry, loopSymbolTable->index(), true), transitionValue, DoNotThrowIfNotFound, InitializationMode::NotInitialization); >- transitionValue->deref(); >+ transitionValue->deref(DEREF_DEFAULT_ARGUMENTS); > } > } > } >@@ -3840,7 +3840,7 @@ void BytecodeGenerator::emitPopWithScope() > emitPopScope(scopeRegister(), scopeRegister()); > popLocalControlFlowScope(); > auto stackEntry = m_lexicalScopeStack.takeLast(); >- stackEntry.m_scope->deref(); >+ stackEntry.m_scope->deref(DEREF_DEFAULT_ARGUMENTS); > RELEASE_ASSERT(stackEntry.m_isWithScope); > } > >diff --git a/Source/JavaScriptCore/bytecompiler/Label.h b/Source/JavaScriptCore/bytecompiler/Label.h >index 3e2d297f23d..462f83f50a2 100644 >--- a/Source/JavaScriptCore/bytecompiler/Label.h >+++ b/Source/JavaScriptCore/bytecompiler/Label.h >@@ -54,8 +54,12 @@ namespace JSC { > return m_location - opcode; > } > >- void ref() { ++m_refCount; } >- void deref() >+ REF_RETURN_TYPE ref() >+ { >+ ++m_refCount; >+ DEFAULT_REF_RETURN; >+ } >+ void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS) > { > --m_refCount; > ASSERT(m_refCount >= 0); >diff --git a/Source/JavaScriptCore/bytecompiler/LabelScope.h b/Source/JavaScriptCore/bytecompiler/LabelScope.h >index a94bf05ada4..11675687194 100644 >--- a/Source/JavaScriptCore/bytecompiler/LabelScope.h >+++ b/Source/JavaScriptCore/bytecompiler/LabelScope.h >@@ -56,8 +56,12 @@ public: > const Identifier* name() const { return m_name; } > int scopeDepth() const { return m_scopeDepth; } > >- void ref() { ++m_refCount; } >- void deref() >+ REF_RETURN_TYPE ref() >+ { >+ ++m_refCount; >+ DEFAULT_REF_RETURN; >+ } >+ void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS) > { > --m_refCount; > ASSERT(m_refCount >= 0); >diff --git a/Source/JavaScriptCore/bytecompiler/RegisterID.h b/Source/JavaScriptCore/bytecompiler/RegisterID.h >index cc80f5eb891..86081191880 100644 >--- a/Source/JavaScriptCore/bytecompiler/RegisterID.h >+++ b/Source/JavaScriptCore/bytecompiler/RegisterID.h >@@ -97,12 +97,13 @@ namespace JSC { > return m_isTemporary; > } > >- void ref() >+ REF_RETURN_TYPE ref() > { > ++m_refCount; >+ DEFAULT_REF_RETURN; > } > >- void deref() >+ void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS) > { > --m_refCount; > ASSERT(m_refCount >= 0); >diff --git a/Source/JavaScriptCore/dfg/DFGLazyJSValue.cpp b/Source/JavaScriptCore/dfg/DFGLazyJSValue.cpp >index 43bead62ff9..fb6861b2614 100644 >--- a/Source/JavaScriptCore/dfg/DFGLazyJSValue.cpp >+++ b/Source/JavaScriptCore/dfg/DFGLazyJSValue.cpp >@@ -235,7 +235,7 @@ void LazyJSValue::emit(CCallHelpers& jit, JSValueRegs result) const > codeBlock->addConstant(realValue); > > if (thisValue.m_kind == NewStringImpl) >- thisValue.u.stringImpl->deref(); >+ thisValue.u.stringImpl->deref(DEREF_DEFAULT_ARGUMENTS); > > linkBuffer.patch(label, realValue.asCell()); > }); >diff --git a/Source/JavaScriptCore/heap/MarkingConstraint.cpp b/Source/JavaScriptCore/heap/MarkingConstraint.cpp >index 3bab7679c55..bdcad0b4caf 100644 >--- a/Source/JavaScriptCore/heap/MarkingConstraint.cpp >+++ b/Source/JavaScriptCore/heap/MarkingConstraint.cpp >@@ -31,7 +31,7 @@ > > namespace JSC { > >-static constexpr bool verboseMarkingConstraint = false; >+static constexpr bool verboseMarkingConstraint = true; > > MarkingConstraint::MarkingConstraint(CString abbreviatedName, CString name, ConstraintVolatility volatility, ConstraintConcurrency concurrency, ConstraintParallelism parallelism) > : m_abbreviatedName(abbreviatedName) >@@ -57,7 +57,7 @@ void MarkingConstraint::execute(SlotVisitor& visitor) > executeImpl(visitor); > m_lastVisitCount += visitCounter.visitCount(); > if (verboseMarkingConstraint && visitCounter.visitCount()) >- dataLog("(", abbreviatedName(), " visited ", visitCounter.visitCount(), " in execute)"); >+ dataLog("(", name(), " visited ", visitCounter.visitCount(), " in execute)"); > } > > double MarkingConstraint::quickWorkEstimate(SlotVisitor&) >@@ -86,7 +86,7 @@ void MarkingConstraint::doParallelWork(SlotVisitor& visitor, SharedTask<void(Slo > VisitCounter visitCounter(visitor); > task.run(visitor); > if (verboseMarkingConstraint && visitCounter.visitCount()) >- dataLog("(", abbreviatedName(), " visited ", visitCounter.visitCount(), " in doParallelWork)"); >+ dataLog("(", name(), " visited ", visitCounter.visitCount(), " in doParallelWork)"); > { > auto locker = holdLock(m_lock); > m_lastVisitCount += visitCounter.visitCount(); >diff --git a/Source/JavaScriptCore/inspector/JSJavaScriptCallFrame.cpp b/Source/JavaScriptCore/inspector/JSJavaScriptCallFrame.cpp >index a400425b851..57afe6c755e 100644 >--- a/Source/JavaScriptCore/inspector/JSJavaScriptCallFrame.cpp >+++ b/Source/JavaScriptCore/inspector/JSJavaScriptCallFrame.cpp >@@ -65,7 +65,7 @@ void JSJavaScriptCallFrame::destroy(JSC::JSCell* cell) > void JSJavaScriptCallFrame::releaseImpl() > { > if (auto impl = std::exchange(m_impl, nullptr)) >- impl->deref(); >+ impl->deref(DEREF_DEFAULT_ARGUMENTS); > } > > JSJavaScriptCallFrame::~JSJavaScriptCallFrame() >diff --git a/Source/JavaScriptCore/inspector/remote/cocoa/RemoteConnectionToTargetCocoa.mm b/Source/JavaScriptCore/inspector/remote/cocoa/RemoteConnectionToTargetCocoa.mm >index 3e894136b36..4b3b5aa3949 100644 >--- a/Source/JavaScriptCore/inspector/remote/cocoa/RemoteConnectionToTargetCocoa.mm >+++ b/Source/JavaScriptCore/inspector/remote/cocoa/RemoteConnectionToTargetCocoa.mm >@@ -183,7 +183,7 @@ bool RemoteConnectionToTarget::setup(bool isAutomaticInspection, bool automatica > RemoteInspector::singleton().updateTargetListing(targetIdentifier); > } > } >- deref(); >+ deref(DEREF_DEFAULT_ARGUMENTS); > }); > > return true; >@@ -213,7 +213,7 @@ void RemoteConnectionToTarget::close() > RemoteInspector::singleton().updateTargetListing(targetIdentifier); > } > } >- deref(); >+ deref(DEREF_DEFAULT_ARGUMENTS); > }); > } > >@@ -232,7 +232,7 @@ void RemoteConnectionToTarget::sendMessageToTarget(NSString *message) > > target->dispatchMessageFromRemote(message); > } >- deref(); >+ deref(DEREF_DEFAULT_ARGUMENTS); > }); > } > >diff --git a/Source/JavaScriptCore/inspector/remote/cocoa/RemoteInspectorXPCConnection.mm b/Source/JavaScriptCore/inspector/remote/cocoa/RemoteInspectorXPCConnection.mm >index cf00ba75c6b..b3801b43675 100644 >--- a/Source/JavaScriptCore/inspector/remote/cocoa/RemoteInspectorXPCConnection.mm >+++ b/Source/JavaScriptCore/inspector/remote/cocoa/RemoteInspectorXPCConnection.mm >@@ -164,7 +164,7 @@ void RemoteInspectorXPCConnection::handleEvent(xpc_object_t object) > if (object == XPC_ERROR_CONNECTION_INVALID) { > // This is the last event we will ever receive from the connection. > // This balances the ref() in the constructor. >- deref(); >+ deref(DEREF_DEFAULT_ARGUMENTS); > } > return; > } >diff --git a/Source/JavaScriptCore/jit/JITStubRoutine.h b/Source/JavaScriptCore/jit/JITStubRoutine.h >index 33d2a3673d7..ff88da8db36 100644 >--- a/Source/JavaScriptCore/jit/JITStubRoutine.h >+++ b/Source/JavaScriptCore/jit/JITStubRoutine.h >@@ -78,12 +78,13 @@ public: > return result; > } > >- void ref() >+ REF_RETURN_TYPE ref() > { > m_refCount++; >+ DEFAULT_REF_RETURN; > } > >- void deref() >+ void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS) > { > if (--m_refCount) > return; >diff --git a/Source/JavaScriptCore/jsc.cpp b/Source/JavaScriptCore/jsc.cpp >index 4cbbb3d88ab..7df1f4f9e8c 100644 >--- a/Source/JavaScriptCore/jsc.cpp >+++ b/Source/JavaScriptCore/jsc.cpp >@@ -2750,7 +2750,7 @@ int runJSC(CommandLine options, bool isWorker, const Func& func) > JSLockHolder locker(vm); > // This is needed because we don't want the worker's main > // thread to die before its compilation threads finish. >- vm.deref(); >+ vm.deref(DEREF_DEFAULT_ARGUMENTS); > } > > return result; >diff --git a/Source/JavaScriptCore/parser/SourceProviderCacheItem.h b/Source/JavaScriptCore/parser/SourceProviderCacheItem.h >index d0644d2df17..0447d9a986f 100644 >--- a/Source/JavaScriptCore/parser/SourceProviderCacheItem.h >+++ b/Source/JavaScriptCore/parser/SourceProviderCacheItem.h >@@ -109,7 +109,7 @@ private: > inline SourceProviderCacheItem::~SourceProviderCacheItem() > { > for (unsigned i = 0; i < usedVariablesCount; ++i) >- m_variables[i]->deref(); >+ m_variables[i]->deref(DEREF_DEFAULT_ARGUMENTS); > } > > inline std::unique_ptr<SourceProviderCacheItem> SourceProviderCacheItem::create(const SourceProviderCacheItemCreationParameters& parameters) >diff --git a/Source/JavaScriptCore/runtime/HasOwnPropertyCache.h b/Source/JavaScriptCore/runtime/HasOwnPropertyCache.h >index adadc89ab84..bbe08bb49f4 100644 >--- a/Source/JavaScriptCore/runtime/HasOwnPropertyCache.h >+++ b/Source/JavaScriptCore/runtime/HasOwnPropertyCache.h >@@ -39,12 +39,27 @@ public: > > struct Entry { > static ptrdiff_t offsetOfStructureID() { return OBJECT_OFFSETOF(Entry, structureID); } >- static ptrdiff_t offsetOfImpl() { return OBJECT_OFFSETOF(Entry, impl); } >+ static ptrdiff_t offsetOfImpl() { return OBJECT_OFFSETOF(Entry, stringImpl); } > static ptrdiff_t offsetOfResult() { return OBJECT_OFFSETOF(Entry, result); } > >- RefPtr<UniquedStringImpl> impl; >+ UniquedStringImpl* stringImpl; > StructureID structureID { 0 }; > bool result { false }; >+ >+ Entry(UniquedStringImpl* impl = nullptr, StructureID structID = 0, bool res = false) >+ : stringImpl(impl) >+ , structureID(structID) >+ , result(res) >+ { >+ if (stringImpl) >+ stringImpl->ref(); >+ } >+ >+ ~Entry() >+ { >+ if (stringImpl) >+ stringImpl->deref(DEREF_DEFAULT_ARGUMENTS); >+ } > }; > > HasOwnPropertyCache() = delete; >@@ -74,7 +89,7 @@ public: > StructureID id = structure->id(); > uint32_t index = HasOwnPropertyCache::hash(id, impl) & mask; > Entry& entry = bitwise_cast<Entry*>(this)[index]; >- if (entry.structureID == id && entry.impl.get() == impl) >+ if (entry.structureID == id && entry.stringImpl == impl) > return entry.result; > return std::nullopt; > } >@@ -105,7 +120,7 @@ public: > UniquedStringImpl* impl = propName.uid(); > StructureID id = structure->id(); > uint32_t index = HasOwnPropertyCache::hash(id, impl) & mask; >- bitwise_cast<Entry*>(this)[index] = Entry { RefPtr<UniquedStringImpl>(impl), id, result }; >+ bitwise_cast<Entry*>(this)[index] = Entry(impl, id, result); > } > } > >diff --git a/Source/JavaScriptCore/runtime/PropertyMapHashTable.h b/Source/JavaScriptCore/runtime/PropertyMapHashTable.h >index f7d1f73ba52..3fb25d144ee 100644 >--- a/Source/JavaScriptCore/runtime/PropertyMapHashTable.h >+++ b/Source/JavaScriptCore/runtime/PropertyMapHashTable.h >@@ -387,7 +387,7 @@ inline void PropertyTable::remove(const find_iterator& iter) > // Replace this one element with the deleted sentinel. Also clear out > // the entry so we can iterate all the entries as needed. > m_index[iter.second] = deletedEntryIndex(); >- iter.first->key->deref(); >+ iter.first->key->deref(DEREF_DEFAULT_ARGUMENTS); > iter.first->key = PROPERTY_MAP_DELETED_ENTRY_KEY; > > ASSERT(m_keyCount >= 1); >diff --git a/Source/JavaScriptCore/runtime/PropertyTable.cpp b/Source/JavaScriptCore/runtime/PropertyTable.cpp >index 59ec41c49ae..8631c26da8e 100644 >--- a/Source/JavaScriptCore/runtime/PropertyTable.cpp >+++ b/Source/JavaScriptCore/runtime/PropertyTable.cpp >@@ -119,7 +119,7 @@ PropertyTable::~PropertyTable() > { > iterator end = this->end(); > for (iterator iter = begin(); iter != end; ++iter) >- iter->key->deref(); >+ iter->key->deref(DEREF_DEFAULT_ARGUMENTS); > > fastFree(m_index); > } >diff --git a/Source/WTF/WTF.xcodeproj/project.pbxproj b/Source/WTF/WTF.xcodeproj/project.pbxproj >index 1043b8d6223..5b73c93ba31 100644 >--- a/Source/WTF/WTF.xcodeproj/project.pbxproj >+++ b/Source/WTF/WTF.xcodeproj/project.pbxproj >@@ -32,6 +32,7 @@ > 0F66B2901DC97BAB004A1D3F /* TimeWithDynamicClockType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F66B2861DC97BAB004A1D3F /* TimeWithDynamicClockType.cpp */; }; > 0F66B2921DC97BAB004A1D3F /* WallTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F66B2881DC97BAB004A1D3F /* WallTime.cpp */; }; > 0F7075F51FBF53CD00489AF0 /* TimingScope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F7075F41FBF537A00489AF0 /* TimingScope.cpp */; }; >+ 0F77584620C502F200AB5A51 /* RefTracker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F77584520C502F100AB5A51 /* RefTracker.cpp */; }; > 0F7C5FB61D885CF20044F5E2 /* FastBitVector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F7C5FB51D885CF20044F5E2 /* FastBitVector.cpp */; }; > 0F824A681B7443A0002E345D /* ParkingLot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F824A641B7443A0002E345D /* ParkingLot.cpp */; }; > 0F8E85DB1FD485B000691889 /* CountingLock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F8E85DA1FD485B000691889 /* CountingLock.cpp */; }; >@@ -217,6 +218,8 @@ > 0F7075F31FBF537A00489AF0 /* TimingScope.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TimingScope.h; sourceTree = "<group>"; }; > 0F7075F41FBF537A00489AF0 /* TimingScope.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = TimingScope.cpp; sourceTree = "<group>"; }; > 0F725CAB1C50461600AD943A /* RangeSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RangeSet.h; sourceTree = "<group>"; }; >+ 0F77584520C502F100AB5A51 /* RefTracker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RefTracker.cpp; sourceTree = "<group>"; }; >+ 0F77584720C502FE00AB5A51 /* RefTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RefTracker.h; sourceTree = "<group>"; }; > 0F79C7C31E73511800EB34D1 /* FastTLS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FastTLS.h; sourceTree = "<group>"; }; > 0F7C5FB51D885CF20044F5E2 /* FastBitVector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FastBitVector.cpp; sourceTree = "<group>"; }; > 0F7EB85B1FA8FF4100F1ABCB /* IsoMalloc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IsoMalloc.h; sourceTree = "<group>"; }; >@@ -1036,6 +1039,8 @@ > A8A47302151A825B004123FF /* RefCountedLeakCounter.h */, > 86F46F5F1A2840EE00CCBF22 /* RefCounter.h */, > A8A47303151A825B004123FF /* RefPtr.h */, >+ 0F77584720C502FE00AB5A51 /* RefTracker.h */, >+ 0F77584520C502F100AB5A51 /* RefTracker.cpp */, > A8A47305151A825B004123FF /* RetainPtr.h */, > 2CDED0F118115C85004DBA70 /* RunLoop.cpp */, > 2CDED0F218115C85004DBA70 /* RunLoop.h */, >@@ -1527,6 +1532,7 @@ > 3337DB9CE743410FAF076E17 /* StackTrace.cpp in Sources */, > A8A4743C151A825B004123FF /* StringBuilder.cpp in Sources */, > E38D6E271F5522E300A75CC4 /* StringBuilderJSON.cpp in Sources */, >+ 0F77584620C502F200AB5A51 /* RefTracker.cpp in Sources */, > A5BA15FB182435A600A82E69 /* StringCF.cpp in Sources */, > A8A47440151A825B004123FF /* StringImpl.cpp in Sources */, > A5BA15FC182435A600A82E69 /* StringImplCF.cpp in Sources */, >diff --git a/Source/WTF/wtf/DeferrableRefCounted.h b/Source/WTF/wtf/DeferrableRefCounted.h >index 796481a33cf..5047422467f 100644 >--- a/Source/WTF/wtf/DeferrableRefCounted.h >+++ b/Source/WTF/wtf/DeferrableRefCounted.h >@@ -42,9 +42,10 @@ class DeferrableRefCountedBase { > static const unsigned normalIncrement = 2; > > public: >- void ref() const >+ REF_RETURN_TYPE ref() const > { > m_refCount += normalIncrement; >+ DEFAULT_REF_RETURN; > } > > bool hasOneRef() const >@@ -72,7 +73,7 @@ protected: > { > } > >- bool derefBase() const >+ bool derefBase(DEREF_ARGUMENT_TYPE) const > { > m_refCount -= normalIncrement; > return !m_refCount; >@@ -96,9 +97,9 @@ template<typename T> > class DeferrableRefCounted : public DeferrableRefCountedBase { > WTF_MAKE_NONCOPYABLE(DeferrableRefCounted); WTF_MAKE_FAST_ALLOCATED; > public: >- void deref() const >+ void deref(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) const > { >- if (derefBase()) >+ if (derefBase(DEREF_ARGUMENT_NAME)) > delete static_cast<const T*>(this); > } > >diff --git a/Source/WTF/wtf/Ref.h b/Source/WTF/wtf/Ref.h >index 3b3158dfb6e..7c74c1d3270 100644 >--- a/Source/WTF/wtf/Ref.h >+++ b/Source/WTF/wtf/Ref.h >@@ -39,10 +39,30 @@ extern "C" void __asan_unpoison_memory_region(void const volatile *addr, size_t > extern "C" int __asan_address_is_poisoned(void const volatile *addr); > #endif > >+// Define ALLOW_REF_TRACING to enable debugging code that detects mismatched ref()/deref(). >+#define ALLOW_REF_TRACING 1 >+ >+#if ALLOW_REF_TRACING >+#define REF_RETURN_TYPE WTF::RefToken >+#define DEREF_ARGUMENT_TYPE WTF::RefToken >+#define DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS WTF::RefToken = 0 >+#define DEREF_DEFAULT_ARGUMENTS 0 >+#define DEREF_ARGUMENT_NAME token >+#define DEFAULT_REF_RETURN return 0 >+#else >+#define REF_RETURN_TYPE void >+#define DEREF_ARGUMENT_TYPE >+#define DEREF_DEFAULT_ARGUMENTS >+#define DEREF_ARGUMENT_NAME >+#define DEFAULT_REF_RETURN return >+#endif >+ > namespace WTF { > > inline void adopted(const void*) { } > >+typedef unsigned RefToken; >+ > template<typename T, typename PtrTraits> class Ref; > template<typename T, typename PtrTraits = DumbPtrTraits<T>> Ref<T, PtrTraits> adoptRef(T&); > >@@ -58,12 +78,19 @@ public: > __asan_unpoison_memory_region(this, sizeof(*this)); > #endif > if (m_ptr) >- PtrTraits::unwrap(m_ptr)->deref(); >+ PtrTraits::unwrap(m_ptr)->deref( >+#if ALLOW_REF_TRACING >+ m_token >+#endif >+ ); > } > > Ref(T& object) > : m_ptr(&object) > { >+#if ALLOW_REF_TRACING >+ m_token = >+#endif > object.ref(); > } > >@@ -73,6 +100,9 @@ public: > > Ref(Ref&& other) > : m_ptr(&other.leakRef()) >+#if ALLOW_REF_TRACING >+ , m_token(other.token()) >+#endif > { > ASSERT(m_ptr); > } >@@ -80,6 +110,9 @@ public: > template<typename X, typename Y> > Ref(Ref<X, Y>&& other) > : m_ptr(&other.leakRef()) >+#if ALLOW_REF_TRACING >+ , m_token(other.token()) >+#endif > { > ASSERT(m_ptr); > } >@@ -139,6 +172,11 @@ public: > return result; > } > >+#if ALLOW_REF_TRACING >+ RefToken token() const { return m_token; } >+ void setToken(RefToken token) { m_token = token; } >+#endif >+ > private: > friend Ref adoptRef<T>(T&); > template<typename X, typename Y> friend class Ref; >@@ -146,10 +184,16 @@ private: > enum AdoptTag { Adopt }; > Ref(T& object, AdoptTag) > : m_ptr(&object) >+#if ALLOW_REF_TRACING >+ , m_token(0) >+#endif > { > } > > typename PtrTraits::StorageType m_ptr; >+#if ALLOW_REF_TRACING >+ RefToken m_token; >+#endif > }; > > template<typename T, typename U> Ref<T, U> adoptRef(T&); >@@ -193,6 +237,9 @@ template<typename X, typename Y> > inline void Ref<T, U>::swap(Ref<X, Y>& other) > { > U::swap(m_ptr, other.m_ptr); >+#if ALLOW_REF_TRACING >+ std::swap(m_token, other.m_token); >+#endif > } > > template<typename T, typename U, typename X, typename Y, typename = std::enable_if_t<!std::is_same<U, DumbPtrTraits<T>>::value || !std::is_same<Y, DumbPtrTraits<X>>::value>> >diff --git a/Source/WTF/wtf/RefCounted.h b/Source/WTF/wtf/RefCounted.h >index 13762e07aef..74d5b7417fa 100644 >--- a/Source/WTF/wtf/RefCounted.h >+++ b/Source/WTF/wtf/RefCounted.h >@@ -23,6 +23,7 @@ > #include <wtf/Assertions.h> > #include <wtf/FastMalloc.h> > #include <wtf/Noncopyable.h> >+#include <wtf/Ref.h> > > namespace WTF { > >@@ -37,13 +38,14 @@ namespace WTF { > // generated by the compiler (technique called template hoisting). > class RefCountedBase { > public: >- void ref() const >+ REF_RETURN_TYPE ref() const > { > #if CHECK_REF_COUNTED_LIFECYCLE > ASSERT_WITH_SECURITY_IMPLICATION(!m_deletionHasBegun); > ASSERT(!m_adoptionIsRequired); > #endif > ++m_refCount; >+ DEFAULT_REF_RETURN; > } > > bool hasOneRef() const >@@ -87,7 +89,7 @@ protected: > } > > // Returns whether the pointer should be freed or not. >- bool derefBase() const >+ bool derefBase(DEREF_ARGUMENT_TYPE) const > { > #if CHECK_REF_COUNTED_LIFECYCLE > ASSERT_WITH_SECURITY_IMPLICATION(!m_deletionHasBegun); >@@ -139,9 +141,9 @@ inline void adopted(RefCountedBase* object) > template<typename T> class RefCounted : public RefCountedBase { > WTF_MAKE_NONCOPYABLE(RefCounted); WTF_MAKE_FAST_ALLOCATED; > public: >- void deref() const >+ void deref(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) const > { >- if (derefBase()) >+ if (derefBase(DEREF_ARGUMENT_NAME)) > delete static_cast<const T*>(this); > } > >diff --git a/Source/WTF/wtf/RefCounter.h b/Source/WTF/wtf/RefCounter.h >index 26e11f47d95..d031484135c 100644 >--- a/Source/WTF/wtf/RefCounter.h >+++ b/Source/WTF/wtf/RefCounter.h >@@ -42,8 +42,8 @@ class RefCounter { > class Count { > WTF_MAKE_NONCOPYABLE(Count); > public: >- void ref(); >- void deref(); >+ REF_RETURN_TYPE ref(); >+ void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS); > > void refCounterWasDeleted(); > >@@ -84,15 +84,17 @@ private: > }; > > template<typename T> >-inline void RefCounter<T>::Count::ref() >+inline REF_RETURN_TYPE RefCounter<T>::Count::ref() > { > ++m_value; > if (m_refCounter && m_refCounter->m_valueDidChange) > m_refCounter->m_valueDidChange(RefCounterEvent::Increment); >+ >+ DEFAULT_REF_RETURN; > } > > template<typename T> >-inline void RefCounter<T>::Count::deref() >+inline void RefCounter<T>::Count::deref(DEREF_ARGUMENT_TYPE) > { > ASSERT(m_value); > >diff --git a/Source/WTF/wtf/RefPtr.h b/Source/WTF/wtf/RefPtr.h >index 522085353b8..3cea6145c88 100644 >--- a/Source/WTF/wtf/RefPtr.h >+++ b/Source/WTF/wtf/RefPtr.h >@@ -33,6 +33,21 @@ namespace WTF { > template<typename T, typename PtrTraits> class RefPtr; > template<typename T, typename PtrTraits = DumbPtrTraits<T>> RefPtr<T, PtrTraits> adoptRef(T*); > >+#if ALLOW_REF_TRACING >+template<typename T> ALWAYS_INLINE RefToken refIfNotNull(T* ptr) >+{ >+ if (LIKELY(ptr != nullptr)) >+ return ptr->ref(); >+ >+ return 0; >+} >+ >+template<typename T> ALWAYS_INLINE void derefIfNotNull(T* ptr, RefToken token = 0) >+{ >+ if (LIKELY(ptr != nullptr)) >+ ptr->deref(token); >+} >+#else > template<typename T> ALWAYS_INLINE void refIfNotNull(T* ptr) > { > if (LIKELY(ptr != nullptr)) >@@ -44,6 +59,7 @@ template<typename T> ALWAYS_INLINE void derefIfNotNull(T* ptr) > if (LIKELY(ptr != nullptr)) > ptr->deref(); > } >+#endif > > template<typename T, typename PtrTraits> > class RefPtr { >@@ -54,25 +70,92 @@ public: > > static constexpr bool isRefPtr = true; > >- ALWAYS_INLINE constexpr RefPtr() : m_ptr(nullptr) { } >- ALWAYS_INLINE RefPtr(T* ptr) : m_ptr(ptr) { refIfNotNull(ptr); } >- ALWAYS_INLINE RefPtr(const RefPtr& o) : m_ptr(o.m_ptr) { refIfNotNull(PtrTraits::unwrap(m_ptr)); } >- template<typename X, typename Y> RefPtr(const RefPtr<X, Y>& o) : m_ptr(o.get()) { refIfNotNull(PtrTraits::unwrap(m_ptr)); } >- >- ALWAYS_INLINE RefPtr(RefPtr&& o) : m_ptr(o.leakRef()) { } >- template<typename X, typename Y> RefPtr(RefPtr<X, Y>&& o) : m_ptr(o.leakRef()) { } >+ ALWAYS_INLINE constexpr RefPtr() >+ : m_ptr(nullptr) >+ , m_token(0) >+ { } >+ >+ ALWAYS_INLINE RefPtr(T* ptr) >+ : m_ptr(ptr) >+ { >+#if ALLOW_REF_TRACING >+ m_token = >+#endif >+ refIfNotNull(ptr); >+ } >+ >+ ALWAYS_INLINE RefPtr(const RefPtr& o) >+ : m_ptr(o.m_ptr) >+ { >+#if ALLOW_REF_TRACING >+ m_token = >+#endif >+ refIfNotNull(PtrTraits::unwrap(m_ptr)); >+ } >+ >+ template<typename X, typename Y> RefPtr(const RefPtr<X, Y>& o) >+ : m_ptr(o.get()) >+ { >+#if ALLOW_REF_TRACING >+ m_token = >+#endif >+ refIfNotNull(PtrTraits::unwrap(m_ptr)); >+ } >+ >+ ALWAYS_INLINE RefPtr(RefPtr&& o) >+ : m_ptr(o.leakRef()) >+#if ALLOW_REF_TRACING >+ , m_token(o.token()) >+#endif >+ { >+ } >+ >+ template<typename X, typename Y> RefPtr(RefPtr<X, Y>&& o) >+ : m_ptr(o.leakRef()) >+#if ALLOW_REF_TRACING >+ , m_token(o.token()) >+#endif >+ { >+ } >+ > template<typename X, typename Y> RefPtr(Ref<X, Y>&&); > > // Hash table deleted values, which are only constructed and never copied or destroyed. > RefPtr(HashTableDeletedValueType) : m_ptr(hashTableDeletedValue()) { } > bool isHashTableDeletedValue() const { return m_ptr == hashTableDeletedValue(); } > >- ALWAYS_INLINE ~RefPtr() { derefIfNotNull(PtrTraits::exchange(m_ptr, nullptr)); } >+ ALWAYS_INLINE ~RefPtr() >+ { >+ derefIfNotNull(PtrTraits::exchange(m_ptr, nullptr) >+#if ALLOW_REF_TRACING >+ , m_token >+#endif >+ ); >+ } > > T* get() const { return PtrTraits::unwrap(m_ptr); } > >- Ref<T> releaseNonNull() { ASSERT(m_ptr); Ref<T> tmp(adoptRef(*m_ptr)); m_ptr = nullptr; return tmp; } >- Ref<const T> releaseConstNonNull() { ASSERT(m_ptr); Ref<const T> tmp(adoptRef(*m_ptr)); m_ptr = nullptr; return tmp; } >+ Ref<T> releaseNonNull() >+ { >+ ASSERT(m_ptr); >+ Ref<T> tmp(adoptRef(*m_ptr)); >+ m_ptr = nullptr; >+#if ALLOW_REF_TRACING >+ tmp.setToken(m_token); >+#endif >+ return tmp; >+ } >+ >+ Ref<const T> releaseConstNonNull() >+ { >+ ASSERT(m_ptr); >+ Ref<const T> tmp(adoptRef(*m_ptr)); >+ m_ptr = nullptr; >+#if ALLOW_REF_TRACING >+ tmp.setToken(m_token); >+#endif >+ return tmp; >+ } > > T* leakRef() WARN_UNUSED_RETURN; > >@@ -102,20 +185,36 @@ public: > RefPtr copyRef() && = delete; > RefPtr copyRef() const & WARN_UNUSED_RETURN { return RefPtr(m_ptr); } > >+#if ALLOW_REF_TRACING >+ RefToken token() const { return m_token; } >+ void setToken(RefToken token) { m_token = token; } >+#endif >+ > private: > friend RefPtr adoptRef<T, PtrTraits>(T*); > template<typename X, typename Y> friend class RefPtr; > > enum AdoptTag { Adopt }; >- RefPtr(T* ptr, AdoptTag) : m_ptr(ptr) { } >+ RefPtr(T* ptr, AdoptTag) >+ : m_ptr(ptr) >+#if ALLOW_REF_TRACING >+ , m_token(0) >+#endif >+ { } > > typename PtrTraits::StorageType m_ptr; >+#if ALLOW_REF_TRACING >+ RefToken m_token; >+#endif > }; > > template<typename T, typename U> > template<typename X, typename Y> > inline RefPtr<T, U>::RefPtr(Ref<X, Y>&& reference) > : m_ptr(&reference.leakRef()) >+#if ALLOW_REF_TRACING >+ , m_token(reference.token()) >+#endif > { > } > >@@ -153,7 +252,11 @@ inline RefPtr<T, U>& RefPtr<T, U>::operator=(T* optr) > template<typename T, typename U> > inline RefPtr<T, U>& RefPtr<T, U>::operator=(std::nullptr_t) > { >- derefIfNotNull(U::exchange(m_ptr, nullptr)); >+ derefIfNotNull(U::exchange(m_ptr, nullptr) >+#if ALLOW_REF_TRACING >+ , m_token >+#endif >+ ); > return *this; > } > >@@ -185,9 +288,12 @@ inline RefPtr<T, V>& RefPtr<T, V>::operator=(Ref<U>&& reference) > > template<class T, typename U> > template<typename X, typename Y> >-inline void RefPtr<T, U>::swap(RefPtr<X, Y>& o) >+inline void RefPtr<T, U>::swap(RefPtr<X, Y>& other) > { >- U::swap(m_ptr, o.m_ptr); >+ U::swap(m_ptr, other.m_ptr); >+#if ALLOW_REF_TRACING >+ std::swap(m_token, other.m_token); >+#endif > } > > template<typename T, typename U, typename X, typename Y, typename = std::enable_if_t<!std::is_same<U, DumbPtrTraits<T>>::value || !std::is_same<Y, DumbPtrTraits<X>>::value>> >diff --git a/Source/WTF/wtf/RefTracker.cpp b/Source/WTF/wtf/RefTracker.cpp >new file mode 100644 >index 00000000000..e5d13c48717 >--- /dev/null >+++ b/Source/WTF/wtf/RefTracker.cpp >@@ -0,0 +1,79 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "RefTracker.h" >+ >+#include "StackShot.h" >+ >+namespace WTF { >+ >+static RefToken nextRefToken() >+{ >+ static RefToken token; >+ return ++token; >+} >+ >+RefTracker::RefTracker() >+{ >+} >+ >+RefTracker::~RefTracker() >+{ >+} >+ >+void RefTracker::dumpRemainingReferences() const >+{ >+ for (const auto& tokenAndStack : m_refBacktraceMap) { >+ const auto& stackShot = *tokenAndStack.value; >+ >+ WTFLogAlways("Backtrace for token %u\n", tokenAndStack.key); >+ const size_t framesToSkip = 4; >+ WTFPrintBacktrace(stackShot.array() + framesToSkip, stackShot.size() - framesToSkip); >+ WTFLogAlways("\n"); >+ } >+} >+ >+RefToken RefTracker::trackRef() >+{ >+ RefToken token = nextRefToken(); >+ const size_t maxStackSize = 512; >+ m_refBacktraceMap.add(token, std::make_unique<StackShot>(maxStackSize)); >+ return token; >+} >+ >+void RefTracker::trackDeref(RefToken token) >+{ >+ if (!token) >+ return; >+ >+ bool removed = m_refBacktraceMap.remove(token); >+ if (!removed) >+ WTFLogAlways("RefTracker::deref() passed token %u that was not tracked or already removed", token); >+} >+ >+ >+} // namespace WTF >+ >diff --git a/Source/WTF/wtf/RefTracker.h b/Source/WTF/wtf/RefTracker.h >new file mode 100644 >index 00000000000..e0663ab73f7 >--- /dev/null >+++ b/Source/WTF/wtf/RefTracker.h >@@ -0,0 +1,56 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include <wtf/HashMap.h> >+#include <wtf/Ref.h> >+ >+#if ALLOW_REF_TRACING >+ >+namespace WTF { >+ >+class StackShot; >+ >+class RefTracker >+{ >+public: >+ WTF_EXPORT_PRIVATE RefTracker(); >+ WTF_EXPORT_PRIVATE ~RefTracker(); >+ >+ WTF_EXPORT_PRIVATE RefToken trackRef(); >+ WTF_EXPORT_PRIVATE void trackDeref(RefToken); >+ >+ WTF_EXPORT_PRIVATE void dumpRemainingReferences() const; >+ >+private: >+ HashMap<RefToken, std::unique_ptr<StackShot>> m_refBacktraceMap; >+}; >+ >+} // namespace WTF >+ >+using WTF::RefTracker; >+ >+#endif // ALLOW_REF_TRACING >diff --git a/Source/WTF/wtf/SizeLimits.cpp b/Source/WTF/wtf/SizeLimits.cpp >index b0ad14044f3..b7bc622d21b 100644 >--- a/Source/WTF/wtf/SizeLimits.cpp >+++ b/Source/WTF/wtf/SizeLimits.cpp >@@ -54,8 +54,10 @@ struct SameSizeAsRefCounted { > }; > #endif > >+#ifndef ALLOW_REF_TRACING > static_assert(sizeof(RefCounted<int>) == sizeof(SameSizeAsRefCounted), "RefCounted should stay small!"); > static_assert(sizeof(RefPtr<RefCounted<int>>) == sizeof(int*), "RefPtr should stay small!"); >+#endif > > #if !ASAN_ENABLED > template<typename T, unsigned inlineCapacity = 0> >diff --git a/Source/WTF/wtf/ThreadSafeRefCounted.h b/Source/WTF/wtf/ThreadSafeRefCounted.h >index c4e809ae93a..20b172661a4 100644 >--- a/Source/WTF/wtf/ThreadSafeRefCounted.h >+++ b/Source/WTF/wtf/ThreadSafeRefCounted.h >@@ -29,6 +29,7 @@ > #include <wtf/FastMalloc.h> > #include <wtf/MainThread.h> > #include <wtf/Noncopyable.h> >+#include <wtf/Ref.h> > > namespace WTF { > >@@ -38,9 +39,10 @@ class ThreadSafeRefCountedBase { > public: > ThreadSafeRefCountedBase() = default; > >- void ref() const >+ REF_RETURN_TYPE ref() const > { > ++m_refCount; >+ DEFAULT_REF_RETURN; > } > > bool hasOneRef() const >@@ -55,7 +57,7 @@ public: > > protected: > // Returns whether the pointer should be freed or not. >- bool derefBase() const >+ bool derefBase(DEREF_ARGUMENT_TYPE) const > { > return !--m_refCount; > } >@@ -68,9 +70,9 @@ enum class DestructionThread { Any, Main }; > > template<class T, DestructionThread destructionThread = DestructionThread::Any> class ThreadSafeRefCounted : public ThreadSafeRefCountedBase { > public: >- void deref() const >+ void deref(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) const > { >- if (!derefBase()) >+ if (!derefBase(DEREF_ARGUMENT_NAME)) > return; > if (destructionThread == DestructionThread::Any || isMainThread()) { > delete static_cast<const T*>(this); >diff --git a/Source/WTF/wtf/ThreadingPthreads.cpp b/Source/WTF/wtf/ThreadingPthreads.cpp >index a3f428c8c98..c49e655e905 100644 >--- a/Source/WTF/wtf/ThreadingPthreads.cpp >+++ b/Source/WTF/wtf/ThreadingPthreads.cpp >@@ -475,7 +475,7 @@ void Thread::destructTLS(void* data) > > if (thread->m_isDestroyedOnce) { > thread->didExit(); >- thread->deref(); >+ thread->deref(DEREF_DEFAULT_ARGUMENTS); > return; > } > >diff --git a/Source/WTF/wtf/WTFAssertions.cpp b/Source/WTF/wtf/WTFAssertions.cpp >index 9870764cf02..a1b73f8a6f6 100644 >--- a/Source/WTF/wtf/WTFAssertions.cpp >+++ b/Source/WTF/wtf/WTFAssertions.cpp >@@ -41,11 +41,13 @@ uintptr_t dummyPoison = 0; > static_assert(sizeof(Bag<DummyStruct>) == sizeof(void*), ""); > static_assert(sizeof(PoisonedBag<Poison<dummyPoison>, DummyStruct>) == sizeof(void*), ""); > >+#ifndef ALLOW_REF_TRACING > static_assert(sizeof(Ref<DummyStruct>) == sizeof(DummyStruct*), ""); > static_assert(sizeof(PoisonedRef<Poison<dummyPoison>, DummyStruct>) == sizeof(DummyStruct*), ""); > > static_assert(sizeof(RefPtr<DummyStruct>) == sizeof(DummyStruct*), ""); > static_assert(sizeof(PoisonedRefPtr<Poison<dummyPoison>, DummyStruct>) == sizeof(DummyStruct*), ""); >+#endif > > static_assert(sizeof(PoisonedUniquePtr<Poison<dummyPoison>, DummyStruct>) == sizeof(DummyStruct*), ""); > static_assert(sizeof(PoisonedUniquePtr<Poison<dummyPoison>, int[]>) == sizeof(int*), ""); >diff --git a/Source/WTF/wtf/text/StringImpl.h b/Source/WTF/wtf/text/StringImpl.h >index 2aa0c918753..e060969997d 100644 >--- a/Source/WTF/wtf/text/StringImpl.h >+++ b/Source/WTF/wtf/text/StringImpl.h >@@ -320,8 +320,8 @@ public: > bool hasOneRef() const { return m_refCount == s_refCountIncrement; } > bool hasAtLeastOneRef() const { return m_refCount; } // For assertions. > >- void ref(); >- void deref(); >+ REF_RETURN_TYPE ref(); >+ void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS); > > class StaticStringImpl : private StringImplShape { > WTF_MAKE_NONCOPYABLE(StaticStringImpl); >@@ -1034,14 +1034,15 @@ inline void StringImpl::setHash(unsigned hash) const > m_hashAndFlags |= hash; // Store hash with flags in low bits. > } > >-inline void StringImpl::ref() >+inline REF_RETURN_TYPE StringImpl::ref() > { > STRING_STATS_REF_STRING(*this); > > m_refCount += s_refCountIncrement; >+ DEFAULT_REF_RETURN; > } > >-inline void StringImpl::deref() >+inline void StringImpl::deref(DEREF_ARGUMENT_TYPE) > { > STRING_STATS_DEREF_STRING(*this); > >diff --git a/Source/WTF/wtf/text/WTFString.h b/Source/WTF/wtf/text/WTFString.h >index 17e2c69eb99..33ca3ab037e 100644 >--- a/Source/WTF/wtf/text/WTFString.h >+++ b/Source/WTF/wtf/text/WTFString.h >@@ -374,7 +374,9 @@ private: > RefPtr<StringImpl> m_impl; > }; > >+#ifndef ALLOW_REF_TRACING > static_assert(sizeof(String) == sizeof(void*), "String should effectively be a pointer to a StringImpl, and efficient to pass by value"); >+#endif > > inline bool operator==(const String& a, const String& b) { return equal(a.impl(), b.impl()); } > inline bool operator==(const String& a, const LChar* b) { return equal(a.impl(), b); } >diff --git a/Source/WebCore/Modules/applepay/ApplePaySession.h b/Source/WebCore/Modules/applepay/ApplePaySession.h >index 70612760b11..21c0adc290f 100644 >--- a/Source/WebCore/Modules/applepay/ApplePaySession.h >+++ b/Source/WebCore/Modules/applepay/ApplePaySession.h >@@ -107,8 +107,8 @@ private: > // EventTargetWithInlineData. > EventTargetInterface eventTargetInterface() const override { return ApplePaySessionEventTargetInterfaceType; } > ScriptExecutionContext* scriptExecutionContext() const override { return ActiveDOMObject::scriptExecutionContext(); } >- void refEventTarget() override { ref(); } >- void derefEventTarget() override { deref(); } >+ REF_RETURN_TYPE refEventTarget() override { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) override { deref(DEREF_ARGUMENT_NAME); } > > // PaymentSession > unsigned version() const override; >diff --git a/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h b/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h >index ecc57b450cd..7263e69e365 100644 >--- a/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h >+++ b/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h >@@ -90,8 +90,8 @@ private: > // EventTarget > EventTargetInterface eventTargetInterface() const override { return MediaKeySessionEventTargetInterfaceType; } > ScriptExecutionContext* scriptExecutionContext() const override { return ActiveDOMObject::scriptExecutionContext(); } >- void refEventTarget() override { ref(); } >- void derefEventTarget() override { deref(); } >+ REF_RETURN_TYPE refEventTarget() override { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) override { deref(DEREF_ARGUMENT_NAME); } > > // ActiveDOMObject > bool hasPendingActivity() const override; >diff --git a/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeySession.h b/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeySession.h >index 1a22d32f5a6..fdae0a60ee0 100644 >--- a/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeySession.h >+++ b/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeySession.h >@@ -73,8 +73,8 @@ private: > void sendError(MediaKeyErrorCode, uint32_t systemCode) final; > String mediaKeysStorageDirectory() const final; > >- void refEventTarget() final { ref(); } >- void derefEventTarget() final { deref(); } >+ REF_RETURN_TYPE refEventTarget() final { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { deref(DEREF_ARGUMENT_NAME); } > > void stop() final; > bool canSuspendForDocumentSuspension() const final; >diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabase.h b/Source/WebCore/Modules/indexeddb/IDBDatabase.h >index 76a12859101..a27f501a418 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBDatabase.h >+++ b/Source/WebCore/Modules/indexeddb/IDBDatabase.h >@@ -74,8 +74,8 @@ public: > // EventTarget > EventTargetInterface eventTargetInterface() const final { return IDBDatabaseEventTargetInterfaceType; } > ScriptExecutionContext* scriptExecutionContext() const final { return ActiveDOMObject::scriptExecutionContext(); } >- void refEventTarget() final { ThreadSafeRefCounted<IDBDatabase>::ref(); } >- void derefEventTarget() final { ThreadSafeRefCounted<IDBDatabase>::deref(); } >+ REF_RETURN_TYPE refEventTarget() final { return ThreadSafeRefCounted<IDBDatabase>::ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { ThreadSafeRefCounted<IDBDatabase>::deref(DEREF_ARGUMENT_NAME); } > > using ThreadSafeRefCounted<IDBDatabase>::ref; > using ThreadSafeRefCounted<IDBDatabase>::deref; >diff --git a/Source/WebCore/Modules/indexeddb/IDBIndex.cpp b/Source/WebCore/Modules/indexeddb/IDBIndex.cpp >index 308305b8e6e..64e5f096aff 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBIndex.cpp >+++ b/Source/WebCore/Modules/indexeddb/IDBIndex.cpp >@@ -365,14 +365,15 @@ void IDBIndex::markAsDeleted() > m_deleted = true; > } > >-void IDBIndex::ref() >+REF_RETURN_TYPE IDBIndex::ref() > { > m_objectStore.ref(); >+ DEFAULT_REF_RETURN; > } > >-void IDBIndex::deref() >+void IDBIndex::deref(DEREF_ARGUMENT_TYPE) > { >- m_objectStore.deref(); >+ m_objectStore.deref(DEREF_DEFAULT_ARGUMENTS); > } > > } // namespace WebCore >diff --git a/Source/WebCore/Modules/indexeddb/IDBIndex.h b/Source/WebCore/Modules/indexeddb/IDBIndex.h >index b3134fde231..ca3e13b8b6e 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBIndex.h >+++ b/Source/WebCore/Modules/indexeddb/IDBIndex.h >@@ -79,8 +79,8 @@ public: > void markAsDeleted(); > bool isDeleted() const { return m_deleted; } > >- void ref(); >- void deref(); >+ REF_RETURN_TYPE ref(); >+ void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS); > > void* objectStoreAsOpaqueRoot() { return &m_objectStore; } > >diff --git a/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp b/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp >index 12c9bad51a3..5bd107c2d31 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp >+++ b/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp >@@ -688,14 +688,15 @@ void IDBObjectStore::renameReferencedIndex(IDBIndex& index, const String& newNam > m_referencedIndexes.set(newName, m_referencedIndexes.take(index.info().name())); > } > >-void IDBObjectStore::ref() >+REF_RETURN_TYPE IDBObjectStore::ref() > { > m_transaction.ref(); >+ DEFAULT_REF_RETURN; > } > >-void IDBObjectStore::deref() >+void IDBObjectStore::deref(DEREF_ARGUMENT_TYPE) > { >- m_transaction.deref(); >+ m_transaction.deref(DEREF_DEFAULT_ARGUMENTS); > } > > } // namespace WebCore >diff --git a/Source/WebCore/Modules/indexeddb/IDBObjectStore.h b/Source/WebCore/Modules/indexeddb/IDBObjectStore.h >index ea8fd5ca32c..de683b555e3 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBObjectStore.h >+++ b/Source/WebCore/Modules/indexeddb/IDBObjectStore.h >@@ -103,8 +103,8 @@ public: > > void rollbackForVersionChangeAbort(); > >- void ref(); >- void deref(); >+ REF_RETURN_TYPE ref(); >+ void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS); > > void visitReferencedIndexes(JSC::SlotVisitor&) const; > void renameReferencedIndex(IDBIndex&, const String& newName); >diff --git a/Source/WebCore/Modules/indexeddb/IDBRequest.h b/Source/WebCore/Modules/indexeddb/IDBRequest.h >index e914344fe8d..6e1c1e6ed1e 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBRequest.h >+++ b/Source/WebCore/Modules/indexeddb/IDBRequest.h >@@ -150,8 +150,8 @@ private: > void stop() final; > virtual void cancelForStop(); > >- void refEventTarget() final { RefCounted::ref(); } >- void derefEventTarget() final { RefCounted::deref(); } >+ REF_RETURN_TYPE refEventTarget() final { return RefCounted::ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { RefCounted::deref(DEREF_ARGUMENT_NAME); } > void uncaughtExceptionInEventHandler() final; > > virtual bool isOpenDBRequest() const { return false; } >diff --git a/Source/WebCore/Modules/indexeddb/IDBTransaction.h b/Source/WebCore/Modules/indexeddb/IDBTransaction.h >index ecac146e5d6..cb3034efc8c 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBTransaction.h >+++ b/Source/WebCore/Modules/indexeddb/IDBTransaction.h >@@ -82,8 +82,10 @@ public: > > EventTargetInterface eventTargetInterface() const final { return IDBTransactionEventTargetInterfaceType; } > ScriptExecutionContext* scriptExecutionContext() const final { return ActiveDOMObject::scriptExecutionContext(); } >- void refEventTarget() final { ThreadSafeRefCounted::ref(); } >- void derefEventTarget() final { ThreadSafeRefCounted::deref(); } >+ >+ REF_RETURN_TYPE refEventTarget() final { return ThreadSafeRefCounted::ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { ThreadSafeRefCounted::deref(DEREF_ARGUMENT_NAME); } >+ > using EventTarget::dispatchEvent; > void dispatchEvent(Event&) final; > >diff --git a/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.cpp b/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.cpp >index 15ac07e4644..bd8f9606cef 100644 >--- a/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.cpp >+++ b/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.cpp >@@ -50,14 +50,15 @@ IDBConnectionProxy::IDBConnectionProxy(IDBConnectionToServer& connection) > ASSERT(isMainThread()); > } > >-void IDBConnectionProxy::ref() >+REF_RETURN_TYPE IDBConnectionProxy::ref() > { > m_connectionToServer.ref(); >+ DEFAULT_REF_RETURN; > } > >-void IDBConnectionProxy::deref() >+void IDBConnectionProxy::deref(DEREF_ARGUMENT_TYPE) > { >- m_connectionToServer.deref(); >+ m_connectionToServer.deref(DEREF_DEFAULT_ARGUMENTS); > } > > Ref<IDBOpenDBRequest> IDBConnectionProxy::openDatabase(ScriptExecutionContext& context, const IDBDatabaseIdentifier& databaseIdentifier, uint64_t version) >diff --git a/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.h b/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.h >index b7728c0d52f..19dfdce46a6 100644 >--- a/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.h >+++ b/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.h >@@ -111,8 +111,8 @@ public: > > uint64_t serverConnectionIdentifier() const { return m_serverConnectionIdentifier; } > >- void ref(); >- void deref(); >+ REF_RETURN_TYPE ref(); >+ void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS); > > void getAllDatabaseNames(const SecurityOrigin& mainFrameOrigin, const SecurityOrigin& openingOrigin, WTF::Function<void (const Vector<String>&)>&&); > >diff --git a/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h b/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h >index f217926ae06..f6ca96fcfcd 100644 >--- a/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h >+++ b/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h >@@ -88,8 +88,8 @@ public: > > virtual void getAllDatabaseNames(const SecurityOriginData& mainFrameOrigin, const SecurityOriginData& openingOrigin, uint64_t callbackID) = 0; > >- virtual void ref() = 0; >- virtual void deref() = 0; >+ virtual REF_RETURN_TYPE ref() = 0; >+ virtual void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS) = 0; > }; > > } // namespace IDBClient >diff --git a/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClientDelegate.h b/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClientDelegate.h >index 479742a9da9..593a15688e3 100644 >--- a/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClientDelegate.h >+++ b/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClientDelegate.h >@@ -72,8 +72,8 @@ public: > > virtual void didGetAllDatabaseNames(uint64_t callbackID, const Vector<String>& databaseNames) = 0; > >- virtual void ref() = 0; >- virtual void deref() = 0; >+ virtual REF_RETURN_TYPE ref() = 0; >+ virtual void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS) = 0; > }; > > } // namespace IDBServer >diff --git a/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h b/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h >index 473ea5b172a..cc02f0ed601 100644 >--- a/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h >+++ b/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h >@@ -109,8 +109,8 @@ public: > void notifyOpenDBRequestBlocked(const IDBResourceIdentifier& requestIdentifier, uint64_t oldVersion, uint64_t newVersion) final; > void didGetAllDatabaseNames(uint64_t callbackID, const Vector<String>& databaseNames) final; > >- void ref() override { RefCounted<InProcessIDBServer>::ref(); } >- void deref() override { RefCounted<InProcessIDBServer>::deref(); } >+ REF_RETURN_TYPE ref() override { return RefCounted<InProcessIDBServer>::ref(); } >+ void deref(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) override { RefCounted<InProcessIDBServer>::deref(DEREF_ARGUMENT_NAME); } > > void prepareForAccessToTemporaryFile(const String&) override { } > void accessToTemporaryFileComplete(const String& path) override; >diff --git a/Source/WebCore/Modules/mediasession/MediaRemoteControls.h b/Source/WebCore/Modules/mediasession/MediaRemoteControls.h >index cf24dea09e4..5f1f6d8281e 100644 >--- a/Source/WebCore/Modules/mediasession/MediaRemoteControls.h >+++ b/Source/WebCore/Modules/mediasession/MediaRemoteControls.h >@@ -67,8 +67,8 @@ private: > > MediaSession* m_session { nullptr }; > >- void refEventTarget() final { ref(); } >- void derefEventTarget() final { deref(); } >+ REF_RETURN_TYPE refEventTarget() final { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { deref(DEREF_ARGUMENT_NAME); } > }; > > } // namespace WebCore >diff --git a/Source/WebCore/Modules/mediasource/MediaSource.h b/Source/WebCore/Modules/mediasource/MediaSource.h >index 29346572e30..67b0582ef7f 100644 >--- a/Source/WebCore/Modules/mediasource/MediaSource.h >+++ b/Source/WebCore/Modules/mediasource/MediaSource.h >@@ -114,8 +114,8 @@ private: > void setPrivateAndOpen(Ref<MediaSourcePrivate>&&) final; > void seekToTime(const MediaTime&) final; > >- void refEventTarget() final { ref(); } >- void derefEventTarget() final { deref(); } >+ REF_RETURN_TYPE refEventTarget() final { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { deref(DEREF_ARGUMENT_NAME); } > EventTargetInterface eventTargetInterface() const final; > > URLRegistry& registry() const final; >diff --git a/Source/WebCore/Modules/mediasource/SourceBuffer.h b/Source/WebCore/Modules/mediasource/SourceBuffer.h >index c1a3dc5b08b..2d7cfa6f35e 100644 >--- a/Source/WebCore/Modules/mediasource/SourceBuffer.h >+++ b/Source/WebCore/Modules/mediasource/SourceBuffer.h >@@ -120,8 +120,8 @@ public: > private: > SourceBuffer(Ref<SourceBufferPrivate>&&, MediaSource*); > >- void refEventTarget() final { ref(); } >- void derefEventTarget() final { deref(); } >+ REF_RETURN_TYPE refEventTarget() final { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { deref(DEREF_ARGUMENT_NAME); } > > void stop() final; > const char* activeDOMObjectName() const final; >diff --git a/Source/WebCore/Modules/mediasource/SourceBufferList.h b/Source/WebCore/Modules/mediasource/SourceBufferList.h >index 4186b4fecb3..70d0970f526 100644 >--- a/Source/WebCore/Modules/mediasource/SourceBufferList.h >+++ b/Source/WebCore/Modules/mediasource/SourceBufferList.h >@@ -74,8 +74,8 @@ private: > > void scheduleEvent(const AtomicString&); > >- void refEventTarget() override { ref(); } >- void derefEventTarget() override { deref(); } >+ REF_RETURN_TYPE refEventTarget() override { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) override { deref(DEREF_ARGUMENT_NAME); } > > GenericEventQueue m_asyncEventQueue; > >diff --git a/Source/WebCore/Modules/mediastream/MediaDevices.h b/Source/WebCore/Modules/mediastream/MediaDevices.h >index 04cc6059ba3..013eff8e61b 100644 >--- a/Source/WebCore/Modules/mediastream/MediaDevices.h >+++ b/Source/WebCore/Modules/mediastream/MediaDevices.h >@@ -87,8 +87,8 @@ private: > // EventTargetWithInlineData. > EventTargetInterface eventTargetInterface() const override { return MediaDevicesEventTargetInterfaceType; } > ScriptExecutionContext* scriptExecutionContext() const final { return m_scriptExecutionContext; } >- void refEventTarget() override { ref(); } >- void derefEventTarget() override { deref(); } >+ REF_RETURN_TYPE refEventTarget() override { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) override { deref(DEREF_ARGUMENT_NAME); } > > WeakPtr<MediaDevices> createWeakPtr() { return m_weakPtrFactory.createWeakPtr(*this); } > >diff --git a/Source/WebCore/Modules/mediastream/MediaStream.h b/Source/WebCore/Modules/mediastream/MediaStream.h >index 1c1ae11b80e..9f27439822f 100644 >--- a/Source/WebCore/Modules/mediastream/MediaStream.h >+++ b/Source/WebCore/Modules/mediastream/MediaStream.h >@@ -122,8 +122,8 @@ protected: > private: > > // EventTarget >- void refEventTarget() final { ref(); } >- void derefEventTarget() final { deref(); } >+ REF_RETURN_TYPE refEventTarget() final { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { deref(DEREF_ARGUMENT_NAME); } > > // MediaStreamTrack::Observer > void trackDidEnd() final; >diff --git a/Source/WebCore/Modules/mediastream/MediaStreamTrack.h b/Source/WebCore/Modules/mediastream/MediaStreamTrack.h >index da1b1c0607b..273d7d9ae42 100644 >--- a/Source/WebCore/Modules/mediastream/MediaStreamTrack.h >+++ b/Source/WebCore/Modules/mediastream/MediaStreamTrack.h >@@ -158,8 +158,8 @@ private: > bool canSuspendForDocumentSuspension() const final; > > // EventTarget >- void refEventTarget() final { ref(); } >- void derefEventTarget() final { deref(); } >+ REF_RETURN_TYPE refEventTarget() final { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { deref(DEREF_ARGUMENT_NAME); } > EventTargetInterface eventTargetInterface() const final { return MediaStreamTrackEventTargetInterfaceType; } > > // MediaStreamTrackPrivate::Observer >diff --git a/Source/WebCore/Modules/mediastream/RTCDTMFSender.h b/Source/WebCore/Modules/mediastream/RTCDTMFSender.h >index 00fce07c952..da6521c33bc 100644 >--- a/Source/WebCore/Modules/mediastream/RTCDTMFSender.h >+++ b/Source/WebCore/Modules/mediastream/RTCDTMFSender.h >@@ -62,8 +62,8 @@ private: > EventTargetInterface eventTargetInterface() const final { return RTCDTMFSenderEventTargetInterfaceType; } > ScriptExecutionContext* scriptExecutionContext() const final { return ActiveDOMObject::scriptExecutionContext(); } > >- void refEventTarget() final { ref(); } >- void derefEventTarget() final { deref(); } >+ REF_RETURN_TYPE refEventTarget() final { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { deref(DEREF_ARGUMENT_NAME); } > > void didPlayTone(const String&); > >diff --git a/Source/WebCore/Modules/mediastream/RTCDataChannel.h b/Source/WebCore/Modules/mediastream/RTCDataChannel.h >index 620adb4348c..46ddb548b93 100644 >--- a/Source/WebCore/Modules/mediastream/RTCDataChannel.h >+++ b/Source/WebCore/Modules/mediastream/RTCDataChannel.h >@@ -85,8 +85,8 @@ private: > EventTargetInterface eventTargetInterface() const final { return RTCDataChannelEventTargetInterfaceType; } > ScriptExecutionContext* scriptExecutionContext() const final { return m_scriptExecutionContext; } > >- void refEventTarget() final { ref(); } >- void derefEventTarget() final { deref(); } >+ REF_RETURN_TYPE refEventTarget() final { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { deref(DEREF_ARGUMENT_NAME); } > > ExceptionOr<void> sendRawData(const char* data, size_t length); > >diff --git a/Source/WebCore/Modules/mediastream/RTCPeerConnection.h b/Source/WebCore/Modules/mediastream/RTCPeerConnection.h >index e99751d6ba1..fe393550bf9 100644 >--- a/Source/WebCore/Modules/mediastream/RTCPeerConnection.h >+++ b/Source/WebCore/Modules/mediastream/RTCPeerConnection.h >@@ -180,8 +180,8 @@ private: > void applyRotationForOutgoingVideoSources() { m_backend->applyRotationForOutgoingVideoSources(); } > > // EventTarget implementation. >- void refEventTarget() final { ref(); } >- void derefEventTarget() final { deref(); } >+ REF_RETURN_TYPE refEventTarget() final { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { deref(DEREF_ARGUMENT_NAME); } > void dispatchEvent(Event&) final; > > // ActiveDOMObject >diff --git a/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h b/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h >index 22ae284e852..4251c92d651 100644 >--- a/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h >+++ b/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h >@@ -129,7 +129,7 @@ private: > void AddRef() const { ref(); } > rtc::RefCountReleaseStatus Release() const > { >- deref(); >+ deref(DEREF_DEFAULT_ARGUMENTS); > return refCount() ? rtc::RefCountReleaseStatus::kDroppedLastRef : rtc::RefCountReleaseStatus::kOtherRefsRemained; > } > >diff --git a/Source/WebCore/Modules/notifications/Notification.h b/Source/WebCore/Modules/notifications/Notification.h >index 6c44eabb86a..287d1c025f6 100644 >--- a/Source/WebCore/Modules/notifications/Notification.h >+++ b/Source/WebCore/Modules/notifications/Notification.h >@@ -100,8 +100,8 @@ private: > bool canSuspendForDocumentSuspension() const final; > void stop() final; > >- void refEventTarget() final { ref(); } >- void derefEventTarget() final { deref(); } >+ REF_RETURN_TYPE refEventTarget() final { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { deref(DEREF_ARGUMENT_NAME); } > > String m_title; > Direction m_direction; >diff --git a/Source/WebCore/Modules/paymentrequest/PaymentRequest.h b/Source/WebCore/Modules/paymentrequest/PaymentRequest.h >index 7457ad7382d..f8d28030fba 100644 >--- a/Source/WebCore/Modules/paymentrequest/PaymentRequest.h >+++ b/Source/WebCore/Modules/paymentrequest/PaymentRequest.h >@@ -118,8 +118,8 @@ private: > // EventTarget > EventTargetInterface eventTargetInterface() const final { return PaymentRequestEventTargetInterfaceType; } > ScriptExecutionContext* scriptExecutionContext() const final { return ActiveDOMObject::scriptExecutionContext(); } >- void refEventTarget() final { ref(); } >- void derefEventTarget() final { deref(); } >+ REF_RETURN_TYPE refEventTarget() final { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { deref(DEREF_ARGUMENT_NAME); } > > PaymentOptions m_options; > PaymentDetailsInit m_details; >diff --git a/Source/WebCore/Modules/speech/SpeechSynthesisUtterance.h b/Source/WebCore/Modules/speech/SpeechSynthesisUtterance.h >index 8c24f77d379..68cedf4006b 100644 >--- a/Source/WebCore/Modules/speech/SpeechSynthesisUtterance.h >+++ b/Source/WebCore/Modules/speech/SpeechSynthesisUtterance.h >@@ -72,8 +72,8 @@ private: > > ScriptExecutionContext* scriptExecutionContext() const final { return ContextDestructionObserver::scriptExecutionContext(); } > EventTargetInterface eventTargetInterface() const final { return SpeechSynthesisUtteranceEventTargetInterfaceType; } >- void refEventTarget() final { ref(); } >- void derefEventTarget() final { deref(); } >+ REF_RETURN_TYPE refEventTarget() final { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { deref(DEREF_ARGUMENT_NAME); } > > RefPtr<PlatformSpeechSynthesisUtterance> m_platformUtterance; > RefPtr<SpeechSynthesisVoice> m_voice; >diff --git a/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp b/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp >index 5e62c5ac2dc..4f7be23f004 100644 >--- a/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp >+++ b/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp >@@ -556,9 +556,9 @@ void AudioBufferSourceNode::setPannerNode(PannerNode* pannerNode) > { > if (m_pannerNode != pannerNode && !hasFinished()) { > if (pannerNode) >- pannerNode->ref(AudioNode::RefTypeConnection); >+ pannerNode->refConnection(); > if (m_pannerNode) >- m_pannerNode->deref(AudioNode::RefTypeConnection); >+ m_pannerNode->derefConnection(); > > m_pannerNode = pannerNode; > } >@@ -567,7 +567,7 @@ void AudioBufferSourceNode::setPannerNode(PannerNode* pannerNode) > void AudioBufferSourceNode::clearPannerNode() > { > if (m_pannerNode) { >- m_pannerNode->deref(AudioNode::RefTypeConnection); >+ m_pannerNode->derefConnection(); > m_pannerNode = nullptr; > } > } >diff --git a/Source/WebCore/Modules/webaudio/AudioContext.cpp b/Source/WebCore/Modules/webaudio/AudioContext.cpp >index 1ab8bf25f34..c00b990d490 100644 >--- a/Source/WebCore/Modules/webaudio/AudioContext.cpp >+++ b/Source/WebCore/Modules/webaudio/AudioContext.cpp >@@ -668,7 +668,7 @@ void AudioContext::refNode(AudioNode& node) > ASSERT(isMainThread()); > AutoLocker locker(*this); > >- node.ref(AudioNode::RefTypeConnection); >+ node.refConnection(); > m_referencedNodes.append(&node); > } > >@@ -676,7 +676,7 @@ void AudioContext::derefNode(AudioNode& node) > { > ASSERT(isGraphOwner()); > >- node.deref(AudioNode::RefTypeConnection); >+ node.derefConnection(); > > ASSERT(m_referencedNodes.contains(&node)); > m_referencedNodes.removeFirst(&node); >@@ -686,7 +686,7 @@ void AudioContext::derefUnfinishedSourceNodes() > { > ASSERT(isMainThread() && isAudioThreadFinished()); > for (auto& node : m_referencedNodes) >- node->deref(AudioNode::RefTypeConnection); >+ node->derefConnection(); > > m_referencedNodes.clear(); > } >diff --git a/Source/WebCore/Modules/webaudio/AudioContext.h b/Source/WebCore/Modules/webaudio/AudioContext.h >index 760a4e7114f..f3cf49761dc 100644 >--- a/Source/WebCore/Modules/webaudio/AudioContext.h >+++ b/Source/WebCore/Modules/webaudio/AudioContext.h >@@ -328,8 +328,8 @@ private: > void visibilityStateChanged() final; > > // EventTarget >- void refEventTarget() override { ref(); } >- void derefEventTarget() override { deref(); } >+ REF_RETURN_TYPE refEventTarget() override { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) override { deref(DEREF_ARGUMENT_NAME); } > > void handleDirtyAudioSummingJunctions(); > void handleDirtyAudioNodeOutputs(); >diff --git a/Source/WebCore/Modules/webaudio/AudioNode.cpp b/Source/WebCore/Modules/webaudio/AudioNode.cpp >index f200b050e72..1e690da3b91 100644 >--- a/Source/WebCore/Modules/webaudio/AudioNode.cpp >+++ b/Source/WebCore/Modules/webaudio/AudioNode.cpp >@@ -389,31 +389,21 @@ void AudioNode::disableOutputsIfNecessary() > } > } > >-void AudioNode::ref(RefType refType) >+void AudioNode::refConnection() > { >- switch (refType) { >- case RefTypeNormal: >- ++m_normalRefCount; >- break; >- case RefTypeConnection: >- ++m_connectionRefCount; >- break; >- default: >- ASSERT_NOT_REACHED(); >- } >+ ++m_connectionRefCount; > > #if DEBUG_AUDIONODE_REFERENCES >- fprintf(stderr, "%p: %d: AudioNode::ref(%d) %d %d\n", this, nodeType(), refType, m_normalRefCount, m_connectionRefCount); >+ fprintf(stderr, "%p: %d: AudioNode::refConnection() %d %d\n", this, nodeType(), m_normalRefCount, m_connectionRefCount); > #endif > > // See the disabling code in finishDeref() below. This handles the case where a node > // is being re-connected after being used at least once and disconnected. > // In this case, we need to re-enable. >- if (refType == RefTypeConnection) >- enableOutputsIfNecessary(); >+ enableOutputsIfNecessary(); > } > >-void AudioNode::deref(RefType refType) >+void AudioNode::derefConnection() > { > // The actually work for deref happens completely within the audio context's graph lock. > // In the case of the audio thread, we must use a tryLock to avoid glitches. >@@ -430,14 +420,13 @@ void AudioNode::deref(RefType refType) > > if (hasLock) { > // This is where the real deref work happens. >- finishDeref(refType); >+ finishDeref(RefTypeConnection); > > if (mustReleaseLock) > context().unlock(); > } else { > // We were unable to get the lock, so put this in a list to finish up later. > ASSERT(context().isAudioThread()); >- ASSERT(refType == RefTypeConnection); > context().addDeferredFinishDeref(this); > } > >@@ -448,6 +437,49 @@ void AudioNode::deref(RefType refType) > context().deleteMarkedNodes(); > } > >+REF_RETURN_TYPE AudioNode::ref() >+{ >+ ++m_normalRefCount; >+ >+#if DEBUG_AUDIONODE_REFERENCES >+ fprintf(stderr, "%p: %d: AudioNode::ref() %d %d\n", this, nodeType(), m_normalRefCount, m_connectionRefCount); >+#endif >+ >+ DEFAULT_REF_RETURN; >+} >+ >+void AudioNode::deref(DEREF_ARGUMENT_TYPE) >+{ >+ // The actually work for deref happens completely within the audio context's graph lock. >+ // In the case of the audio thread, we must use a tryLock to avoid glitches. >+ bool hasLock = false; >+ bool mustReleaseLock = false; >+ >+ if (context().isAudioThread()) { >+ // Real-time audio thread must not contend lock (to avoid glitches). >+ hasLock = context().tryLock(mustReleaseLock); >+ } else { >+ context().lock(mustReleaseLock); >+ hasLock = true; >+ } >+ >+ if (hasLock) { >+ // This is where the real deref work happens. >+ finishDeref(RefTypeNormal); >+ >+ if (mustReleaseLock) >+ context().unlock(); >+ } else { >+ ASSERT_NOT_REACHED(); >+ } >+ >+ // Once AudioContext::uninitialize() is called there's no more chances for deleteMarkedNodes() to get called, so we call here. >+ // We can't call in AudioContext::~AudioContext() since it will never be called as long as any AudioNode is alive >+ // because AudioNodes keep a reference to the context. >+ if (context().isAudioThreadFinished()) >+ context().deleteMarkedNodes(); >+} >+ > void AudioNode::finishDeref(RefType refType) > { > ASSERT(context().isGraphOwner()); >diff --git a/Source/WebCore/Modules/webaudio/AudioNode.h b/Source/WebCore/Modules/webaudio/AudioNode.h >index fbbc5e0f503..6fd4c37304f 100644 >--- a/Source/WebCore/Modules/webaudio/AudioNode.h >+++ b/Source/WebCore/Modules/webaudio/AudioNode.h >@@ -91,8 +91,11 @@ public: > enum RefType { RefTypeNormal, RefTypeConnection }; > > // Can be called from main thread or context's audio thread. >- void ref(RefType refType = RefTypeNormal); >- void deref(RefType refType = RefTypeNormal); >+ REF_RETURN_TYPE ref(); >+ void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS); >+ >+ void refConnection(); >+ void derefConnection(); > > // Can be called from main thread or context's audio thread. It must be called while the context's graph lock is held. > void finishDeref(RefType refType); >@@ -212,8 +215,8 @@ private: > static int s_nodeCount[NodeTypeEnd]; > #endif > >- void refEventTarget() override { ref(); } >- void derefEventTarget() override { deref(); } >+ REF_RETURN_TYPE refEventTarget() override { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE) override { deref(); } > > protected: > unsigned m_channelCount; >diff --git a/Source/WebCore/Modules/webaudio/AudioNodeInput.cpp b/Source/WebCore/Modules/webaudio/AudioNodeInput.cpp >index ccaa51d822e..2b7e2934203 100644 >--- a/Source/WebCore/Modules/webaudio/AudioNodeInput.cpp >+++ b/Source/WebCore/Modules/webaudio/AudioNodeInput.cpp >@@ -59,7 +59,7 @@ void AudioNodeInput::connect(AudioNodeOutput* output) > changedOutputs(); > > // Sombody has just connected to us, so count it as a reference. >- node()->ref(AudioNode::RefTypeConnection); >+ node()->refConnection(); > } > > void AudioNodeInput::disconnect(AudioNodeOutput* output) >@@ -74,14 +74,14 @@ void AudioNodeInput::disconnect(AudioNodeOutput* output) > if (m_outputs.remove(output)) { > changedOutputs(); > output->removeInput(this); >- node()->deref(AudioNode::RefTypeConnection); // Note: it's important to return immediately after all deref() calls since the node may be deleted. >+ node()->derefConnection(); // Note: it's important to return immediately after all deref() calls since the node may be deleted. > return; > } > > // Otherwise, try to disconnect from disabled connections. > if (m_disabledOutputs.remove(output)) { > output->removeInput(this); >- node()->deref(AudioNode::RefTypeConnection); // Note: it's important to return immediately after all deref() calls since the node may be deleted. >+ node()->derefConnection(); // Note: it's important to return immediately after all deref() calls since the node may be deleted. > return; > } > >diff --git a/Source/WebCore/Modules/webaudio/MediaElementAudioSourceNode.cpp b/Source/WebCore/Modules/webaudio/MediaElementAudioSourceNode.cpp >index 9eca86f2103..7e86ad5c64c 100644 >--- a/Source/WebCore/Modules/webaudio/MediaElementAudioSourceNode.cpp >+++ b/Source/WebCore/Modules/webaudio/MediaElementAudioSourceNode.cpp >@@ -161,7 +161,7 @@ void MediaElementAudioSourceNode::lock() > void MediaElementAudioSourceNode::unlock() > { > m_processMutex.unlock(); >- deref(); >+ deref(DEREF_DEFAULT_ARGUMENTS); > } > > } // namespace WebCore >diff --git a/Source/WebCore/Modules/webaudio/OfflineAudioDestinationNode.cpp b/Source/WebCore/Modules/webaudio/OfflineAudioDestinationNode.cpp >index e995b086587..cfded0257d5 100644 >--- a/Source/WebCore/Modules/webaudio/OfflineAudioDestinationNode.cpp >+++ b/Source/WebCore/Modules/webaudio/OfflineAudioDestinationNode.cpp >@@ -135,7 +135,7 @@ void OfflineAudioDestinationNode::offlineRender() > // Our work is done. Let the AudioContext know. > callOnMainThread([this] { > notifyComplete(); >- deref(); >+ deref(DEREF_DEFAULT_ARGUMENTS); > }); > } > >diff --git a/Source/WebCore/Modules/webaudio/ScriptProcessorNode.cpp b/Source/WebCore/Modules/webaudio/ScriptProcessorNode.cpp >index 88ae04abbe3..4516ac65253 100644 >--- a/Source/WebCore/Modules/webaudio/ScriptProcessorNode.cpp >+++ b/Source/WebCore/Modules/webaudio/ScriptProcessorNode.cpp >@@ -196,7 +196,7 @@ void ScriptProcessorNode::process(size_t framesToProcess) > fireProcessEvent(); > > // De-reference to match the ref() call in process(). >- deref(); >+ deref(DEREF_DEFAULT_ARGUMENTS); > }); > } > >diff --git a/Source/WebCore/Modules/webdatabase/SQLCallbackWrapper.h b/Source/WebCore/Modules/webdatabase/SQLCallbackWrapper.h >index d0d128096ba..5e266fbf988 100644 >--- a/Source/WebCore/Modules/webdatabase/SQLCallbackWrapper.h >+++ b/Source/WebCore/Modules/webdatabase/SQLCallbackWrapper.h >@@ -75,8 +75,8 @@ public: > ScriptExecutionContext::Task::CleanupTask, > [callback, scriptExecutionContextPtr] (ScriptExecutionContext& context) { > ASSERT_UNUSED(context, &context == scriptExecutionContextPtr && context.isContextThread()); >- callback->deref(); >- scriptExecutionContextPtr->deref(); >+ callback->deref(DEREF_DEFAULT_ARGUMENTS); >+ scriptExecutionContextPtr->deref(DEREF_DEFAULT_ARGUMENTS); > } > }); > } >diff --git a/Source/WebCore/Modules/websockets/ThreadableWebSocketChannel.h b/Source/WebCore/Modules/websockets/ThreadableWebSocketChannel.h >index ca406af4c6f..03322cb3a41 100644 >--- a/Source/WebCore/Modules/websockets/ThreadableWebSocketChannel.h >+++ b/Source/WebCore/Modules/websockets/ThreadableWebSocketChannel.h >@@ -73,13 +73,13 @@ public: > virtual void suspend() = 0; > virtual void resume() = 0; > >- void ref() { refThreadableWebSocketChannel(); } >- void deref() { derefThreadableWebSocketChannel(); } >+ REF_RETURN_TYPE ref() { refThreadableWebSocketChannel(); DEFAULT_REF_RETURN; } >+ void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS) { derefThreadableWebSocketChannel(); } > > protected: > virtual ~ThreadableWebSocketChannel() = default; >- virtual void refThreadableWebSocketChannel() = 0; >- virtual void derefThreadableWebSocketChannel() = 0; >+ virtual REF_RETURN_TYPE refThreadableWebSocketChannel() = 0; >+ virtual void derefThreadableWebSocketChannel(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS) = 0; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/Modules/websockets/WebSocket.cpp b/Source/WebCore/Modules/websockets/WebSocket.cpp >index 02477b9d0d0..7e8ee173763 100644 >--- a/Source/WebCore/Modules/websockets/WebSocket.cpp >+++ b/Source/WebCore/Modules/websockets/WebSocket.cpp >@@ -296,7 +296,7 @@ ExceptionOr<void> WebSocket::connect(const String& url, const Vector<String>& pr > WebThreadRun(^{ > dispatchOrQueueErrorEvent(); > stop(); >- deref(); >+ deref(DEREF_DEFAULT_ARGUMENTS); > }); > }); > #else >diff --git a/Source/WebCore/Modules/websockets/WebSocket.h b/Source/WebCore/Modules/websockets/WebSocket.h >index 90121f70d30..5b5835af162 100644 >--- a/Source/WebCore/Modules/websockets/WebSocket.h >+++ b/Source/WebCore/Modules/websockets/WebSocket.h >@@ -113,8 +113,8 @@ private: > > EventTargetInterface eventTargetInterface() const final; > >- void refEventTarget() final { ref(); } >- void derefEventTarget() final { deref(); } >+ REF_RETURN_TYPE refEventTarget() final { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { deref(DEREF_ARGUMENT_NAME); } > > void didConnect() final; > void didReceiveMessage(const String& message) final; >diff --git a/Source/WebCore/Modules/websockets/WebSocketChannel.cpp b/Source/WebCore/Modules/websockets/WebSocketChannel.cpp >index 8147f0d4bc5..e62f9706191 100644 >--- a/Source/WebCore/Modules/websockets/WebSocketChannel.cpp >+++ b/Source/WebCore/Modules/websockets/WebSocketChannel.cpp >@@ -306,7 +306,7 @@ void WebSocketChannel::didCloseSocketStream(SocketStreamHandle& handle) > if (client) > client->didClose(m_unhandledBufferedAmount, m_receivedClosingHandshake ? WebSocketChannelClient::ClosingHandshakeComplete : WebSocketChannelClient::ClosingHandshakeIncomplete, m_closeEventCode, m_closeEventReason); > } >- deref(); >+ deref(DEREF_DEFAULT_ARGUMENTS); > } > > void WebSocketChannel::didReceiveSocketStreamData(SocketStreamHandle& handle, const char* data, size_t length) >@@ -392,7 +392,7 @@ void WebSocketChannel::didFinishLoading() > ASSERT(m_blobLoaderStatus == BlobLoaderStarted); > m_blobLoaderStatus = BlobLoaderFinished; > processOutgoingFrameQueue(); >- deref(); >+ deref(DEREF_DEFAULT_ARGUMENTS); > } > > void WebSocketChannel::didFail(int errorCode) >@@ -403,7 +403,7 @@ void WebSocketChannel::didFail(int errorCode) > m_blobLoader = nullptr; > m_blobLoaderStatus = BlobLoaderFailed; > fail("Failed to load Blob: error code = " + String::number(errorCode)); // FIXME: Generate human-friendly reason message. >- deref(); >+ deref(DEREF_DEFAULT_ARGUMENTS); > } > > bool WebSocketChannel::appendToBuffer(const char* data, size_t len) >diff --git a/Source/WebCore/Modules/websockets/WebSocketChannel.h b/Source/WebCore/Modules/websockets/WebSocketChannel.h >index 1131ea611f9..125529fe5d7 100644 >--- a/Source/WebCore/Modules/websockets/WebSocketChannel.h >+++ b/Source/WebCore/Modules/websockets/WebSocketChannel.h >@@ -124,8 +124,8 @@ public: > using RefCounted<WebSocketChannel>::deref; > > protected: >- void refThreadableWebSocketChannel() override { ref(); } >- void derefThreadableWebSocketChannel() override { deref(); } >+ REF_RETURN_TYPE refThreadableWebSocketChannel() override { return ref(); } >+ void derefThreadableWebSocketChannel(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) override { deref(DEREF_ARGUMENT_NAME); } > > private: > WEBCORE_EXPORT WebSocketChannel(Document&, WebSocketChannelClient&, SocketProvider&); >diff --git a/Source/WebCore/Modules/websockets/WorkerThreadableWebSocketChannel.h b/Source/WebCore/Modules/websockets/WorkerThreadableWebSocketChannel.h >index 812f8a02d30..f303df7d5e0 100644 >--- a/Source/WebCore/Modules/websockets/WorkerThreadableWebSocketChannel.h >+++ b/Source/WebCore/Modules/websockets/WorkerThreadableWebSocketChannel.h >@@ -109,8 +109,8 @@ public: > using RefCounted<WorkerThreadableWebSocketChannel>::deref; > > protected: >- void refThreadableWebSocketChannel() override { ref(); } >- void derefThreadableWebSocketChannel() override { deref(); } >+ REF_RETURN_TYPE refThreadableWebSocketChannel() override { return ref(); } >+ void derefThreadableWebSocketChannel(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) override { deref(DEREF_ARGUMENT_NAME); } > > private: > // Bridge for Peer. Running on the worker thread. >diff --git a/Source/WebCore/Modules/webvr/VRDisplay.h b/Source/WebCore/Modules/webvr/VRDisplay.h >index 4a99c96a967..d62bab2494c 100644 >--- a/Source/WebCore/Modules/webvr/VRDisplay.h >+++ b/Source/WebCore/Modules/webvr/VRDisplay.h >@@ -90,8 +90,8 @@ private: > // EventTarget > EventTargetInterface eventTargetInterface() const override { return VRDisplayEventTargetInterfaceType; } > ScriptExecutionContext* scriptExecutionContext() const override { return ActiveDOMObject::scriptExecutionContext(); } >- void refEventTarget() override { ref(); } >- void derefEventTarget() override { deref(); } >+ REF_RETURN_TYPE refEventTarget() override { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) override { deref(DEREF_ARGUMENT_NAME); } > > // ActiveDOMObject > bool hasPendingActivity() const override; >diff --git a/Source/WebCore/animation/WebAnimation.h b/Source/WebCore/animation/WebAnimation.h >index 5314b7e8418..e3bea887e0d 100644 >--- a/Source/WebCore/animation/WebAnimation.h >+++ b/Source/WebCore/animation/WebAnimation.h >@@ -172,8 +172,8 @@ private: > > // EventTarget > EventTargetInterface eventTargetInterface() const final { return WebAnimationEventTargetInterfaceType; } >- void refEventTarget() final { ref(); } >- void derefEventTarget() final { deref(); } >+ REF_RETURN_TYPE refEventTarget() final { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { deref(DEREF_ARGUMENT_NAME); } > ScriptExecutionContext* scriptExecutionContext() const final { return ActiveDOMObject::scriptExecutionContext(); } > }; > >diff --git a/Source/WebCore/bridge/NP_jsobject.cpp b/Source/WebCore/bridge/NP_jsobject.cpp >index d9458c516ba..251f282a4fe 100644 >--- a/Source/WebCore/bridge/NP_jsobject.cpp >+++ b/Source/WebCore/bridge/NP_jsobject.cpp >@@ -131,7 +131,7 @@ static void jsDeallocate(NPObject* npObj) > } > > if (obj->rootObject) >- obj->rootObject->deref(); >+ obj->rootObject->deref(DEREF_DEFAULT_ARGUMENTS); > > free(obj); > } >diff --git a/Source/WebCore/bridge/objc/WebScriptObject.mm b/Source/WebCore/bridge/objc/WebScriptObject.mm >index 0b5f8a9d9df..4d421caf8b7 100644 >--- a/Source/WebCore/bridge/objc/WebScriptObject.mm >+++ b/Source/WebCore/bridge/objc/WebScriptObject.mm >@@ -215,10 +215,10 @@ - (void)_setOriginRootObject:(RefPtr<RootObject>&&)originRootObject andRootObjec > _private->rootObject->gcUnprotect(_private->imp); > > if (_private->rootObject) >- _private->rootObject->deref(); >+ _private->rootObject->deref(DEREF_DEFAULT_ARGUMENTS); > > if (_private->originRootObject) >- _private->originRootObject->deref(); >+ _private->originRootObject->deref(DEREF_DEFAULT_ARGUMENTS); > > _private->rootObject = rootObject.leakRef(); > _private->originRootObject = originRootObject.leakRef(); >@@ -307,10 +307,10 @@ - (void)dealloc > _private->rootObject->gcUnprotect(_private->imp); > > if (_private->rootObject) >- _private->rootObject->deref(); >+ _private->rootObject->deref(DEREF_DEFAULT_ARGUMENTS); > > if (_private->originRootObject) >- _private->originRootObject->deref(); >+ _private->originRootObject->deref(DEREF_DEFAULT_ARGUMENTS); > > [_private release]; > >diff --git a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp >index 1a93e327b42..273fefdb462 100644 >--- a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp >+++ b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp >@@ -1680,13 +1680,14 @@ CSSComputedStyleDeclaration::~CSSComputedStyleDeclaration() > // WTFLogAlways("Destroying CSSComputedStyleDeclaration %p (count %d)", this, --CSSComputedStyleDeclarationCount); > } > >-void CSSComputedStyleDeclaration::ref() >+REF_RETURN_TYPE CSSComputedStyleDeclaration::ref() > { > CFRetain(m_treeTrap); > ++m_refCount; >+ DEFAULT_REF_RETURN; > } > >-void CSSComputedStyleDeclaration::deref() >+void CSSComputedStyleDeclaration::deref(DEREF_ARGUMENT_TYPE) > { > CFRelease(m_treeTrap); > if (m_refCount == 1) >diff --git a/Source/WebCore/css/CSSComputedStyleDeclaration.h b/Source/WebCore/css/CSSComputedStyleDeclaration.h >index ab2965ef6a5..1cc2a914512 100644 >--- a/Source/WebCore/css/CSSComputedStyleDeclaration.h >+++ b/Source/WebCore/css/CSSComputedStyleDeclaration.h >@@ -109,8 +109,8 @@ public: > } > virtual ~CSSComputedStyleDeclaration(); > >- WEBCORE_EXPORT void ref() final; >- WEBCORE_EXPORT void deref() final; >+ WEBCORE_EXPORT REF_RETURN_TYPE ref() final; >+ WEBCORE_EXPORT void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS) final; > > String getPropertyValue(CSSPropertyID) const; > >diff --git a/Source/WebCore/css/CSSDefaultStyleSheets.cpp b/Source/WebCore/css/CSSDefaultStyleSheets.cpp >index 582b930f7c4..5521f4e4032 100644 >--- a/Source/WebCore/css/CSSDefaultStyleSheets.cpp >+++ b/Source/WebCore/css/CSSDefaultStyleSheets.cpp >@@ -146,7 +146,7 @@ void CSSDefaultStyleSheets::loadFullDefaultStyle() > ASSERT(defaultStyle); > ASSERT(defaultPrintStyle == defaultStyle); > delete defaultStyle; >- simpleDefaultStyleSheet->deref(); >+ simpleDefaultStyleSheet->deref(DEREF_DEFAULT_ARGUMENTS); > simpleDefaultStyleSheet = nullptr; > } else { > ASSERT(!defaultStyle); >diff --git a/Source/WebCore/css/CSSFontFace.h b/Source/WebCore/css/CSSFontFace.h >index 346a7b861a7..f3bb3048e93 100644 >--- a/Source/WebCore/css/CSSFontFace.h >+++ b/Source/WebCore/css/CSSFontFace.h >@@ -123,8 +123,8 @@ public: > virtual void fontLoaded(CSSFontFace&) { } > virtual void fontStateChanged(CSSFontFace&, Status /*oldState*/, Status /*newState*/) { } > virtual void fontPropertyChanged(CSSFontFace&, CSSValueList* /*oldFamilies*/ = nullptr) { } >- virtual void ref() = 0; >- virtual void deref() = 0; >+ virtual REF_RETURN_TYPE ref() = 0; >+ virtual void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS) = 0; > }; > > // Pending => Loading => TimedOut >diff --git a/Source/WebCore/css/CSSFontFaceSet.h b/Source/WebCore/css/CSSFontFaceSet.h >index 337feab4b15..cb976d250f8 100644 >--- a/Source/WebCore/css/CSSFontFaceSet.h >+++ b/Source/WebCore/css/CSSFontFaceSet.h >@@ -78,8 +78,8 @@ public: > ExceptionOr<Vector<std::reference_wrapper<CSSFontFace>>> matchingFacesExcludingPreinstalledFonts(const String& font, const String& text); > > // CSSFontFace::Client needs to be able to be held in a RefPtr. >- void ref() final { RefCounted::ref(); } >- void deref() final { RefCounted::deref(); } >+ REF_RETURN_TYPE ref() final { return RefCounted::ref(); } >+ void deref(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { RefCounted::deref(DEREF_ARGUMENT_NAME); } > > private: > CSSFontFaceSet(CSSFontSelector*); >diff --git a/Source/WebCore/css/CSSImageGeneratorValue.cpp b/Source/WebCore/css/CSSImageGeneratorValue.cpp >index 7a8e19f230f..2f8042cfb02 100644 >--- a/Source/WebCore/css/CSSImageGeneratorValue.cpp >+++ b/Source/WebCore/css/CSSImageGeneratorValue.cpp >@@ -90,7 +90,7 @@ void CSSImageGeneratorValue::removeClient(RenderElement& renderer) > } > > if (m_clients.isEmpty()) >- deref(); >+ deref(DEREF_DEFAULT_ARGUMENTS); > } > > GeneratedImage* CSSImageGeneratorValue::cachedImageForSize(FloatSize size) >diff --git a/Source/WebCore/css/CSSPrimitiveValue.cpp b/Source/WebCore/css/CSSPrimitiveValue.cpp >index a761276c703..c2d1b7a0c49 100644 >--- a/Source/WebCore/css/CSSPrimitiveValue.cpp >+++ b/Source/WebCore/css/CSSPrimitiveValue.cpp >@@ -491,36 +491,36 @@ void CSSPrimitiveValue::cleanup() > case CSS_ATTR: > case CSS_COUNTER_NAME: > if (m_value.string) >- m_value.string->deref(); >+ m_value.string->deref(DEREF_DEFAULT_ARGUMENTS); > break; > case CSS_DIMENSION: > case CSS_COUNTER: >- m_value.counter->deref(); >+ m_value.counter->deref(DEREF_DEFAULT_ARGUMENTS); > break; > case CSS_RECT: >- m_value.rect->deref(); >+ m_value.rect->deref(DEREF_DEFAULT_ARGUMENTS); > break; > case CSS_QUAD: >- m_value.quad->deref(); >+ m_value.quad->deref(DEREF_DEFAULT_ARGUMENTS); > break; > case CSS_PAIR: >- m_value.pair->deref(); >+ m_value.pair->deref(DEREF_DEFAULT_ARGUMENTS); > break; > #if ENABLE(DASHBOARD_SUPPORT) > case CSS_DASHBOARD_REGION: > if (m_value.region) >- m_value.region->deref(); >+ m_value.region->deref(DEREF_DEFAULT_ARGUMENTS); > break; > #endif > case CSS_CALC: >- m_value.calc->deref(); >+ m_value.calc->deref(DEREF_DEFAULT_ARGUMENTS); > break; > case CSS_CALC_PERCENTAGE_WITH_NUMBER: > case CSS_CALC_PERCENTAGE_WITH_LENGTH: > ASSERT_NOT_REACHED(); > break; > case CSS_SHAPE: >- m_value.shape->deref(); >+ m_value.shape->deref(DEREF_DEFAULT_ARGUMENTS); > break; > case CSS_FONT_FAMILY: > ASSERT(m_value.fontFamily); >diff --git a/Source/WebCore/css/CSSProperty.cpp b/Source/WebCore/css/CSSProperty.cpp >index 181ba5ddb48..5416e58748a 100644 >--- a/Source/WebCore/css/CSSProperty.cpp >+++ b/Source/WebCore/css/CSSProperty.cpp >@@ -33,7 +33,9 @@ struct SameSizeAsCSSProperty { > void* value; > }; > >+#ifndef ALLOW_REF_TRACING > COMPILE_ASSERT(sizeof(CSSProperty) == sizeof(SameSizeAsCSSProperty), CSSProperty_should_stay_small); >+#endif > > CSSPropertyID StylePropertyMetadata::shorthandID() const > { >diff --git a/Source/WebCore/css/CSSRuleList.cpp b/Source/WebCore/css/CSSRuleList.cpp >index a0401091698..de0f7ea43fa 100644 >--- a/Source/WebCore/css/CSSRuleList.cpp >+++ b/Source/WebCore/css/CSSRuleList.cpp >@@ -37,7 +37,7 @@ StaticCSSRuleList::StaticCSSRuleList() > > StaticCSSRuleList::~StaticCSSRuleList() = default; > >-void StaticCSSRuleList::deref() >+void StaticCSSRuleList::deref(DEREF_ARGUMENT_TYPE) > { > ASSERT(m_refCount); > if (!--m_refCount) >diff --git a/Source/WebCore/css/CSSRuleList.h b/Source/WebCore/css/CSSRuleList.h >index 35a0925feb6..f422b184cf7 100644 >--- a/Source/WebCore/css/CSSRuleList.h >+++ b/Source/WebCore/css/CSSRuleList.h >@@ -34,8 +34,8 @@ class CSSRuleList { > public: > virtual ~CSSRuleList(); > >- virtual void ref() = 0; >- virtual void deref() = 0; >+ virtual REF_RETURN_TYPE ref() = 0; >+ virtual void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS) = 0; > > virtual unsigned length() const = 0; > virtual CSSRule* item(unsigned index) const = 0; >@@ -50,8 +50,8 @@ class StaticCSSRuleList final : public CSSRuleList { > public: > static Ref<StaticCSSRuleList> create() { return adoptRef(*new StaticCSSRuleList); } > >- void ref() final { ++m_refCount; } >- void deref() final; >+ REF_RETURN_TYPE ref() final { ++m_refCount; DEFAULT_REF_RETURN; } >+ void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS) final; > > Vector<RefPtr<CSSRule>>& rules() { return m_rules; } > >@@ -77,8 +77,8 @@ public: > { > } > >- void ref() final { m_rule.ref(); } >- void deref() final { m_rule.deref(); } >+ REF_RETURN_TYPE ref() final { m_rule.ref(); DEFAULT_REF_RETURN; } >+ void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS) final { m_rule.deref(DEREF_DEFAULT_ARGUMENTS); } > > private: > unsigned length() const final { return m_rule.length(); } >diff --git a/Source/WebCore/css/CSSSegmentedFontFace.h b/Source/WebCore/css/CSSSegmentedFontFace.h >index f66e7339320..5320261463a 100644 >--- a/Source/WebCore/css/CSSSegmentedFontFace.h >+++ b/Source/WebCore/css/CSSSegmentedFontFace.h >@@ -53,8 +53,8 @@ public: > Vector<Ref<CSSFontFace>, 1>& constituentFaces() { return m_fontFaces; } > > // CSSFontFace::Client needs to be able to be held in a RefPtr. >- void ref() final { RefCounted<CSSSegmentedFontFace>::ref(); } >- void deref() final { RefCounted<CSSSegmentedFontFace>::deref(); } >+ REF_RETURN_TYPE ref() final { return RefCounted<CSSSegmentedFontFace>::ref(); } >+ void deref(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { RefCounted<CSSSegmentedFontFace>::deref(DEREF_ARGUMENT_NAME); } > > private: > CSSSegmentedFontFace(); >diff --git a/Source/WebCore/css/CSSSelector.h b/Source/WebCore/css/CSSSelector.h >index 03e9f16d884..4975ecfd4bb 100644 >--- a/Source/WebCore/css/CSSSelector.h >+++ b/Source/WebCore/css/CSSSelector.h >@@ -469,7 +469,7 @@ inline void CSSSelector::setValue(const AtomicString& value, bool matchLowerCase > // Need to do ref counting manually for the union. > if (!m_hasRareData) { > if (m_data.m_value) >- m_data.m_value->deref(); >+ m_data.m_value->deref(DEREF_DEFAULT_ARGUMENTS); > m_data.m_value = value.impl(); > m_data.m_value->ref(); > return; >@@ -535,19 +535,19 @@ inline CSSSelector::~CSSSelector() > m_destructorHasBeenCalled = true; > #endif > if (m_hasRareData) { >- m_data.m_rareData->deref(); >+ m_data.m_rareData->deref(DEREF_DEFAULT_ARGUMENTS); > m_data.m_rareData = nullptr; > m_hasRareData = false; > } else if (m_hasNameWithCase) { >- m_data.m_nameWithCase->deref(); >+ m_data.m_nameWithCase->deref(DEREF_DEFAULT_ARGUMENTS); > m_data.m_nameWithCase = nullptr; > m_hasNameWithCase = false; > } else if (match() == Tag) { >- m_data.m_tagQName->deref(); >+ m_data.m_tagQName->deref(DEREF_DEFAULT_ARGUMENTS); > m_data.m_tagQName = nullptr; > m_match = Unknown; > } else if (m_data.m_value) { >- m_data.m_value->deref(); >+ m_data.m_value->deref(DEREF_DEFAULT_ARGUMENTS); > m_data.m_value = nullptr; > } > } >diff --git a/Source/WebCore/css/CSSStyleDeclaration.h b/Source/WebCore/css/CSSStyleDeclaration.h >index b18c9ce3274..933d1d9dd91 100644 >--- a/Source/WebCore/css/CSSStyleDeclaration.h >+++ b/Source/WebCore/css/CSSStyleDeclaration.h >@@ -43,8 +43,8 @@ class CSSStyleDeclaration : public ScriptWrappable { > public: > virtual ~CSSStyleDeclaration() = default; > >- virtual void ref() = 0; >- virtual void deref() = 0; >+ virtual REF_RETURN_TYPE ref() = 0; >+ virtual void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS) = 0; > > virtual StyledElement* parentElement() const { return nullptr; } > virtual CSSRule* parentRule() const = 0; >diff --git a/Source/WebCore/css/CSSStyleSheet.cpp b/Source/WebCore/css/CSSStyleSheet.cpp >index 1ecc5ba3708..ae7a2aef75d 100644 >--- a/Source/WebCore/css/CSSStyleSheet.cpp >+++ b/Source/WebCore/css/CSSStyleSheet.cpp >@@ -45,8 +45,8 @@ public: > StyleSheetCSSRuleList(CSSStyleSheet* sheet) : m_styleSheet(sheet) { } > > private: >- void ref() final { m_styleSheet->ref(); } >- void deref() final { m_styleSheet->deref(); } >+ REF_RETURN_TYPE ref() final { m_styleSheet->ref(); DEFAULT_REF_RETURN; } >+ void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS) final { m_styleSheet->deref(DEREF_DEFAULT_ARGUMENTS); } > > unsigned length() const final { return m_styleSheet->length(); } > CSSRule* item(unsigned index) const final { return m_styleSheet->item(index); } >diff --git a/Source/WebCore/css/CSSValue.h b/Source/WebCore/css/CSSValue.h >index d44b0750bfa..b3046cae25f 100644 >--- a/Source/WebCore/css/CSSValue.h >+++ b/Source/WebCore/css/CSSValue.h >@@ -51,9 +51,9 @@ public: > > // Override RefCounted's deref() to ensure operator delete is called on > // the appropriate subclass type. >- void deref() >+ void deref(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) > { >- if (derefBase()) >+ if (derefBase(DEREF_ARGUMENT_NAME)) > destroy(); > } > >diff --git a/Source/WebCore/css/DeprecatedCSSOMValue.h b/Source/WebCore/css/DeprecatedCSSOMValue.h >index 77e2e36c692..ca33238e5d0 100644 >--- a/Source/WebCore/css/DeprecatedCSSOMValue.h >+++ b/Source/WebCore/css/DeprecatedCSSOMValue.h >@@ -48,9 +48,9 @@ public: > > // Override RefCounted's deref() to ensure operator delete is called on > // the appropriate subclass type. >- void deref() >+ void deref(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) > { >- if (derefBase()) >+ if (derefBase(DEREF_ARGUMENT_NAME)) > destroy(); > } > >diff --git a/Source/WebCore/css/FontFace.cpp b/Source/WebCore/css/FontFace.cpp >index 581f5e8c9e5..d276533cec1 100644 >--- a/Source/WebCore/css/FontFace.cpp >+++ b/Source/WebCore/css/FontFace.cpp >@@ -448,14 +448,14 @@ void FontFace::fontStateChanged(CSSFontFace& face, CSSFontFace::Status, CSSFontF > // gone through a load cycle, we can sometimes come back through here and try to resolve the promise again. > if (!m_loadedPromise.isFulfilled()) > m_loadedPromise.resolve(*this); >- deref(); >+ deref(DEREF_DEFAULT_ARGUMENTS); > return; > case CSSFontFace::Status::Failure: > // FIXME: This check should not be needed, but because FontFace's are sometimes adopted after they have already > // gone through a load cycle, we can sometimes come back through here and try to resolve the promise again. > if (!m_loadedPromise.isFulfilled()) > m_loadedPromise.reject(Exception { NetworkError }); >- deref(); >+ deref(DEREF_DEFAULT_ARGUMENTS); > return; > case CSSFontFace::Status::Pending: > ASSERT_NOT_REACHED(); >diff --git a/Source/WebCore/css/FontFace.h b/Source/WebCore/css/FontFace.h >index 3480030f598..1f6cca4b53b 100644 >--- a/Source/WebCore/css/FontFace.h >+++ b/Source/WebCore/css/FontFace.h >@@ -90,8 +90,8 @@ public: > > WeakPtr<FontFace> createWeakPtr(); > >- void ref() final { RefCounted::ref(); } >- void deref() final { RefCounted::deref(); } >+ REF_RETURN_TYPE ref() final { return RefCounted::ref(); } >+ void deref(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { RefCounted::deref(DEREF_ARGUMENT_NAME); } > > private: > explicit FontFace(CSSFontSelector&); >diff --git a/Source/WebCore/css/FontFaceSet.h b/Source/WebCore/css/FontFaceSet.h >index 1c89172a8e7..fc0d58789bb 100644 >--- a/Source/WebCore/css/FontFaceSet.h >+++ b/Source/WebCore/css/FontFaceSet.h >@@ -105,8 +105,8 @@ private: > // EventTarget > EventTargetInterface eventTargetInterface() const final { return FontFaceSetEventTargetInterfaceType; } > ScriptExecutionContext* scriptExecutionContext() const final { return ActiveDOMObject::scriptExecutionContext(); } >- void refEventTarget() final { ref(); } >- void derefEventTarget() final { deref(); } >+ REF_RETURN_TYPE refEventTarget() final { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { deref(DEREF_ARGUMENT_NAME); } > > // Callback for ReadyPromise. > FontFaceSet& readyPromiseResolve(); >diff --git a/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp b/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp >index 0e14bdf8e22..9f413b3ae28 100644 >--- a/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp >+++ b/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp >@@ -129,14 +129,15 @@ PropertySetCSSStyleDeclaration* StyleAttributeMutationScope::s_currentDecl = nul > bool StyleAttributeMutationScope::s_shouldNotifyInspector = false; > bool StyleAttributeMutationScope::s_shouldDeliver = false; > >-void PropertySetCSSStyleDeclaration::ref() >+REF_RETURN_TYPE PropertySetCSSStyleDeclaration::ref() > { > m_propertySet->ref(); >+ DEFAULT_REF_RETURN; > } > >-void PropertySetCSSStyleDeclaration::deref() >+void PropertySetCSSStyleDeclaration::deref(DEREF_ARGUMENT_TYPE) > { >- m_propertySet->deref(); >+ m_propertySet->deref(DEREF_DEFAULT_ARGUMENTS); > } > > unsigned PropertySetCSSStyleDeclaration::length() const >@@ -353,15 +354,16 @@ StyleRuleCSSStyleDeclaration::StyleRuleCSSStyleDeclaration(MutableStylePropertie > > StyleRuleCSSStyleDeclaration::~StyleRuleCSSStyleDeclaration() > { >- m_propertySet->deref(); >+ m_propertySet->deref(DEREF_DEFAULT_ARGUMENTS); > } > >-void StyleRuleCSSStyleDeclaration::ref() >+REF_RETURN_TYPE StyleRuleCSSStyleDeclaration::ref() > { > ++m_refCount; >+ DEFAULT_REF_RETURN; > } > >-void StyleRuleCSSStyleDeclaration::deref() >+void StyleRuleCSSStyleDeclaration::deref(DEREF_ARGUMENT_TYPE) > { > ASSERT(m_refCount); > if (!--m_refCount) >@@ -404,7 +406,7 @@ CSSParserContext StyleRuleCSSStyleDeclaration::cssParserContext() const > > void StyleRuleCSSStyleDeclaration::reattach(MutableStyleProperties& propertySet) > { >- m_propertySet->deref(); >+ m_propertySet->deref(DEREF_DEFAULT_ARGUMENTS); > m_propertySet = &propertySet; > m_propertySet->ref(); > } >diff --git a/Source/WebCore/css/PropertySetCSSStyleDeclaration.h b/Source/WebCore/css/PropertySetCSSStyleDeclaration.h >index 7bc1f6ecad3..0c5cad611ad 100644 >--- a/Source/WebCore/css/PropertySetCSSStyleDeclaration.h >+++ b/Source/WebCore/css/PropertySetCSSStyleDeclaration.h >@@ -61,8 +61,8 @@ protected: > std::unique_ptr<HashMap<CSSValue*, WeakPtr<DeprecatedCSSOMValue>>> m_cssomValueWrappers; > > private: >- void ref() override; >- void deref() override; >+ REF_RETURN_TYPE ref() override; >+ void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS) override; > > CSSRule* parentRule() const override { return nullptr; } > unsigned length() const final; >@@ -98,8 +98,8 @@ public: > > void clearParentRule() { m_parentRule = nullptr; } > >- void ref() final; >- void deref() final; >+ REF_RETURN_TYPE ref() final; >+ void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS) final; > > void reattach(MutableStyleProperties&); > >diff --git a/Source/WebCore/css/RuleSet.h b/Source/WebCore/css/RuleSet.h >index ba5dc60fe34..71dd75d28f2 100644 >--- a/Source/WebCore/css/RuleSet.h >+++ b/Source/WebCore/css/RuleSet.h >@@ -98,7 +98,9 @@ struct SameSizeAsRuleData { > unsigned d[4]; > }; > >+#ifndef ALLOW_REF_TRACING > COMPILE_ASSERT(sizeof(RuleData) == sizeof(SameSizeAsRuleData), RuleData_should_stay_small); >+#endif > > class RuleSet { > WTF_MAKE_NONCOPYABLE(RuleSet); WTF_MAKE_FAST_ALLOCATED; >diff --git a/Source/WebCore/css/StyleProperties.cpp b/Source/WebCore/css/StyleProperties.cpp >index 30dbeb42b6b..f06c61b00fd 100644 >--- a/Source/WebCore/css/StyleProperties.cpp >+++ b/Source/WebCore/css/StyleProperties.cpp >@@ -102,7 +102,7 @@ ImmutableStyleProperties::~ImmutableStyleProperties() > { > CSSValue** valueArray = const_cast<CSSValue**>(this->valueArray()); > for (unsigned i = 0; i < m_arraySize; ++i) >- valueArray[i]->deref(); >+ valueArray[i]->deref(DEREF_DEFAULT_ARGUMENTS); > } > > MutableStyleProperties::MutableStyleProperties(const StyleProperties& other) >diff --git a/Source/WebCore/css/StyleProperties.h b/Source/WebCore/css/StyleProperties.h >index 2661ec11211..7c50cb7dfec 100644 >--- a/Source/WebCore/css/StyleProperties.h >+++ b/Source/WebCore/css/StyleProperties.h >@@ -51,7 +51,7 @@ class StylePropertiesBase : public RefCounted<StylePropertiesBase> { > public: > // Override RefCounted's deref() to ensure operator delete is called on > // the appropriate subclass type. >- void deref(); >+ void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS); > > StylePropertiesType type() const { return static_cast<StylePropertiesType>(m_type); } > >@@ -305,9 +305,9 @@ inline unsigned StyleProperties::propertyCount() const > return downcast<ImmutableStyleProperties>(*this).propertyCount(); > } > >-inline void StylePropertiesBase::deref() >+inline void StylePropertiesBase::deref(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) > { >- if (!derefBase()) >+ if (!derefBase(DEREF_ARGUMENT_NAME)) > return; > > if (is<MutableStyleProperties>(*this)) >diff --git a/Source/WebCore/css/StyleRule.h b/Source/WebCore/css/StyleRule.h >index 2c1fedd12e4..80c842d09fc 100644 >--- a/Source/WebCore/css/StyleRule.h >+++ b/Source/WebCore/css/StyleRule.h >@@ -77,9 +77,9 @@ public: > > Ref<StyleRuleBase> copy() const; > >- void deref() >+ void deref(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) > { >- if (derefBase()) >+ if (derefBase(DEREF_ARGUMENT_NAME)) > destroy(); > } > >diff --git a/Source/WebCore/dom/AbortSignal.h b/Source/WebCore/dom/AbortSignal.h >index d3140acc2d8..56c45e930f4 100644 >--- a/Source/WebCore/dom/AbortSignal.h >+++ b/Source/WebCore/dom/AbortSignal.h >@@ -50,8 +50,8 @@ private: > > EventTargetInterface eventTargetInterface() const final { return AbortSignalEventTargetInterfaceType; } > ScriptExecutionContext* scriptExecutionContext() const final { return ContextDestructionObserver::scriptExecutionContext(); } >- void refEventTarget() final { ref(); } >- void derefEventTarget() final { deref(); } >+ REF_RETURN_TYPE refEventTarget() final { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { deref(DEREF_ARGUMENT_NAME); } > > bool m_aborted { false }; > }; >diff --git a/Source/WebCore/dom/ActiveDOMObject.h b/Source/WebCore/dom/ActiveDOMObject.h >index 6156bd1703e..13600916ac7 100644 >--- a/Source/WebCore/dom/ActiveDOMObject.h >+++ b/Source/WebCore/dom/ActiveDOMObject.h >@@ -82,7 +82,7 @@ public: > { > ASSERT(m_pendingActivityCount > 0); > --m_pendingActivityCount; >- thisObject->deref(); >+ thisObject->deref(DEREF_DEFAULT_ARGUMENTS); > } > > template<class T> >diff --git a/Source/WebCore/dom/DOMImplementation.h b/Source/WebCore/dom/DOMImplementation.h >index a40a2f6912f..c43b22d92ef 100644 >--- a/Source/WebCore/dom/DOMImplementation.h >+++ b/Source/WebCore/dom/DOMImplementation.h >@@ -33,8 +33,8 @@ class DOMImplementation : public ScriptWrappable { > public: > explicit DOMImplementation(Document&); > >- void ref() { m_document.ref(); } >- void deref() { m_document.deref(); } >+ REF_RETURN_TYPE ref() { m_document.ref(); DEFAULT_REF_RETURN; } >+ void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS) { m_document.deref(DEREF_DEFAULT_ARGUMENTS); } > Document& document() { return m_document; } > > WEBCORE_EXPORT ExceptionOr<Ref<DocumentType>> createDocumentType(const String& qualifiedName, const String& publicId, const String& systemId); >diff --git a/Source/WebCore/dom/DataTransferItemList.h b/Source/WebCore/dom/DataTransferItemList.h >index 13120e54ad3..8c568f709dd 100644 >--- a/Source/WebCore/dom/DataTransferItemList.h >+++ b/Source/WebCore/dom/DataTransferItemList.h >@@ -51,8 +51,8 @@ public: > ~DataTransferItemList(); > > // DataTransfer owns DataTransferItemList, and DataTransfer is kept alive as long as DataTransferItemList is alive. >- void ref() { m_dataTransfer.ref(); } >- void deref() { m_dataTransfer.deref(); } >+ REF_RETURN_TYPE ref() { m_dataTransfer.ref(); DEFAULT_REF_RETURN; } >+ void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS) { m_dataTransfer.deref(DEREF_DEFAULT_ARGUMENTS); } > DataTransfer& dataTransfer() { return m_dataTransfer; } > > // DOM API >diff --git a/Source/WebCore/dom/DatasetDOMStringMap.cpp b/Source/WebCore/dom/DatasetDOMStringMap.cpp >index ec6315c960b..e5a4ee1003a 100644 >--- a/Source/WebCore/dom/DatasetDOMStringMap.cpp >+++ b/Source/WebCore/dom/DatasetDOMStringMap.cpp >@@ -140,14 +140,15 @@ static AtomicString convertPropertyNameToAttributeName(const String& name) > return convertPropertyNameToAttributeName<UChar>(*nameImpl); > } > >-void DatasetDOMStringMap::ref() >+REF_RETURN_TYPE DatasetDOMStringMap::ref() > { > m_element.ref(); >+ DEFAULT_REF_RETURN; > } > >-void DatasetDOMStringMap::deref() >+void DatasetDOMStringMap::deref(DEREF_ARGUMENT_TYPE) > { >- m_element.deref(); >+ m_element.deref(DEREF_DEFAULT_ARGUMENTS); > } > > bool DatasetDOMStringMap::isSupportedPropertyName(const String& propertyName) const >diff --git a/Source/WebCore/dom/DatasetDOMStringMap.h b/Source/WebCore/dom/DatasetDOMStringMap.h >index 9100db8c88c..35fb01f837b 100644 >--- a/Source/WebCore/dom/DatasetDOMStringMap.h >+++ b/Source/WebCore/dom/DatasetDOMStringMap.h >@@ -40,8 +40,8 @@ public: > { > } > >- void ref(); >- void deref(); >+ REF_RETURN_TYPE ref(); >+ void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS); > > bool isSupportedPropertyName(const String& name) const; > Vector<String> supportedPropertyNames() const; >diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp >index 527d6e4e276..ef4c413ba7b 100644 >--- a/Source/WebCore/dom/Document.cpp >+++ b/Source/WebCore/dom/Document.cpp >@@ -526,7 +526,7 @@ Document::Document(Frame* frame, const URL& url, unsigned documentClasses, unsig > , m_identifier(generateObjectIdentifier<DocumentIdentifierType>()) > { > ++DocumentCount; >-// WTFLogAlways("Created document %p %s (%d documents)", this, url.string().utf8().data(), DocumentCount); >+ WTFLogAlways("Created document %p %s (%d documents)", this, url.string().utf8().data(), DocumentCount); > > auto addResult = allDocumentsMap().add(m_identifier, this); > ASSERT_UNUSED(addResult, addResult.isNewEntry); >@@ -580,7 +580,7 @@ Ref<Document> Document::create(Document& contextDocument) > Document::~Document() > { > --DocumentCount; >-// WTFLogAlways("Destroying document %p %s (%d documents)", this, url().string().utf8().data(), DocumentCount); >+ WTFLogAlways("Destroying document %p %s (%d documents)", this, url().string().utf8().data(), DocumentCount); > > if (m_logger) > m_logger->removeObserver(*this); >@@ -717,6 +717,11 @@ void Document::removedLastRef() > } > } > >+unsigned Document::referencingNodeCount() const >+{ >+ return m_referencingNodeCount; >+} >+ > void Document::commonTeardown() > { > if (svgExtensions()) >diff --git a/Source/WebCore/dom/Document.h b/Source/WebCore/dom/Document.h >index b236fd3deba..ffd3825072c 100644 >--- a/Source/WebCore/dom/Document.h >+++ b/Source/WebCore/dom/Document.h >@@ -362,7 +362,7 @@ public: > } > } > >- unsigned referencingNodeCount() const { return m_referencingNodeCount; } >+ WEBCORE_EXPORT unsigned referencingNodeCount() const; > > void removedLastRef(); > >@@ -1473,8 +1473,8 @@ private: > Ref<Node> cloneNodeInternal(Document&, CloningOperation) final; > void cloneDataFromDocument(const Document&); > >- void refScriptExecutionContext() final { ref(); } >- void derefScriptExecutionContext() final { deref(); } >+ REF_RETURN_TYPE refScriptExecutionContext() final { return ref(); } >+ void derefScriptExecutionContext(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { deref(DEREF_ARGUMENT_NAME); } > > // The following addMessage function is deprecated. > // Callers should try to create the ConsoleMessage themselves. >diff --git a/Source/WebCore/dom/ElementData.cpp b/Source/WebCore/dom/ElementData.cpp >index 9515305584b..a5c597ece6d 100644 >--- a/Source/WebCore/dom/ElementData.cpp >+++ b/Source/WebCore/dom/ElementData.cpp >@@ -56,7 +56,9 @@ struct SameSizeAsElementData : public RefCounted<SameSizeAsElementData> { > void* refPtrs[3]; > }; > >+#ifndef ALLOW_REF_TRACING > COMPILE_ASSERT(sizeof(ElementData) == sizeof(SameSizeAsElementData), element_attribute_data_should_stay_small); >+#endif > > static size_t sizeForShareableElementDataWithAttributeCount(unsigned count) > { >diff --git a/Source/WebCore/dom/ElementData.h b/Source/WebCore/dom/ElementData.h >index f6d1eafd736..666bc97aeec 100644 >--- a/Source/WebCore/dom/ElementData.h >+++ b/Source/WebCore/dom/ElementData.h >@@ -80,7 +80,7 @@ class ElementData : public RefCounted<ElementData> { > public: > // Override RefCounted's deref() to ensure operator delete is called on > // the appropriate subclass type. >- void deref(); >+ void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS); > > static const unsigned attributeNotFound = static_cast<unsigned>(-1); > >@@ -223,9 +223,9 @@ public: > AttributeVector m_attributeVector; > }; > >-inline void ElementData::deref() >+inline void ElementData::deref(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) > { >- if (!derefBase()) >+ if (!derefBase(DEREF_ARGUMENT_NAME)) > return; > destroy(); > } >diff --git a/Source/WebCore/dom/ElementRareData.cpp b/Source/WebCore/dom/ElementRareData.cpp >index 478a8887e00..b12bb6449a5 100644 >--- a/Source/WebCore/dom/ElementRareData.cpp >+++ b/Source/WebCore/dom/ElementRareData.cpp >@@ -46,6 +46,8 @@ struct SameSizeAsElementRareData : NodeRareData { > void* pointers[8]; > }; > >+#ifndef ALLOW_REF_TRACING > static_assert(sizeof(ElementRareData) == sizeof(SameSizeAsElementRareData), "ElementRareData should stay small"); >+#endif > > } // namespace WebCore >diff --git a/Source/WebCore/dom/EventTarget.h b/Source/WebCore/dom/EventTarget.h >index 90b122ae74c..f85eb92ef85 100644 >--- a/Source/WebCore/dom/EventTarget.h >+++ b/Source/WebCore/dom/EventTarget.h >@@ -60,8 +60,8 @@ DOM_EVENT_TARGET_INTERFACES_FOR_EACH(DOM_EVENT_INTERFACE_DECLARE) > > class EventTarget : public ScriptWrappable { > public: >- void ref() { refEventTarget(); } >- void deref() { derefEventTarget(); } >+ REF_RETURN_TYPE ref() { return refEventTarget(); } >+ void deref(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) { derefEventTarget(DEREF_ARGUMENT_NAME); } > > virtual EventTargetInterface eventTargetInterface() const = 0; > virtual ScriptExecutionContext* scriptExecutionContext() const = 0; >@@ -125,8 +125,8 @@ protected: > const EventTargetData* eventTargetData() const; > > private: >- virtual void refEventTarget() = 0; >- virtual void derefEventTarget() = 0; >+ virtual REF_RETURN_TYPE refEventTarget() = 0; >+ virtual void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) = 0; > > void fireEventListeners(Event&, EventListenerVector); > >diff --git a/Source/WebCore/dom/MessagePort.cpp b/Source/WebCore/dom/MessagePort.cpp >index 6f7fd36be3d..a43b08fd6ca 100644 >--- a/Source/WebCore/dom/MessagePort.cpp >+++ b/Source/WebCore/dom/MessagePort.cpp >@@ -50,12 +50,13 @@ static Lock& allMessagePortsLock() > return lock; > } > >-void MessagePort::ref() const >+REF_RETURN_TYPE MessagePort::ref() const > { > ++m_refCount; >+ DEFAULT_REF_RETURN; > } > >-void MessagePort::deref() const >+void MessagePort::deref(DEREF_ARGUMENT_TYPE) const > { > // This custom deref() function ensures that as long as the lock to allMessagePortsLock is taken, no MessagePort will be destroyed. > // This allows isExistingMessagePortLocallyReachable and notifyMessageAvailable to easily query the map and manipulate MessagePort instances. >diff --git a/Source/WebCore/dom/MessagePort.h b/Source/WebCore/dom/MessagePort.h >index cb97d11c885..e47dd6cdf91 100644 >--- a/Source/WebCore/dom/MessagePort.h >+++ b/Source/WebCore/dom/MessagePort.h >@@ -78,8 +78,8 @@ public: > const MessagePortIdentifier& identifier() const { return m_identifier; } > const MessagePortIdentifier& remoteIdentifier() const { return m_remoteIdentifier; } > >- WEBCORE_EXPORT void ref() const; >- WEBCORE_EXPORT void deref() const; >+ WEBCORE_EXPORT REF_RETURN_TYPE ref() const; >+ WEBCORE_EXPORT void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS) const; > > // ActiveDOMObject > const char* activeDOMObjectName() const final; >@@ -93,8 +93,8 @@ public: > // EventTargetWithInlineData. > EventTargetInterface eventTargetInterface() const final { return MessagePortEventTargetInterfaceType; } > ScriptExecutionContext* scriptExecutionContext() const final { return ActiveDOMObject::scriptExecutionContext(); } >- void refEventTarget() final { ref(); } >- void derefEventTarget() final { deref(); } >+ REF_RETURN_TYPE refEventTarget() final { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { deref(DEREF_ARGUMENT_NAME); } > > private: > explicit MessagePort(ScriptExecutionContext&, const MessagePortIdentifier& local, const MessagePortIdentifier& remote); >diff --git a/Source/WebCore/dom/MutationObserver.cpp b/Source/WebCore/dom/MutationObserver.cpp >index bc7fe7c8cff..890f738ece0 100644 >--- a/Source/WebCore/dom/MutationObserver.cpp >+++ b/Source/WebCore/dom/MutationObserver.cpp >@@ -85,19 +85,19 @@ MutationObserver::~MutationObserver() > WTFLogAlways("MutationObserver %p dtor - %d (activeMutationObservers size is %u, suspendedMutationObservers size is %u)", this, MutationObserverCount, activeMutationObservers().size(), suspendedMutationObservers().size()); > } > >-void MutationObserver::ref() >+REF_RETURN_TYPE MutationObserver::ref() > { > CFRetain(m_treeTrap); >- RefCounted::ref(); >+ return RefCounted::ref(); > } > >-void MutationObserver::deref() >+void MutationObserver::deref(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) > { > CFRelease(m_treeTrap); > if (hasOneRef()) { > m_treeTrap = nullptr; > } >- RefCounted::deref(); >+ RefCounted::deref(DEREF_ARGUMENT_NAME); > } > > bool MutationObserver::validateOptions(MutationObserverOptions options) >diff --git a/Source/WebCore/dom/MutationObserver.h b/Source/WebCore/dom/MutationObserver.h >index a810e71d757..16e999b2cd7 100644 >--- a/Source/WebCore/dom/MutationObserver.h >+++ b/Source/WebCore/dom/MutationObserver.h >@@ -100,8 +100,8 @@ public: > > static void enqueueSlotChangeEvent(HTMLSlotElement&); > >- void ref(); >- void deref(); >+ REF_RETURN_TYPE ref(); >+ void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS); > > private: > explicit MutationObserver(Ref<MutationCallback>&&); >diff --git a/Source/WebCore/dom/NamedNodeMap.cpp b/Source/WebCore/dom/NamedNodeMap.cpp >index 5b74a2b3598..9514471726f 100644 >--- a/Source/WebCore/dom/NamedNodeMap.cpp >+++ b/Source/WebCore/dom/NamedNodeMap.cpp >@@ -33,14 +33,15 @@ namespace WebCore { > > using namespace HTMLNames; > >-void NamedNodeMap::ref() >+REF_RETURN_TYPE NamedNodeMap::ref() > { > m_element.ref(); >+ DEFAULT_REF_RETURN; > } > >-void NamedNodeMap::deref() >+void NamedNodeMap::deref(DEREF_ARGUMENT_TYPE) > { >- m_element.deref(); >+ m_element.deref(DEREF_DEFAULT_ARGUMENTS); > } > > RefPtr<Attr> NamedNodeMap::getNamedItem(const AtomicString& name) const >diff --git a/Source/WebCore/dom/NamedNodeMap.h b/Source/WebCore/dom/NamedNodeMap.h >index 2cb59644998..4d33e33ea88 100644 >--- a/Source/WebCore/dom/NamedNodeMap.h >+++ b/Source/WebCore/dom/NamedNodeMap.h >@@ -40,8 +40,8 @@ public: > { > } > >- WEBCORE_EXPORT void ref(); >- WEBCORE_EXPORT void deref(); >+ WEBCORE_EXPORT REF_RETURN_TYPE ref(); >+ WEBCORE_EXPORT void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS); > > WEBCORE_EXPORT unsigned length() const; > WEBCORE_EXPORT RefPtr<Attr> item(unsigned index) const; >diff --git a/Source/WebCore/dom/Node.cpp b/Source/WebCore/dom/Node.cpp >index 86143d5b2ec..fb90f797483 100644 >--- a/Source/WebCore/dom/Node.cpp >+++ b/Source/WebCore/dom/Node.cpp >@@ -277,8 +277,7 @@ Node::Node(Document& document, ConstructionType type) > }; > m_treeTrap = CFTreeCreate(kCFAllocatorDefault, &context); > >- ++NodeCount; >-// WTFLogAlways("Node %p ctor (tree trap %p) - %d", this, m_treeTrap, NodeCount); >+ WTFLogAlways("Node %p ctor (tree trap %p) - %d", this, m_treeTrap, ++NodeCount); > } > > Node::~Node() >@@ -321,12 +320,11 @@ Node::~Node() > } > #endif > >- --NodeCount; >-// WTFLogAlways("Node %p dtor - %d", this, NodeCount); >+ WTFLogAlways("Node %p dtor - %d", this, --NodeCount); > } > > >-void Node::ref() >+REF_RETURN_TYPE Node::ref() > { > ASSERT(isMainThread()); > ASSERT(!m_deletionHasBegun); >@@ -343,10 +341,16 @@ void Node::ref() > > ++m_refCount; > >+ > ASSERT(m_refCount == CFGetRetainCount(m_treeTrap)); >+#if ALLOW_REF_TRACING >+ return m_refTracker.trackRef(); >+#else >+ DEFAULT_REF_RETURN; >+#endif > } > >-void Node::deref() >+void Node::deref(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) > { > ASSERT(isMainThread()); > ASSERT(m_refCount >= 0); >@@ -356,6 +360,10 @@ void Node::deref() > > --m_refCount; > CFRelease(m_treeTrap); >+ >+#if ALLOW_REF_TRACING >+ m_refTracker.trackDeref(DEREF_ARGUMENT_NAME); >+#endif > > if (m_refCount <= 0 && !parentNode()) { > #ifndef NDEBUG >@@ -369,8 +377,6 @@ void Node::deref() > } > > >- >- > void Node::willBeDeletedFrom(Document& document) > { > if (hasEventTargetData()) { >@@ -807,14 +813,14 @@ LayoutRect Node::renderRect(bool* isReplaced) > return LayoutRect(); > } > >-void Node::refEventTarget() >+REF_RETURN_TYPE Node::refEventTarget() > { >- ref(); >+ return ref(); > } > >-void Node::derefEventTarget() >+void Node::derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) > { >- deref(); >+ deref(DEREF_ARGUMENT_NAME); > } > > void Node::adjustStyleValidity(Style::Validity validity, Style::InvalidationMode mode) >diff --git a/Source/WebCore/dom/Node.h b/Source/WebCore/dom/Node.h >index a6d53d86479..6aacca07b3b 100644 >--- a/Source/WebCore/dom/Node.h >+++ b/Source/WebCore/dom/Node.h >@@ -36,6 +36,7 @@ > #include <wtf/IsoMalloc.h> > #include <wtf/ListHashSet.h> > #include <wtf/MainThread.h> >+#include <wtf/RefTracker.h> > > // This needs to be here because Document.h also depends on it. > #define DUMP_NODE_STATISTICS 1 >@@ -502,13 +503,16 @@ public: > // Perform the default action for an event. > virtual void defaultEventHandler(Event&); > >- WEBCORE_EXPORT void ref(); >- WEBCORE_EXPORT void deref(); >+ WEBCORE_EXPORT REF_RETURN_TYPE ref(); >+ WEBCORE_EXPORT void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS); > > bool hasOneRef() const; > int refCount() const; > > CFTreeRef treeTrap() const { return m_treeTrap; } >+#if ALLOW_REF_TRACING >+ const RefTracker& refTracker() const { return m_refTracker; } >+#endif > > #ifndef NDEBUG > bool m_deletionHasBegun { false }; >@@ -651,8 +655,9 @@ private: > > WEBCORE_EXPORT void removedLastRef(); > >- void refEventTarget() final; >- void derefEventTarget() final; >+ REF_RETURN_TYPE refEventTarget() final; >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final; >+ > bool isNode() const final; > > void trackForDebugging(); >@@ -683,6 +688,9 @@ private: > } m_data { nullptr }; > > CFTreeRef m_treeTrap { nullptr }; >+#if ALLOW_REF_TRACING >+ RefTracker m_refTracker; >+#endif > }; > > #ifndef NDEBUG >diff --git a/Source/WebCore/dom/ScriptElement.cpp b/Source/WebCore/dom/ScriptElement.cpp >index b37ba4d1083..2f659f9d740 100644 >--- a/Source/WebCore/dom/ScriptElement.cpp >+++ b/Source/WebCore/dom/ScriptElement.cpp >@@ -466,14 +466,15 @@ String ScriptElement::scriptContent() const > return TextNodeTraversal::childTextContent(m_element); > } > >-void ScriptElement::ref() >+REF_RETURN_TYPE ScriptElement::ref() > { > m_element.ref(); >+ DEFAULT_REF_RETURN; > } > >-void ScriptElement::deref() >+void ScriptElement::deref(DEREF_ARGUMENT_TYPE) > { >- m_element.deref(); >+ m_element.deref(DEREF_DEFAULT_ARGUMENTS); > } > > bool isScriptElement(Element& element) >diff --git a/Source/WebCore/dom/ScriptElement.h b/Source/WebCore/dom/ScriptElement.h >index a61dad45e9e..f3fe5ca0a47 100644 >--- a/Source/WebCore/dom/ScriptElement.h >+++ b/Source/WebCore/dom/ScriptElement.h >@@ -69,8 +69,8 @@ public: > enum class ScriptType { Classic, Module }; > ScriptType scriptType() const { return m_isModuleScript ? ScriptType::Module : ScriptType::Classic; } > >- void ref(); >- void deref(); >+ REF_RETURN_TYPE ref(); >+ void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS); > > protected: > ScriptElement(Element&, bool createdByParser, bool isEvaluated); >diff --git a/Source/WebCore/dom/ScriptExecutionContext.h b/Source/WebCore/dom/ScriptExecutionContext.h >index 2ad27ef37d7..eb7370218e5 100644 >--- a/Source/WebCore/dom/ScriptExecutionContext.h >+++ b/Source/WebCore/dom/ScriptExecutionContext.h >@@ -157,8 +157,8 @@ public: > > virtual void didLoadResourceSynchronously(); > >- void ref() { refScriptExecutionContext(); } >- void deref() { derefScriptExecutionContext(); } >+ REF_RETURN_TYPE ref() { return refScriptExecutionContext(); } >+ void deref(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) { derefScriptExecutionContext(DEREF_ARGUMENT_NAME); } > > class Task { > WTF_MAKE_FAST_ALLOCATED; >@@ -291,8 +291,8 @@ private: > virtual void logExceptionToConsole(const String& errorMessage, const String& sourceURL, int lineNumber, int columnNumber, RefPtr<Inspector::ScriptCallStack>&&) = 0; > bool dispatchErrorEvent(const String& errorMessage, int lineNumber, int columnNumber, const String& sourceURL, JSC::Exception*, CachedScript*); > >- virtual void refScriptExecutionContext() = 0; >- virtual void derefScriptExecutionContext() = 0; >+ virtual REF_RETURN_TYPE refScriptExecutionContext() = 0; >+ virtual void derefScriptExecutionContext(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS) = 0; > > RejectedPromiseTracker& ensureRejectedPromiseTrackerSlow(); > >diff --git a/Source/WebCore/dom/SpaceSplitString.h b/Source/WebCore/dom/SpaceSplitString.h >index 057fbfc47e8..a69d6102bdb 100644 >--- a/Source/WebCore/dom/SpaceSplitString.h >+++ b/Source/WebCore/dom/SpaceSplitString.h >@@ -54,14 +54,15 @@ public: > return tokenArrayStart()[i]; > } > >- void ref() >+ REF_RETURN_TYPE ref() > { > ASSERT(isMainThread()); > ASSERT(m_refCount); > ++m_refCount; >+ DEFAULT_REF_RETURN; > } > >- void deref() >+ void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS) > { > ASSERT(isMainThread()); > ASSERT(m_refCount); >diff --git a/Source/WebCore/fileapi/FileReader.h b/Source/WebCore/fileapi/FileReader.h >index ef89f5bd6e0..ca4676e9219 100644 >--- a/Source/WebCore/fileapi/FileReader.h >+++ b/Source/WebCore/fileapi/FileReader.h >@@ -82,8 +82,8 @@ private: > > EventTargetInterface eventTargetInterface() const final { return FileReaderEventTargetInterfaceType; } > ScriptExecutionContext* scriptExecutionContext() const final { return ActiveDOMObject::scriptExecutionContext(); } >- void refEventTarget() final { ref(); } >- void derefEventTarget() final { deref(); } >+ REF_RETURN_TYPE refEventTarget() final { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { deref(DEREF_ARGUMENT_NAME); } > > void didStartLoading() final; > void didReceiveData() final; >diff --git a/Source/WebCore/html/CanvasBase.h b/Source/WebCore/html/CanvasBase.h >index 5dfe29352e1..84177e8cfb0 100644 >--- a/Source/WebCore/html/CanvasBase.h >+++ b/Source/WebCore/html/CanvasBase.h >@@ -53,8 +53,8 @@ class CanvasBase { > public: > virtual ~CanvasBase(); > >- virtual void refCanvasBase() = 0; >- virtual void derefCanvasBase() = 0; >+ virtual REF_RETURN_TYPE refCanvasBase() = 0; >+ virtual void derefCanvasBase(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS) = 0; > > virtual bool isHTMLCanvasElement() const { return false; } > virtual bool isOffscreenCanvas() const { return false; } >diff --git a/Source/WebCore/html/DOMTokenList.h b/Source/WebCore/html/DOMTokenList.h >index 3940f035eae..ff01a6c0ee7 100644 >--- a/Source/WebCore/html/DOMTokenList.h >+++ b/Source/WebCore/html/DOMTokenList.h >@@ -37,8 +37,8 @@ public: > > void associatedAttributeValueChanged(const AtomicString&); > >- void ref() { m_element.ref(); } >- void deref() { m_element.deref(); } >+ REF_RETURN_TYPE ref() { m_element.ref(); DEFAULT_REF_RETURN; } >+ void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS) { m_element.deref(DEREF_DEFAULT_ARGUMENTS); } > > unsigned length() const; > const AtomicString& item(unsigned index) const; >diff --git a/Source/WebCore/html/FormAssociatedElement.h b/Source/WebCore/html/FormAssociatedElement.h >index d7219fc5137..7f3586cd1fe 100644 >--- a/Source/WebCore/html/FormAssociatedElement.h >+++ b/Source/WebCore/html/FormAssociatedElement.h >@@ -41,8 +41,8 @@ class FormAssociatedElement : public FormNamedItem { > public: > virtual ~FormAssociatedElement(); > >- void ref() { refFormAssociatedElement(); } >- void deref() { derefFormAssociatedElement(); } >+ REF_RETURN_TYPE ref() { return refFormAssociatedElement(); } >+ void deref(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) { derefFormAssociatedElement(DEREF_ARGUMENT_NAME); } > > static HTMLFormElement* findAssociatedForm(const HTMLElement*, HTMLFormElement*); > HTMLFormElement* form() const { return m_form; } >@@ -107,8 +107,8 @@ protected: > > private: > virtual bool willValidate() const = 0; >- virtual void refFormAssociatedElement() = 0; >- virtual void derefFormAssociatedElement() = 0; >+ virtual REF_RETURN_TYPE refFormAssociatedElement() = 0; >+ virtual void derefFormAssociatedElement(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS) = 0; > > void resetFormAttributeTargetObserver(); > >diff --git a/Source/WebCore/html/FormController.cpp b/Source/WebCore/html/FormController.cpp >index 0f5b775bd02..5f880ac4063 100644 >--- a/Source/WebCore/html/FormController.cpp >+++ b/Source/WebCore/html/FormController.cpp >@@ -92,8 +92,8 @@ public: > bool isHashTableDeletedValue() const { return m_name == hashTableDeletedValue(); } > > private: >- void ref() const; >- void deref() const; >+ REF_RETURN_TYPE ref() const; >+ void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS) const; > > static AtomicStringImpl* hashTableDeletedValue() { return reinterpret_cast<AtomicStringImpl*>(-1); } > >@@ -110,7 +110,7 @@ FormElementKey::FormElementKey(AtomicStringImpl* name, AtomicStringImpl* type) > > FormElementKey::~FormElementKey() > { >- deref(); >+ deref(DEREF_DEFAULT_ARGUMENTS); > } > > FormElementKey::FormElementKey(const FormElementKey& other) >@@ -123,26 +123,27 @@ FormElementKey::FormElementKey(const FormElementKey& other) > FormElementKey& FormElementKey::operator=(const FormElementKey& other) > { > other.ref(); >- deref(); >+ deref(DEREF_DEFAULT_ARGUMENTS); > m_name = other.name(); > m_type = other.type(); > return *this; > } > >-void FormElementKey::ref() const >+REF_RETURN_TYPE FormElementKey::ref() const > { > if (name()) > name()->ref(); > if (type()) > type()->ref(); >+ DEFAULT_REF_RETURN; > } > >-void FormElementKey::deref() const >+void FormElementKey::deref(DEREF_ARGUMENT_TYPE) const > { > if (name()) >- name()->deref(); >+ name()->deref(DEREF_DEFAULT_ARGUMENTS); > if (type()) >- type()->deref(); >+ type()->deref(DEREF_DEFAULT_ARGUMENTS); > } > > inline bool operator==(const FormElementKey& a, const FormElementKey& b) >diff --git a/Source/WebCore/html/HTMLCanvasElement.h b/Source/WebCore/html/HTMLCanvasElement.h >index f88d6112de2..742086a62f1 100644 >--- a/Source/WebCore/html/HTMLCanvasElement.h >+++ b/Source/WebCore/html/HTMLCanvasElement.h >@@ -176,8 +176,8 @@ private: > > bool isGPUBased() const; > >- void refCanvasBase() final { HTMLElement::ref(); } >- void derefCanvasBase() final { HTMLElement::deref(); } >+ REF_RETURN_TYPE refCanvasBase() final { return HTMLElement::ref(); } >+ void derefCanvasBase(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { HTMLElement::deref(DEREF_ARGUMENT_NAME); } > > FloatRect m_dirtyRect; > mutable IntSize m_size; >diff --git a/Source/WebCore/html/HTMLFormControlElement.h b/Source/WebCore/html/HTMLFormControlElement.h >index d876573a298..bc3d081775c 100644 >--- a/Source/WebCore/html/HTMLFormControlElement.h >+++ b/Source/WebCore/html/HTMLFormControlElement.h >@@ -159,8 +159,8 @@ protected: > void didChangeForm() override; > > private: >- void refFormAssociatedElement() override { ref(); } >- void derefFormAssociatedElement() override { deref(); } >+ REF_RETURN_TYPE refFormAssociatedElement() override { return ref(); } >+ void derefFormAssociatedElement(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) override { deref(DEREF_ARGUMENT_NAME); } > > bool matchesValidPseudoClass() const override; > bool matchesInvalidPseudoClass() const override; >diff --git a/Source/WebCore/html/HTMLObjectElement.h b/Source/WebCore/html/HTMLObjectElement.h >index 82f582dfd78..8a2ef780196 100644 >--- a/Source/WebCore/html/HTMLObjectElement.h >+++ b/Source/WebCore/html/HTMLObjectElement.h >@@ -88,8 +88,8 @@ private: > bool shouldAllowQuickTimeClassIdQuirk(); > bool hasValidClassId(); > >- void refFormAssociatedElement() final { ref(); } >- void derefFormAssociatedElement() final { deref(); } >+ REF_RETURN_TYPE refFormAssociatedElement() final { return ref(); } >+ void derefFormAssociatedElement(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { deref(DEREF_ARGUMENT_NAME); } > > FormNamedItem* asFormNamedItem() final { return this; } > HTMLObjectElement& asHTMLElement() final { return *this; } >diff --git a/Source/WebCore/html/MediaController.h b/Source/WebCore/html/MediaController.h >index 738cb5414cc..3b019b3320e 100644 >--- a/Source/WebCore/html/MediaController.h >+++ b/Source/WebCore/html/MediaController.h >@@ -91,8 +91,8 @@ private: > void scheduleTimeupdateEvent(); > void startTimeupdateTimer(); > >- void refEventTarget() final { ref(); } >- void derefEventTarget() final { deref(); } >+ REF_RETURN_TYPE refEventTarget() final { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { deref(DEREF_ARGUMENT_NAME); } > EventTargetInterface eventTargetInterface() const final { return MediaControllerEventTargetInterfaceType; } > ScriptExecutionContext* scriptExecutionContext() const final { return &m_scriptExecutionContext; }; > >diff --git a/Source/WebCore/html/OffscreenCanvas.h b/Source/WebCore/html/OffscreenCanvas.h >index c272ed6e999..1882371a5af 100644 >--- a/Source/WebCore/html/OffscreenCanvas.h >+++ b/Source/WebCore/html/OffscreenCanvas.h >@@ -87,11 +87,11 @@ private: > ScriptExecutionContext* scriptExecutionContext() const final { return CanvasBase::scriptExecutionContext(); } > > EventTargetInterface eventTargetInterface() const final { return OffscreenCanvasEventTargetInterfaceType; } >- void refEventTarget() final { ref(); } >- void derefEventTarget() final { deref(); } >+ REF_RETURN_TYPE refEventTarget() final { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { deref(DEREF_ARGUMENT_NAME); } > >- void refCanvasBase() final { ref(); } >- void derefCanvasBase() final { deref(); } >+ REF_RETURN_TYPE refCanvasBase() final { return ref(); } >+ void derefCanvasBase(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { deref(DEREF_ARGUMENT_NAME); } > > IntSize m_size; > }; >diff --git a/Source/WebCore/html/canvas/CanvasRenderingContext.cpp b/Source/WebCore/html/canvas/CanvasRenderingContext.cpp >index 8582a0674d6..cd53320b1a1 100644 >--- a/Source/WebCore/html/canvas/CanvasRenderingContext.cpp >+++ b/Source/WebCore/html/canvas/CanvasRenderingContext.cpp >@@ -44,12 +44,13 @@ CanvasRenderingContext::CanvasRenderingContext(CanvasBase& canvas) > { > } > >-void CanvasRenderingContext::ref() >+REF_RETURN_TYPE CanvasRenderingContext::ref() > { > m_canvas.refCanvasBase(); >+ DEFAULT_REF_RETURN; > } > >-void CanvasRenderingContext::deref() >+void CanvasRenderingContext::deref(DEREF_ARGUMENT_TYPE) > { > m_canvas.derefCanvasBase(); > } >diff --git a/Source/WebCore/html/canvas/CanvasRenderingContext.h b/Source/WebCore/html/canvas/CanvasRenderingContext.h >index 81cb55d77e3..ab8acd7e808 100644 >--- a/Source/WebCore/html/canvas/CanvasRenderingContext.h >+++ b/Source/WebCore/html/canvas/CanvasRenderingContext.h >@@ -46,8 +46,8 @@ class CanvasRenderingContext : public ScriptWrappable { > public: > virtual ~CanvasRenderingContext() = default; > >- void ref(); >- WEBCORE_EXPORT void deref(); >+ REF_RETURN_TYPE ref(); >+ WEBCORE_EXPORT void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS); > > CanvasBase& canvasBase() const { return m_canvas; } > >diff --git a/Source/WebCore/html/canvas/WebGLExtension.h b/Source/WebCore/html/canvas/WebGLExtension.h >index 0f601fa82ff..a5acd7f00b3 100644 >--- a/Source/WebCore/html/canvas/WebGLExtension.h >+++ b/Source/WebCore/html/canvas/WebGLExtension.h >@@ -58,8 +58,8 @@ public: > ANGLEInstancedArraysName, > }; > >- void ref() { m_context.ref(); } >- void deref() { m_context.deref(); } >+ REF_RETURN_TYPE ref() { m_context.ref(); DEFAULT_REF_RETURN; } >+ void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS) { m_context.deref(DEREF_DEFAULT_ARGUMENTS); } > WebGLRenderingContextBase& context() { return m_context; } > > virtual ~WebGLExtension(); >diff --git a/Source/WebCore/html/track/TextTrack.h b/Source/WebCore/html/track/TextTrack.h >index a7ef715a520..4e1f4ced1b2 100644 >--- a/Source/WebCore/html/track/TextTrack.h >+++ b/Source/WebCore/html/track/TextTrack.h >@@ -156,8 +156,8 @@ protected: > private: > bool enabled() const override; > >- void refEventTarget() final { ref(); } >- void derefEventTarget() final { deref(); } >+ REF_RETURN_TYPE refEventTarget() final { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { deref(DEREF_ARGUMENT_NAME); } > > VTTRegionList& ensureVTTRegionList(); > RefPtr<VTTRegionList> m_regions; >diff --git a/Source/WebCore/html/track/TextTrackCue.h b/Source/WebCore/html/track/TextTrackCue.h >index cfee47d844a..398a18c9eb1 100644 >--- a/Source/WebCore/html/track/TextTrackCue.h >+++ b/Source/WebCore/html/track/TextTrackCue.h >@@ -98,8 +98,8 @@ protected: > virtual void toJSON(JSON::Object&) const; > > private: >- void refEventTarget() final { ref(); } >- void derefEventTarget() final { deref(); } >+ REF_RETURN_TYPE refEventTarget() final { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { deref(DEREF_ARGUMENT_NAME); } > > using EventTarget::dispatchEvent; > void dispatchEvent(Event&) final; >diff --git a/Source/WebCore/html/track/TrackListBase.h b/Source/WebCore/html/track/TrackListBase.h >index f3d644dbc2e..f80053cb479 100644 >--- a/Source/WebCore/html/track/TrackListBase.h >+++ b/Source/WebCore/html/track/TrackListBase.h >@@ -75,8 +75,8 @@ private: > void scheduleTrackEvent(const AtomicString& eventName, Ref<TrackBase>&&); > > // EventTarget >- void refEventTarget() final { ref(); } >- void derefEventTarget() final { deref(); } >+ REF_RETURN_TYPE refEventTarget() final { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { deref(DEREF_ARGUMENT_NAME); } > > HTMLMediaElement* m_element; > >diff --git a/Source/WebCore/loader/DocumentThreadableLoader.h b/Source/WebCore/loader/DocumentThreadableLoader.h >index 38382edf4cd..26364a2e441 100644 >--- a/Source/WebCore/loader/DocumentThreadableLoader.h >+++ b/Source/WebCore/loader/DocumentThreadableLoader.h >@@ -66,8 +66,8 @@ namespace WebCore { > using RefCounted<DocumentThreadableLoader>::deref; > > protected: >- void refThreadableLoader() override { ref(); } >- void derefThreadableLoader() override { deref(); } >+ REF_RETURN_TYPE refThreadableLoader() override { return ref(); } >+ void derefThreadableLoader(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) override { deref(DEREF_ARGUMENT_NAME); } > > private: > enum BlockingBehavior { >diff --git a/Source/WebCore/loader/ThreadableLoader.h b/Source/WebCore/loader/ThreadableLoader.h >index 861748b7c7b..d76d7ca62ea 100644 >--- a/Source/WebCore/loader/ThreadableLoader.h >+++ b/Source/WebCore/loader/ThreadableLoader.h >@@ -77,16 +77,16 @@ namespace WebCore { > static RefPtr<ThreadableLoader> create(ScriptExecutionContext&, ThreadableLoaderClient&, ResourceRequest&&, const ThreadableLoaderOptions&, String&& referrer = String()); > > virtual void cancel() = 0; >- void ref() { refThreadableLoader(); } >- void deref() { derefThreadableLoader(); } >+ REF_RETURN_TYPE ref() { return refThreadableLoader(); } >+ void deref(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) { derefThreadableLoader(DEREF_ARGUMENT_NAME); } > > static void logError(ScriptExecutionContext&, const ResourceError&, const String&); > > protected: > ThreadableLoader() = default; > virtual ~ThreadableLoader() = default; >- virtual void refThreadableLoader() = 0; >- virtual void derefThreadableLoader() = 0; >+ virtual REF_RETURN_TYPE refThreadableLoader() = 0; >+ virtual void derefThreadableLoader(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS) = 0; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/loader/WorkerThreadableLoader.h b/Source/WebCore/loader/WorkerThreadableLoader.h >index 03c1673b13f..591845e8cc9 100644 >--- a/Source/WebCore/loader/WorkerThreadableLoader.h >+++ b/Source/WebCore/loader/WorkerThreadableLoader.h >@@ -64,8 +64,8 @@ namespace WebCore { > using RefCounted<WorkerThreadableLoader>::deref; > > protected: >- void refThreadableLoader() override { ref(); } >- void derefThreadableLoader() override { deref(); } >+ REF_RETURN_TYPE refThreadableLoader() override { return ref(); } >+ void derefThreadableLoader(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) override { deref(DEREF_ARGUMENT_NAME); } > > private: > // Creates a loader on the main thread and bridges communication between >diff --git a/Source/WebCore/loader/appcache/DOMApplicationCache.h b/Source/WebCore/loader/appcache/DOMApplicationCache.h >index cf6d2a9d99f..50f6481c844 100644 >--- a/Source/WebCore/loader/appcache/DOMApplicationCache.h >+++ b/Source/WebCore/loader/appcache/DOMApplicationCache.h >@@ -49,8 +49,8 @@ public: > private: > explicit DOMApplicationCache(Frame&); > >- void refEventTarget() final { ref(); } >- void derefEventTarget() final { deref(); } >+ REF_RETURN_TYPE refEventTarget() final { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { deref(DEREF_ARGUMENT_NAME); } > > EventTargetInterface eventTargetInterface() const final { return DOMApplicationCacheEventTargetInterfaceType; } > ScriptExecutionContext* scriptExecutionContext() const final; >diff --git a/Source/WebCore/page/AbstractDOMWindow.h b/Source/WebCore/page/AbstractDOMWindow.h >index 64d45a8cacb..1e67203cdb2 100644 >--- a/Source/WebCore/page/AbstractDOMWindow.h >+++ b/Source/WebCore/page/AbstractDOMWindow.h >@@ -61,8 +61,8 @@ protected: > explicit AbstractDOMWindow(GlobalWindowIdentifier&&); > > EventTargetInterface eventTargetInterface() const final { return DOMWindowEventTargetInterfaceType; } >- void refEventTarget() final { ref(); } >- void derefEventTarget() final { deref(); } >+ REF_RETURN_TYPE refEventTarget() final { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { deref(DEREF_ARGUMENT_NAME); } > > private: > GlobalWindowIdentifier m_identifier; >diff --git a/Source/WebCore/page/EventSource.h b/Source/WebCore/page/EventSource.h >index 3792a9126f1..e4187cd6236 100644 >--- a/Source/WebCore/page/EventSource.h >+++ b/Source/WebCore/page/EventSource.h >@@ -75,8 +75,8 @@ private: > EventTargetInterface eventTargetInterface() const final { return EventSourceEventTargetInterfaceType; } > ScriptExecutionContext* scriptExecutionContext() const final { return ActiveDOMObject::scriptExecutionContext(); } > >- void refEventTarget() final { ref(); } >- void derefEventTarget() final { deref(); } >+ REF_RETURN_TYPE refEventTarget() final { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { deref(DEREF_ARGUMENT_NAME); } > > // ThreadableLoaderClient > void didReceiveResponse(unsigned long, const ResourceResponse&) final; >diff --git a/Source/WebCore/page/Frame.cpp b/Source/WebCore/page/Frame.cpp >index d86180359cd..9e81306d543 100644 >--- a/Source/WebCore/page/Frame.cpp >+++ b/Source/WebCore/page/Frame.cpp >@@ -1144,7 +1144,7 @@ void Frame::selfOnlyDeref() > if (hasOneRef()) > dropChildren(); > >- deref(); >+ deref(DEREF_DEFAULT_ARGUMENTS); > } > > } // namespace WebCore >diff --git a/Source/WebCore/page/Performance.h b/Source/WebCore/page/Performance.h >index 24ab94bca29..bc837d50ca0 100644 >--- a/Source/WebCore/page/Performance.h >+++ b/Source/WebCore/page/Performance.h >@@ -97,8 +97,8 @@ private: > > EventTargetInterface eventTargetInterface() const final { return PerformanceEventTargetInterfaceType; } > >- void refEventTarget() final { ref(); } >- void derefEventTarget() final { deref(); } >+ REF_RETURN_TYPE refEventTarget() final { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { deref(DEREF_ARGUMENT_NAME); } > > bool isResourceTimingBufferFull() const; > void resourceTimingBufferFullTimerFired(); >diff --git a/Source/WebCore/page/VisualViewport.h b/Source/WebCore/page/VisualViewport.h >index 47727d35aca..78eab0d3843 100644 >--- a/Source/WebCore/page/VisualViewport.h >+++ b/Source/WebCore/page/VisualViewport.h >@@ -58,8 +58,8 @@ public: > private: > explicit VisualViewport(Frame*); > >- void refEventTarget() final { ref(); } >- void derefEventTarget() final { deref(); } >+ REF_RETURN_TYPE refEventTarget() final { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { deref(DEREF_ARGUMENT_NAME); } > > void enqueueResizeEvent(); > void enqueueScrollEvent(); >diff --git a/Source/WebCore/page/mac/PageMac.mm b/Source/WebCore/page/mac/PageMac.mm >index 88b103fe443..d16242825c5 100644 >--- a/Source/WebCore/page/mac/PageMac.mm >+++ b/Source/WebCore/page/mac/PageMac.mm >@@ -78,6 +78,9 @@ void Page::platformInitialize() > WTFLogAlways("%u live documents:", Document::allDocuments().size()); > for (const auto* document : Document::allDocuments()) { > WTFLogAlways("Document %p (refCount %d) %s", document, document->refCount(), document->url().string().utf8().data()); >+ WTFLogAlways("Document %p reference stacks:\n"); >+ document->refTracker().dumpRemainingReferences(); >+ WTFLogAlways("\n"); > } > }); > }); >diff --git a/Source/WebCore/platform/Length.cpp b/Source/WebCore/platform/Length.cpp >index 4658fd08e6d..623037312ef 100644 >--- a/Source/WebCore/platform/Length.cpp >+++ b/Source/WebCore/platform/Length.cpp >@@ -259,13 +259,14 @@ CalculationValue& Length::calculationValue() const > return calculationValues().get(m_calculationValueHandle); > } > >-void Length::ref() const >+REF_RETURN_TYPE Length::ref() const > { > ASSERT(isCalculated()); > calculationValues().ref(m_calculationValueHandle); >+ DEFAULT_REF_RETURN; > } > >-void Length::deref() const >+void Length::deref(DEREF_ARGUMENT_TYPE) const > { > ASSERT(isCalculated()); > calculationValues().deref(m_calculationValueHandle); >diff --git a/Source/WebCore/platform/Length.h b/Source/WebCore/platform/Length.h >index bf14421af35..d774932afc7 100644 >--- a/Source/WebCore/platform/Length.h >+++ b/Source/WebCore/platform/Length.h >@@ -123,8 +123,8 @@ private: > > bool isCalculatedEqual(const Length&) const; > >- WEBCORE_EXPORT void ref() const; >- WEBCORE_EXPORT void deref() const; >+ WEBCORE_EXPORT REF_RETURN_TYPE ref() const; >+ WEBCORE_EXPORT void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS) const; > > union { > int m_intValue; >@@ -194,7 +194,7 @@ inline Length& Length::operator=(const Length& other) > if (other.isCalculated()) > other.ref(); > if (isCalculated()) >- deref(); >+ deref(DEREF_DEFAULT_ARGUMENTS); > > memcpy(static_cast<void*>(this), static_cast<void*>(const_cast<Length*>(&other)), sizeof(Length)); > return *this; >@@ -206,7 +206,7 @@ inline Length& Length::operator=(Length&& other) > return *this; > > if (isCalculated()) >- deref(); >+ deref(DEREF_DEFAULT_ARGUMENTS); > > memcpy(static_cast<void*>(this), static_cast<void*>(&other), sizeof(Length)); > other.m_type = Auto; >@@ -216,7 +216,7 @@ inline Length& Length::operator=(Length&& other) > inline Length::~Length() > { > if (isCalculated()) >- deref(); >+ deref(DEREF_DEFAULT_ARGUMENTS); > } > > inline bool Length::operator==(const Length& other) const >diff --git a/Source/WebCore/platform/ScrollableArea.cpp b/Source/WebCore/platform/ScrollableArea.cpp >index 46e71eacbeb..bc1eed73a38 100644 >--- a/Source/WebCore/platform/ScrollableArea.cpp >+++ b/Source/WebCore/platform/ScrollableArea.cpp >@@ -57,7 +57,9 @@ struct SameSizeAsScrollableArea { > unsigned bitfields : 16; > }; > >+#ifndef ALLOW_REF_TRACING > COMPILE_ASSERT(sizeof(ScrollableArea) == sizeof(SameSizeAsScrollableArea), ScrollableArea_should_stay_small); >+#endif > > ScrollableArea::ScrollableArea() > : m_constrainsScrollingToContentEdge(true) >diff --git a/Source/WebCore/platform/graphics/Color.cpp b/Source/WebCore/platform/graphics/Color.cpp >index 5dd150f7a01..32b6df6c17b 100644 >--- a/Source/WebCore/platform/graphics/Color.cpp >+++ b/Source/WebCore/platform/graphics/Color.cpp >@@ -313,7 +313,7 @@ Color& Color::operator=(const Color& other) > return *this; > > if (isExtended()) >- m_colorData.extendedColor->deref(); >+ m_colorData.extendedColor->deref(DEREF_DEFAULT_ARGUMENTS); > > m_colorData = other.m_colorData; > >@@ -328,7 +328,7 @@ Color& Color::operator=(Color&& other) > return *this; > > if (isExtended()) >- m_colorData.extendedColor->deref(); >+ m_colorData.extendedColor->deref(DEREF_DEFAULT_ARGUMENTS); > > m_colorData = other.m_colorData; > other.m_colorData.rgbaAndFlags = invalidRGBAColor; >diff --git a/Source/WebCore/platform/graphics/Color.h b/Source/WebCore/platform/graphics/Color.h >index 72fae22a586..fad5dd3483c 100644 >--- a/Source/WebCore/platform/graphics/Color.h >+++ b/Source/WebCore/platform/graphics/Color.h >@@ -177,7 +177,7 @@ public: > ~Color() > { > if (isExtended()) >- m_colorData.extendedColor->deref(); >+ m_colorData.extendedColor->deref(DEREF_DEFAULT_ARGUMENTS); > } > > static Color createUnchecked(int r, int g, int b) >diff --git a/Source/WebCore/platform/graphics/cg/ImageDecoderCG.cpp b/Source/WebCore/platform/graphics/cg/ImageDecoderCG.cpp >index b7d592a9c8a..be231f26f8c 100644 >--- a/Source/WebCore/platform/graphics/cg/ImageDecoderCG.cpp >+++ b/Source/WebCore/platform/graphics/cg/ImageDecoderCG.cpp >@@ -139,7 +139,7 @@ size_t sharedBufferGetBytesAtPosition(void* info, void* buffer, off_t position, > void sharedBufferRelease(void* info) > { > SharedBuffer* sharedBuffer = static_cast<SharedBuffer*>(info); >- sharedBuffer->deref(); >+ sharedBuffer->deref(DEREF_DEFAULT_ARGUMENTS); > } > #endif > >diff --git a/Source/WebCore/platform/graphics/cocoa/GPUBufferMetal.mm b/Source/WebCore/platform/graphics/cocoa/GPUBufferMetal.mm >index ad46220b25a..45ea4cc4cd0 100644 >--- a/Source/WebCore/platform/graphics/cocoa/GPUBufferMetal.mm >+++ b/Source/WebCore/platform/graphics/cocoa/GPUBufferMetal.mm >@@ -52,9 +52,9 @@ GPUBuffer::GPUBuffer(GPUDevice* device, ArrayBufferView* data) > m_contents = ArrayBuffer::createFromBytes(pageAlignedCopy, data->byteLength(), [] (void* ptr) { Gigacage::alignedFree(Gigacage::Primitive, ptr); }); > m_contents->ref(); > ArrayBuffer* capturedContents = m_contents.get(); >- m_buffer = adoptNS((MTLBuffer *)[device->platformDevice() newBufferWithBytesNoCopy:m_contents->data() length:pageAlignedSize options:MTLResourceOptionCPUCacheModeDefault deallocator:^(void*, NSUInteger) { capturedContents->deref(); }]); >+ m_buffer = adoptNS((MTLBuffer *)[device->platformDevice() newBufferWithBytesNoCopy:m_contents->data() length:pageAlignedSize options:MTLResourceOptionCPUCacheModeDefault deallocator:^(void*, NSUInteger) { capturedContents->deref(DEREF_DEFAULT_ARGUMENTS); }]); > if (!m_buffer) { >- m_contents->deref(); >+ m_contents->deref(DEREF_DEFAULT_ARGUMENTS); > m_contents = nullptr; > } > } >diff --git a/Source/WebCore/platform/mediastream/RealtimeOutgoingAudioSource.h b/Source/WebCore/platform/mediastream/RealtimeOutgoingAudioSource.h >index aef0e886422..c54a2e3315a 100644 >--- a/Source/WebCore/platform/mediastream/RealtimeOutgoingAudioSource.h >+++ b/Source/WebCore/platform/mediastream/RealtimeOutgoingAudioSource.h >@@ -74,7 +74,7 @@ private: > rtc::RefCountReleaseStatus Release() const final > { > callOnMainThread([this] { >- deref(); >+ deref(DEREF_DEFAULT_ARGUMENTS); > }); > return rtc::RefCountReleaseStatus::kOtherRefsRemained; > } >diff --git a/Source/WebCore/platform/mediastream/RealtimeOutgoingVideoSource.h b/Source/WebCore/platform/mediastream/RealtimeOutgoingVideoSource.h >index 17f86355cfd..96f2dd9a241 100644 >--- a/Source/WebCore/platform/mediastream/RealtimeOutgoingVideoSource.h >+++ b/Source/WebCore/platform/mediastream/RealtimeOutgoingVideoSource.h >@@ -55,7 +55,7 @@ public: > rtc::RefCountReleaseStatus Release() const final > { > callOnMainThread([this] { >- deref(); >+ deref(DEREF_DEFAULT_ARGUMENTS); > }); > return rtc::RefCountReleaseStatus::kOtherRefsRemained; > } >diff --git a/Source/WebCore/platform/network/AuthenticationClient.h b/Source/WebCore/platform/network/AuthenticationClient.h >index 19f8bcd7c68..b2a3e386dc6 100644 >--- a/Source/WebCore/platform/network/AuthenticationClient.h >+++ b/Source/WebCore/platform/network/AuthenticationClient.h >@@ -39,15 +39,15 @@ public: > virtual void receivedRequestToPerformDefaultHandling(const AuthenticationChallenge&) = 0; > virtual void receivedChallengeRejection(const AuthenticationChallenge&) = 0; > >- void ref() { refAuthenticationClient(); } >- void deref() { derefAuthenticationClient(); } >+ REF_RETURN_TYPE ref() { return refAuthenticationClient(); } >+ void deref(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) { derefAuthenticationClient(DEREF_ARGUMENT_NAME); } > > protected: > virtual ~AuthenticationClient() = default; > > private: >- virtual void refAuthenticationClient() = 0; >- virtual void derefAuthenticationClient() = 0; >+ virtual REF_RETURN_TYPE refAuthenticationClient() = 0; >+ virtual void derefAuthenticationClient(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS) = 0; > }; > > } >diff --git a/Source/WebCore/platform/network/DataURLDecoder.cpp b/Source/WebCore/platform/network/DataURLDecoder.cpp >index 88664235ac5..040b254c228 100644 >--- a/Source/WebCore/platform/network/DataURLDecoder.cpp >+++ b/Source/WebCore/platform/network/DataURLDecoder.cpp >@@ -103,7 +103,7 @@ private: > // Ensure DecodeTask gets deleted in the main thread. > m_decodeTask = nullptr; > >- deref(); >+ deref(DEREF_DEFAULT_ARGUMENTS); > } > > RunLoopTimer<DecodingResultDispatcher> m_timer; >diff --git a/Source/WebCore/platform/network/ResourceHandle.h b/Source/WebCore/platform/network/ResourceHandle.h >index fce796cadad..755e89a2dcb 100644 >--- a/Source/WebCore/platform/network/ResourceHandle.h >+++ b/Source/WebCore/platform/network/ResourceHandle.h >@@ -229,8 +229,8 @@ private: > bool start(); > static void platformLoadResourceSynchronously(NetworkingContext*, const ResourceRequest&, StoredCredentialsPolicy, ResourceError&, ResourceResponse&, Vector<char>& data); > >- void refAuthenticationClient() override { ref(); } >- void derefAuthenticationClient() override { deref(); } >+ REF_RETURN_TYPE refAuthenticationClient() override { return ref(); } >+ void derefAuthenticationClient(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) override { deref(DEREF_ARGUMENT_NAME); } > > #if PLATFORM(COCOA) || USE(CFURLCONNECTION) > enum class SchedulingBehavior { Asynchronous, Synchronous }; >diff --git a/Source/WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp b/Source/WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp >index 9ed5aa0c9d9..1ee9df8709f 100644 >--- a/Source/WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp >+++ b/Source/WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp >@@ -165,7 +165,7 @@ void* SocketStreamHandleImpl::retainSocketStreamHandle(void* info) > void SocketStreamHandleImpl::releaseSocketStreamHandle(void* info) > { > SocketStreamHandle* handle = static_cast<SocketStreamHandle*>(info); >- handle->deref(); >+ handle->deref(DEREF_DEFAULT_ARGUMENTS); > } > > CFStringRef SocketStreamHandleImpl::copyPACExecutionDescription(void*) >diff --git a/Source/WebCore/platform/text/BidiContext.cpp b/Source/WebCore/platform/text/BidiContext.cpp >index c9f0f813bcb..221dec09b3c 100644 >--- a/Source/WebCore/platform/text/BidiContext.cpp >+++ b/Source/WebCore/platform/text/BidiContext.cpp >@@ -31,7 +31,9 @@ struct SameSizeAsBidiContext : public RefCounted<SameSizeAsBidiContext> { > void* parent; > }; > >+#ifndef ALLOW_REF_TRACING > COMPILE_ASSERT(sizeof(BidiContext) == sizeof(SameSizeAsBidiContext), BidiContext_should_stay_small); >+#endif > > inline BidiContext::BidiContext(unsigned char level, UCharDirection direction, bool override, BidiEmbeddingSource source, BidiContext* parent) > : m_level(level) >diff --git a/Source/WebCore/rendering/FloatingObjects.cpp b/Source/WebCore/rendering/FloatingObjects.cpp >index 3f7db1b1f1d..44f6191be08 100644 >--- a/Source/WebCore/rendering/FloatingObjects.cpp >+++ b/Source/WebCore/rendering/FloatingObjects.cpp >@@ -40,7 +40,9 @@ struct SameSizeAsFloatingObject { > uint32_t bitfields : 8; > }; > >+#ifndef ALLOW_REF_TRACING > COMPILE_ASSERT(sizeof(FloatingObject) == sizeof(SameSizeAsFloatingObject), FloatingObject_should_stay_small); >+#endif > > FloatingObject::FloatingObject(RenderBox& renderer) > : m_renderer(makeWeakPtr(renderer)) >diff --git a/Source/WebCore/rendering/InlineFlowBox.cpp b/Source/WebCore/rendering/InlineFlowBox.cpp >index 80f3c91e3e8..27cf54aacbd 100644 >--- a/Source/WebCore/rendering/InlineFlowBox.cpp >+++ b/Source/WebCore/rendering/InlineFlowBox.cpp >@@ -51,7 +51,9 @@ struct SameSizeAsInlineFlowBox : public InlineBox { > uint32_t bitfields : 23; > }; > >+#ifndef ALLOW_REF_TRACING > COMPILE_ASSERT(sizeof(InlineFlowBox) == sizeof(SameSizeAsInlineFlowBox), InlineFlowBox_should_stay_small); >+#endif > > #if !ASSERT_WITH_SECURITY_IMPLICATION_DISABLED > >diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp >index d97318c919a..0a665630e70 100644 >--- a/Source/WebCore/rendering/RenderBox.cpp >+++ b/Source/WebCore/rendering/RenderBox.cpp >@@ -92,7 +92,9 @@ struct SameSizeAsRenderBox : public RenderBoxModelObject { > void* pointers[2]; > }; > >+#ifndef ALLOW_REF_TRACING > COMPILE_ASSERT(sizeof(RenderBox) == sizeof(SameSizeAsRenderBox), RenderBox_should_stay_small); >+#endif > > using namespace HTMLNames; > >diff --git a/Source/WebCore/rendering/RenderObject.cpp b/Source/WebCore/rendering/RenderObject.cpp >index cdb0262053b..5aa2a6c6645 100644 >--- a/Source/WebCore/rendering/RenderObject.cpp >+++ b/Source/WebCore/rendering/RenderObject.cpp >@@ -108,7 +108,9 @@ struct SameSizeAsRenderObject { > unsigned m_bitfields; > }; > >+#ifndef ALLOW_REF_TRACING > COMPILE_ASSERT(sizeof(RenderObject) == sizeof(SameSizeAsRenderObject), RenderObject_should_stay_small); >+#endif > > DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, renderObjectCounter, ("RenderObject")); > >@@ -1477,7 +1479,7 @@ void RenderObject::destroy() > willBeDestroyed(); > > if (is<RenderWidget>(*this)) { >- downcast<RenderWidget>(*this).deref(); >+ downcast<RenderWidget>(*this).deref(DEREF_DEFAULT_ARGUMENTS); > return; > } > delete this; >diff --git a/Source/WebCore/rendering/RenderWidget.h b/Source/WebCore/rendering/RenderWidget.h >index 8ae3d2c65b2..4fa35e0051b 100644 >--- a/Source/WebCore/rendering/RenderWidget.h >+++ b/Source/WebCore/rendering/RenderWidget.h >@@ -71,8 +71,8 @@ public: > > bool requiresAcceleratedCompositing() const; > >- void ref() { ++m_refCount; } >- void deref(); >+ REF_RETURN_TYPE ref() { ++m_refCount; DEFAULT_REF_RETURN; } >+ void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS); > > protected: > RenderWidget(HTMLFrameOwnerElement&, RenderStyle&&); >@@ -104,7 +104,7 @@ private: > unsigned m_refCount { 1 }; > }; > >-inline void RenderWidget::deref() >+inline void RenderWidget::deref(DEREF_ARGUMENT_TYPE) > { > ASSERT(m_refCount); > if (!--m_refCount) >diff --git a/Source/WebCore/rendering/RootInlineBox.cpp b/Source/WebCore/rendering/RootInlineBox.cpp >index 08690b9c26d..b07ced47743 100644 >--- a/Source/WebCore/rendering/RootInlineBox.cpp >+++ b/Source/WebCore/rendering/RootInlineBox.cpp >@@ -50,7 +50,9 @@ struct SameSizeAsRootInlineBox : public InlineFlowBox { > void* pointers[4]; > }; > >+#ifndef ALLOW_REF_TRACING > COMPILE_ASSERT(sizeof(RootInlineBox) == sizeof(SameSizeAsRootInlineBox), RootInlineBox_should_stay_small); >+#endif > > typedef WTF::HashMap<const RootInlineBox*, std::unique_ptr<EllipsisBox>> EllipsisBoxMap; > static EllipsisBoxMap* gEllipsisBoxMap; >diff --git a/Source/WebCore/rendering/style/RenderStyle.cpp b/Source/WebCore/rendering/style/RenderStyle.cpp >index f61988f24c2..b309e953d7a 100644 >--- a/Source/WebCore/rendering/style/RenderStyle.cpp >+++ b/Source/WebCore/rendering/style/RenderStyle.cpp >@@ -81,7 +81,9 @@ struct SameSizeAsRenderStyle { > #endif > }; > >+#ifndef ALLOW_REF_TRACING > static_assert(sizeof(RenderStyle) == sizeof(SameSizeAsRenderStyle), "RenderStyle should stay small"); >+#endif > > RenderStyle& RenderStyle::defaultStyle() > { >diff --git a/Source/WebCore/rendering/style/StyleRareInheritedData.cpp b/Source/WebCore/rendering/style/StyleRareInheritedData.cpp >index cbef75e42e4..5315a1012f4 100644 >--- a/Source/WebCore/rendering/style/StyleRareInheritedData.cpp >+++ b/Source/WebCore/rendering/style/StyleRareInheritedData.cpp >@@ -68,7 +68,9 @@ struct GreaterThanOrSameSizeAsStyleRareInheritedData : public RefCounted<Greater > void* customPropertyDataRefs[1]; > }; > >+#ifndef ALLOW_REF_TRACING > COMPILE_ASSERT(sizeof(StyleRareInheritedData) <= sizeof(GreaterThanOrSameSizeAsStyleRareInheritedData), StyleRareInheritedData_should_bit_pack); >+#endif > > StyleRareInheritedData::StyleRareInheritedData() > : listStyleImage(RenderStyle::initialListStyleImage()) >diff --git a/Source/WebCore/testing/MockContentFilterSettings.h b/Source/WebCore/testing/MockContentFilterSettings.h >index 33d21a0efa9..80c953d0923 100644 >--- a/Source/WebCore/testing/MockContentFilterSettings.h >+++ b/Source/WebCore/testing/MockContentFilterSettings.h >@@ -51,8 +51,8 @@ public: > static const char* unblockURLHost() { return "mock-unblock"; } > > // Trick the generated bindings into thinking we're RefCounted. >- void ref() { } >- void deref() { } >+ REF_RETURN_TYPE ref() { DEFAULT_REF_RETURN; } >+ void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS) { } > > bool enabled() const { return m_enabled; } > WTF_EXPORT_PRIVATE void setEnabled(bool); >diff --git a/Source/WebCore/testing/MockCredentialsMessenger.cpp b/Source/WebCore/testing/MockCredentialsMessenger.cpp >index 32d7080b10a..33178946b74 100644 >--- a/Source/WebCore/testing/MockCredentialsMessenger.cpp >+++ b/Source/WebCore/testing/MockCredentialsMessenger.cpp >@@ -61,14 +61,15 @@ void MockCredentialsMessenger::setAssertionReturnBundle(const BufferSource& cred > m_userHandle.append(userHandle.data(), userHandle.length()); > } > >-void MockCredentialsMessenger::ref() >+REF_RETURN_TYPE MockCredentialsMessenger::ref() > { > m_internals.ref(); >+ DEFAULT_REF_RETURN; > } > >-void MockCredentialsMessenger::deref() >+void MockCredentialsMessenger::deref(DEREF_ARGUMENT_TYPE) > { >- m_internals.deref(); >+ m_internals.deref(DEREF_DEFAULT_ARGUMENTS); > } > > void MockCredentialsMessenger::makeCredential(const Vector<uint8_t>&, const PublicKeyCredentialCreationOptions&, CreationCompletionHandler&& handler) >diff --git a/Source/WebCore/testing/MockCredentialsMessenger.h b/Source/WebCore/testing/MockCredentialsMessenger.h >index b4b08df4eaa..2afae352ff0 100644 >--- a/Source/WebCore/testing/MockCredentialsMessenger.h >+++ b/Source/WebCore/testing/MockCredentialsMessenger.h >@@ -46,8 +46,8 @@ public: > void setCreationReturnBundle(const BufferSource& credentialId, const BufferSource& attestationObject); > void setAssertionReturnBundle(const BufferSource& credentialId, const BufferSource& authenticatorData, const BufferSource& signature, const BufferSource& userHandle); > >- void ref(); >- void deref(); >+ REF_RETURN_TYPE ref(); >+ void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS); > > private: > void makeCredential(const Vector<uint8_t>&, const PublicKeyCredentialCreationOptions&, CreationCompletionHandler&&) final; >diff --git a/Source/WebCore/testing/MockPaymentCoordinator.h b/Source/WebCore/testing/MockPaymentCoordinator.h >index 1f7d068d1cc..ad05f220434 100644 >--- a/Source/WebCore/testing/MockPaymentCoordinator.h >+++ b/Source/WebCore/testing/MockPaymentCoordinator.h >@@ -51,8 +51,8 @@ public: > const ApplePayLineItem& total() const { return m_total; } > const Vector<ApplePayLineItem>& lineItems() const { return m_lineItems; } > >- void ref() const { } >- void deref() const { } >+ REF_RETURN_TYPE ref() const { DEFAULT_REF_RETURN; } >+ void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS) const { } > > private: > bool supportsVersion(unsigned) final; >diff --git a/Source/WebCore/workers/AbstractWorker.h b/Source/WebCore/workers/AbstractWorker.h >index 900c2cb4046..76136076225 100644 >--- a/Source/WebCore/workers/AbstractWorker.h >+++ b/Source/WebCore/workers/AbstractWorker.h >@@ -51,8 +51,8 @@ protected: > intptr_t asID() const { return reinterpret_cast<intptr_t>(this); } > > private: >- void refEventTarget() final { ref(); } >- void derefEventTarget() final { deref(); } >+ REF_RETURN_TYPE refEventTarget() final { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { deref(DEREF_ARGUMENT_NAME); } > }; > > } // namespace WebCore >diff --git a/Source/WebCore/workers/WorkerGlobalScope.h b/Source/WebCore/workers/WorkerGlobalScope.h >index bac0db88dad..db9e0e13736 100644 >--- a/Source/WebCore/workers/WorkerGlobalScope.h >+++ b/Source/WebCore/workers/WorkerGlobalScope.h >@@ -127,11 +127,11 @@ protected: > void applyContentSecurityPolicyResponseHeaders(const ContentSecurityPolicyResponseHeaders&); > > private: >- void refScriptExecutionContext() final { ref(); } >- void derefScriptExecutionContext() final { deref(); } >+ REF_RETURN_TYPE refScriptExecutionContext() final { return ref(); } >+ void derefScriptExecutionContext(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { deref(DEREF_ARGUMENT_NAME); } > >- void refEventTarget() final { ref(); } >- void derefEventTarget() final { deref(); } >+ REF_RETURN_TYPE refEventTarget() final { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { deref(DEREF_ARGUMENT_NAME); } > > void logExceptionToConsole(const String& errorMessage, const String& sourceURL, int lineNumber, int columnNumber, RefPtr<Inspector::ScriptCallStack>&&) final; > >diff --git a/Source/WebCore/workers/WorkerMessagingProxy.cpp b/Source/WebCore/workers/WorkerMessagingProxy.cpp >index 1540d77d5be..25c03afbcf1 100644 >--- a/Source/WebCore/workers/WorkerMessagingProxy.cpp >+++ b/Source/WebCore/workers/WorkerMessagingProxy.cpp >@@ -256,7 +256,7 @@ void WorkerMessagingProxy::workerGlobalScopeDestroyedInternal() > > // This balances the original ref in construction. > if (m_mayBeDestroyed) >- deref(); >+ deref(DEREF_DEFAULT_ARGUMENTS); > } > > void WorkerMessagingProxy::terminateWorkerGlobalScope() >diff --git a/Source/WebCore/workers/service/ServiceWorker.h b/Source/WebCore/workers/service/ServiceWorker.h >index 9b9bcc8a22f..197b51d0668 100644 >--- a/Source/WebCore/workers/service/ServiceWorker.h >+++ b/Source/WebCore/workers/service/ServiceWorker.h >@@ -70,8 +70,8 @@ private: > > EventTargetInterface eventTargetInterface() const final; > ScriptExecutionContext* scriptExecutionContext() const final; >- void refEventTarget() final { ref(); } >- void derefEventTarget() final { deref(); } >+ REF_RETURN_TYPE refEventTarget() final { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { deref(DEREF_ARGUMENT_NAME); } > > // ActiveDOMObject. > const char* activeDOMObjectName() const final; >diff --git a/Source/WebCore/workers/service/ServiceWorkerContainer.cpp b/Source/WebCore/workers/service/ServiceWorkerContainer.cpp >index 5edbc53b505..05d36df43c8 100644 >--- a/Source/WebCore/workers/service/ServiceWorkerContainer.cpp >+++ b/Source/WebCore/workers/service/ServiceWorkerContainer.cpp >@@ -71,14 +71,15 @@ ServiceWorkerContainer::~ServiceWorkerContainer() > #endif > } > >-void ServiceWorkerContainer::refEventTarget() >+REF_RETURN_TYPE ServiceWorkerContainer::refEventTarget() > { > m_navigator.ref(); >+ DEFAULT_REF_RETURN; > } > >-void ServiceWorkerContainer::derefEventTarget() >+void ServiceWorkerContainer::derefEventTarget(DEREF_ARGUMENT_TYPE) > { >- m_navigator.deref(); >+ m_navigator.deref(DEREF_DEFAULT_ARGUMENTS); > } > > auto ServiceWorkerContainer::ready() -> ReadyPromise& >diff --git a/Source/WebCore/workers/service/ServiceWorkerContainer.h b/Source/WebCore/workers/service/ServiceWorkerContainer.h >index ad3851be809..84ce2b3a1eb 100644 >--- a/Source/WebCore/workers/service/ServiceWorkerContainer.h >+++ b/Source/WebCore/workers/service/ServiceWorkerContainer.h >@@ -79,8 +79,8 @@ public: > > void startMessages(); > >- void ref() final { refEventTarget(); } >- void deref() final { derefEventTarget(); } >+ REF_RETURN_TYPE ref() final { return refEventTarget(); } >+ void deref(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { derefEventTarget(DEREF_ARGUMENT_NAME); } > > bool isStopped() const { return m_isStopped; }; > >@@ -110,8 +110,10 @@ private: > bool canSuspendForDocumentSuspension() const final; > ScriptExecutionContext* scriptExecutionContext() const final { return ActiveDOMObject::scriptExecutionContext(); } > EventTargetInterface eventTargetInterface() const final { return ServiceWorkerContainerEventTargetInterfaceType; } >- void refEventTarget() final; >- void derefEventTarget() final; >+ >+ REF_RETURN_TYPE refEventTarget() final; >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final; >+ > void stop() final; > > std::unique_ptr<ReadyPromise> m_readyPromise; >diff --git a/Source/WebCore/workers/service/ServiceWorkerJobClient.h b/Source/WebCore/workers/service/ServiceWorkerJobClient.h >index 6737ecaf1ec..c83cc803787 100644 >--- a/Source/WebCore/workers/service/ServiceWorkerJobClient.h >+++ b/Source/WebCore/workers/service/ServiceWorkerJobClient.h >@@ -54,8 +54,8 @@ public: > > virtual SWServerConnectionIdentifier connectionIdentifier() = 0; > >- virtual void ref() = 0; >- virtual void deref() = 0; >+ virtual REF_RETURN_TYPE ref() = 0; >+ virtual void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS) = 0; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/workers/service/ServiceWorkerRegistration.h b/Source/WebCore/workers/service/ServiceWorkerRegistration.h >index 4372887349d..c14e20f6066 100644 >--- a/Source/WebCore/workers/service/ServiceWorkerRegistration.h >+++ b/Source/WebCore/workers/service/ServiceWorkerRegistration.h >@@ -82,8 +82,8 @@ private: > > EventTargetInterface eventTargetInterface() const final; > ScriptExecutionContext* scriptExecutionContext() const final; >- void refEventTarget() final { ref(); } >- void derefEventTarget() final { deref(); } >+ REF_RETURN_TYPE refEventTarget() final { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { deref(DEREF_ARGUMENT_NAME); } > > // ActiveDOMObject. > const char* activeDOMObjectName() const final; >diff --git a/Source/WebCore/xml/XMLHttpRequest.h b/Source/WebCore/xml/XMLHttpRequest.h >index e32d01335ca..fc223df0cf6 100644 >--- a/Source/WebCore/xml/XMLHttpRequest.h >+++ b/Source/WebCore/xml/XMLHttpRequest.h >@@ -127,8 +127,8 @@ private: > void stop() override; > const char* activeDOMObjectName() const override; > >- void refEventTarget() override { ref(); } >- void derefEventTarget() override { deref(); } >+ REF_RETURN_TYPE refEventTarget() override { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) override { deref(DEREF_ARGUMENT_NAME); } > > Document* document() const; > SecurityOrigin* securityOrigin() const; >diff --git a/Source/WebCore/xml/XMLHttpRequestUpload.h b/Source/WebCore/xml/XMLHttpRequestUpload.h >index e9ebb58232d..ae57f7c7300 100644 >--- a/Source/WebCore/xml/XMLHttpRequestUpload.h >+++ b/Source/WebCore/xml/XMLHttpRequestUpload.h >@@ -35,15 +35,15 @@ class XMLHttpRequestUpload final : public XMLHttpRequestEventTarget { > public: > explicit XMLHttpRequestUpload(XMLHttpRequest&); > >- void ref() { m_request.ref(); } >- void deref() { m_request.deref(); } >+ REF_RETURN_TYPE ref() { m_request.ref(); DEFAULT_REF_RETURN; } >+ void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS) { m_request.deref(DEREF_DEFAULT_ARGUMENTS); } > > void dispatchThrottledProgressEvent(bool lengthComputable, unsigned long long loaded, unsigned long long total); > void dispatchProgressEvent(const AtomicString& type); > > private: >- void refEventTarget() final { ref(); } >- void derefEventTarget() final { deref(); } >+ REF_RETURN_TYPE refEventTarget() final { return ref(); } >+ void derefEventTarget(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) final { deref(DEREF_ARGUMENT_NAME); } > > EventTargetInterface eventTargetInterface() const final { return XMLHttpRequestUploadEventTargetInterfaceType; } > ScriptExecutionContext* scriptExecutionContext() const final { return m_request.scriptExecutionContext(); } >diff --git a/Source/WebCore/xml/XPathGrammar.cpp b/Source/WebCore/xml/XPathGrammar.cpp >index 31df1c0d158..1a5da5daa23 100644 >--- a/Source/WebCore/xml/XPathGrammar.cpp >+++ b/Source/WebCore/xml/XPathGrammar.cpp >@@ -1203,32 +1203,32 @@ yydestruct (yymsg, yytype, yyvaluep, parser) > { > case 10: /* "FUNCTIONNAME" */ > #line 80 "WebCore/xml/XPathGrammar.y" >- { if ((yyvaluep->string)) (yyvaluep->string)->deref(); }; >+ { if ((yyvaluep->string)) (yyvaluep->string)->deref(DEREF_DEFAULT_ARGUMENTS); }; > #line 1205 "./XPathGrammar.cpp" > break; > case 11: /* "LITERAL" */ > #line 80 "WebCore/xml/XPathGrammar.y" >- { if ((yyvaluep->string)) (yyvaluep->string)->deref(); }; >+ { if ((yyvaluep->string)) (yyvaluep->string)->deref(DEREF_DEFAULT_ARGUMENTS); }; > #line 1210 "./XPathGrammar.cpp" > break; > case 12: /* "NAMETEST" */ > #line 80 "WebCore/xml/XPathGrammar.y" >- { if ((yyvaluep->string)) (yyvaluep->string)->deref(); }; >+ { if ((yyvaluep->string)) (yyvaluep->string)->deref(DEREF_DEFAULT_ARGUMENTS); }; > #line 1215 "./XPathGrammar.cpp" > break; > case 13: /* "NUMBER" */ > #line 80 "WebCore/xml/XPathGrammar.y" >- { if ((yyvaluep->string)) (yyvaluep->string)->deref(); }; >+ { if ((yyvaluep->string)) (yyvaluep->string)->deref(DEREF_DEFAULT_ARGUMENTS); }; > #line 1220 "./XPathGrammar.cpp" > break; > case 14: /* "NODETYPE" */ > #line 80 "WebCore/xml/XPathGrammar.y" >- { if ((yyvaluep->string)) (yyvaluep->string)->deref(); }; >+ { if ((yyvaluep->string)) (yyvaluep->string)->deref(DEREF_DEFAULT_ARGUMENTS); }; > #line 1225 "./XPathGrammar.cpp" > break; > case 15: /* "VARIABLEREFERENCE" */ > #line 80 "WebCore/xml/XPathGrammar.y" >- { if ((yyvaluep->string)) (yyvaluep->string)->deref(); }; >+ { if ((yyvaluep->string)) (yyvaluep->string)->deref(DEREF_DEFAULT_ARGUMENTS); }; > #line 1230 "./XPathGrammar.cpp" > break; > case 35: /* "Expr" */ >diff --git a/Source/WebCore/xml/XPathGrammar.y b/Source/WebCore/xml/XPathGrammar.y >index 4eb20b92a56..2dfa8eac5a6 100644 >--- a/Source/WebCore/xml/XPathGrammar.y >+++ b/Source/WebCore/xml/XPathGrammar.y >@@ -77,7 +77,7 @@ using namespace XPath; > %left OR AND > > %token <string> FUNCTIONNAME LITERAL NAMETEST NUMBER NODETYPE VARIABLEREFERENCE >-%destructor { if ($$) $$->deref(); } FUNCTIONNAME LITERAL NAMETEST NUMBER NODETYPE VARIABLEREFERENCE >+%destructor { if ($$) $$->deref(DEREF_DEFAULT_ARGUMENTS); } FUNCTIONNAME LITERAL NAMETEST NUMBER NODETYPE VARIABLEREFERENCE > > %token <axis> AXISNAME > %type <axis> AxisSpecifier >diff --git a/Source/WebCore/xml/parser/XMLDocumentParser.cpp b/Source/WebCore/xml/parser/XMLDocumentParser.cpp >index 1f28a8eba59..1e31642297d 100644 >--- a/Source/WebCore/xml/parser/XMLDocumentParser.cpp >+++ b/Source/WebCore/xml/parser/XMLDocumentParser.cpp >@@ -77,7 +77,7 @@ void XMLDocumentParser::popCurrentNode() > ASSERT(m_currentNodeStack.size()); > > if (m_currentNode != document()) >- m_currentNode->deref(); >+ m_currentNode->deref(DEREF_DEFAULT_ARGUMENTS); > > m_currentNode = m_currentNodeStack.last(); > m_currentNodeStack.removeLast(); >@@ -86,15 +86,15 @@ void XMLDocumentParser::popCurrentNode() > void XMLDocumentParser::clearCurrentNodeStack() > { > if (m_currentNode && m_currentNode != document()) >- m_currentNode->deref(); >+ m_currentNode->deref(DEREF_DEFAULT_ARGUMENTS); > m_currentNode = nullptr; > m_leafTextNode = nullptr; > > if (m_currentNodeStack.size()) { // Aborted parsing. > for (size_t i = m_currentNodeStack.size() - 1; i != 0; --i) >- m_currentNodeStack[i]->deref(); >+ m_currentNodeStack[i]->deref(DEREF_DEFAULT_ARGUMENTS); > if (m_currentNodeStack[0] && m_currentNodeStack[0] != document()) >- m_currentNodeStack[0]->deref(); >+ m_currentNodeStack[0]->deref(DEREF_DEFAULT_ARGUMENTS); > m_currentNodeStack.clear(); > } > } >diff --git a/Source/WebKit/Platform/IPC/mac/ConnectionMac.mm b/Source/WebKit/Platform/IPC/mac/ConnectionMac.mm >index 1f7b7b79865..91319bd4c10 100644 >--- a/Source/WebKit/Platform/IPC/mac/ConnectionMac.mm >+++ b/Source/WebKit/Platform/IPC/mac/ConnectionMac.mm >@@ -238,7 +238,7 @@ bool Connection::open() > if (m_sendSource) > dispatch_resume(m_sendSource); > >- deref(); >+ deref(DEREF_DEFAULT_ARGUMENTS); > }); > > return true; >diff --git a/Source/WebKit/Shared/API/APIObject.h b/Source/WebKit/Shared/API/APIObject.h >index 1f6003ff5f4..2cea503f2c8 100644 >--- a/Source/WebKit/Shared/API/APIObject.h >+++ b/Source/WebKit/Shared/API/APIObject.h >@@ -217,8 +217,8 @@ public: > > NSObject *wrapper() { return m_wrapper; } > >- void ref(); >- void deref(); >+ REF_RETURN_TYPE ref(); >+ void deref(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS); > #endif // DELEGATE_REF_COUNTING_TO_COCOA > > static void* wrap(API::Object*); >diff --git a/Source/WebKit/Shared/API/c/WKType.cpp b/Source/WebKit/Shared/API/c/WKType.cpp >index fd20e6fff1e..4637935d525 100644 >--- a/Source/WebKit/Shared/API/c/WKType.cpp >+++ b/Source/WebKit/Shared/API/c/WKType.cpp >@@ -45,5 +45,5 @@ WKTypeRef WKRetain(WKTypeRef typeRef) > > void WKRelease(WKTypeRef typeRef) > { >- toImpl(typeRef)->deref(); >+ toImpl(typeRef)->deref(DEREF_DEFAULT_ARGUMENTS); > } >diff --git a/Source/WebKit/Shared/Cocoa/APIObject.mm b/Source/WebKit/Shared/Cocoa/APIObject.mm >index 6899ca5627a..d27c3bca3b0 100644 >--- a/Source/WebKit/Shared/Cocoa/APIObject.mm >+++ b/Source/WebKit/Shared/Cocoa/APIObject.mm >@@ -92,12 +92,13 @@ static const size_t maximumExtraSpaceForAlignment = minimumObjectAlignment - ali > > namespace API { > >-void Object::ref() >+REF_RETURN_TYPE Object::ref() > { > CFRetain(wrapper()); >+ DEFAULT_REF_RETURN; > } > >-void Object::deref() >+void Object::deref(DEREF_ARGUMENT_TYPE) > { > CFRelease(wrapper()); > } >diff --git a/Source/WebKit/Shared/ShareableResource.cpp b/Source/WebKit/Shared/ShareableResource.cpp >index d147d80e574..b100d3b3753 100644 >--- a/Source/WebKit/Shared/ShareableResource.cpp >+++ b/Source/WebKit/Shared/ShareableResource.cpp >@@ -60,7 +60,7 @@ bool ShareableResource::Handle::decode(IPC::Decoder& decoder, Handle& handle) > #if USE(CF) > static void shareableResourceDeallocate(void *ptr, void *info) > { >- static_cast<ShareableResource*>(info)->deref(); // Balanced by ref() in createShareableResourceDeallocator() >+ static_cast<ShareableResource*>(info)->deref(DEREF_DEFAULT_ARGUMENTS); // Balanced by ref() in createShareableResourceDeallocator() > } > > static CFAllocatorRef createShareableResourceDeallocator(ShareableResource* resource) >@@ -89,7 +89,7 @@ RefPtr<SharedBuffer> ShareableResource::wrapInSharedBuffer() > RetainPtr<CFDataRef> cfData = adoptCF(CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, reinterpret_cast<const UInt8*>(data()), static_cast<CFIndex>(size()), deallocator.get())); > return SharedBuffer::create(cfData.get()); > #elif USE(SOUP) >- return SharedBuffer::wrapSoupBuffer(soup_buffer_new_with_owner(data(), size(), this, [](void* data) { static_cast<ShareableResource*>(data)->deref(); })); >+ return SharedBuffer::wrapSoupBuffer(soup_buffer_new_with_owner(data(), size(), this, [](void* data) { static_cast<ShareableResource*>(data)->deref(DEREF_DEFAULT_ARGUMENTS); })); > #else > ASSERT_NOT_REACHED(); > return nullptr; >diff --git a/Source/WebKit/Shared/cg/ShareableBitmapCG.cpp b/Source/WebKit/Shared/cg/ShareableBitmapCG.cpp >index 41b2fea32b1..4e0456916f2 100644 >--- a/Source/WebKit/Shared/cg/ShareableBitmapCG.cpp >+++ b/Source/WebKit/Shared/cg/ShareableBitmapCG.cpp >@@ -137,14 +137,14 @@ void ShareableBitmap::releaseBitmapContextData(void* typelessBitmap, void* typel > { > ShareableBitmap* bitmap = static_cast<ShareableBitmap*>(typelessBitmap); > ASSERT_UNUSED(typelessData, bitmap->data() == typelessData); >- bitmap->deref(); // Balanced by ref in createGraphicsContext. >+ bitmap->deref(DEREF_DEFAULT_ARGUMENTS); // Balanced by ref in createGraphicsContext. > } > > void ShareableBitmap::releaseDataProviderData(void* typelessBitmap, const void* typelessData, size_t) > { > ShareableBitmap* bitmap = static_cast<ShareableBitmap*>(typelessBitmap); > ASSERT_UNUSED(typelessData, bitmap->data() == typelessData); >- bitmap->deref(); // Balanced by ref in createCGImage. >+ bitmap->deref(DEREF_DEFAULT_ARGUMENTS); // Balanced by ref in createCGImage. > } > > RefPtr<Image> ShareableBitmap::createImage() >diff --git a/Source/WebKit/StorageProcess/IndexedDB/WebIDBConnectionToClient.h b/Source/WebKit/StorageProcess/IndexedDB/WebIDBConnectionToClient.h >index 0087e8aa87c..b50dfbb3c01 100644 >--- a/Source/WebKit/StorageProcess/IndexedDB/WebIDBConnectionToClient.h >+++ b/Source/WebKit/StorageProcess/IndexedDB/WebIDBConnectionToClient.h >@@ -87,8 +87,8 @@ public: > > void didGetAllDatabaseNames(uint64_t callbackID, const Vector<String>& databaseNames) final; > >- void ref() override { RefCounted<WebIDBConnectionToClient>::ref(); } >- void deref() override { RefCounted<WebIDBConnectionToClient>::deref(); } >+ REF_RETURN_TYPE ref() override { return RefCounted<WebIDBConnectionToClient>::ref(); } >+ void deref(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) override { RefCounted<WebIDBConnectionToClient>::deref(DEREF_ARGUMENT_NAME); } > > // Messages received from WebProcess > void deleteDatabase(const WebCore::IDBRequestData&); >diff --git a/Source/WebKit/UIProcess/API/C/mac/WKContextPrivateMac.mm b/Source/WebKit/UIProcess/API/C/mac/WKContextPrivateMac.mm >index 7f93c1e32aa..0eed0e7b3a8 100644 >--- a/Source/WebKit/UIProcess/API/C/mac/WKContextPrivateMac.mm >+++ b/Source/WebKit/UIProcess/API/C/mac/WKContextPrivateMac.mm >@@ -98,7 +98,7 @@ void WKContextGetInfoForInstalledPlugIns(WKContextRef contextRef, WKContextGetIn > dispatch_async(dispatch_get_main_queue(), ^() { > block(toAPI(array.get()), 0); > >- toImpl(contextRef)->deref(); >+ toImpl(contextRef)->deref(DEREF_DEFAULT_ARGUMENTS); > }); > #endif > } >diff --git a/Source/WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm b/Source/WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm >index 31105e4703c..fc299466c52 100644 >--- a/Source/WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm >+++ b/Source/WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm >@@ -270,7 +270,7 @@ void ProcessLauncher::launchProcess() > m_xpcConnection = nullptr; > } > >- deref(); >+ deref(DEREF_DEFAULT_ARGUMENTS); > }); > } > >diff --git a/Source/WebKit/UIProcess/Notifications/WebNotificationManagerProxy.cpp b/Source/WebKit/UIProcess/Notifications/WebNotificationManagerProxy.cpp >index c85cc5a0465..6f0c67fead3 100644 >--- a/Source/WebKit/UIProcess/Notifications/WebNotificationManagerProxy.cpp >+++ b/Source/WebKit/UIProcess/Notifications/WebNotificationManagerProxy.cpp >@@ -79,14 +79,14 @@ void WebNotificationManagerProxy::processPoolDestroyed() > m_provider->removeNotificationManager(*this); > } > >-void WebNotificationManagerProxy::refWebContextSupplement() >+REF_RETURN_TYPE WebNotificationManagerProxy::refWebContextSupplement() > { >- API::Object::ref(); >+ return API::Object::ref(); > } > >-void WebNotificationManagerProxy::derefWebContextSupplement() >+void WebNotificationManagerProxy::derefWebContextSupplement(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) > { >- API::Object::deref(); >+ API::Object::deref(DEREF_ARGUMENT_NAME); > } > > HashMap<String, bool> WebNotificationManagerProxy::notificationPermissions() >diff --git a/Source/WebKit/UIProcess/Notifications/WebNotificationManagerProxy.h b/Source/WebKit/UIProcess/Notifications/WebNotificationManagerProxy.h >index 542fbd9726e..ce2d4d4729d 100644 >--- a/Source/WebKit/UIProcess/Notifications/WebNotificationManagerProxy.h >+++ b/Source/WebKit/UIProcess/Notifications/WebNotificationManagerProxy.h >@@ -84,8 +84,8 @@ private: > > // WebContextSupplement > void processPoolDestroyed() override; >- void refWebContextSupplement() override; >- void derefWebContextSupplement() override; >+ REF_RETURN_TYPE refWebContextSupplement() override; >+ void derefWebContextSupplement(DEREF_ARGUMENT_TYPE) override; > > std::unique_ptr<API::NotificationProvider> m_provider; > // Pair comprised of web page ID and the web process's notification ID >diff --git a/Source/WebKit/UIProcess/ResourceLoadStatisticsPersistentStorage.cpp b/Source/WebKit/UIProcess/ResourceLoadStatisticsPersistentStorage.cpp >index b67cade25df..be23409b478 100644 >--- a/Source/WebKit/UIProcess/ResourceLoadStatisticsPersistentStorage.cpp >+++ b/Source/WebKit/UIProcess/ResourceLoadStatisticsPersistentStorage.cpp >@@ -335,14 +335,15 @@ void ResourceLoadStatisticsPersistentStorage::finishAllPendingWorkSynchronously( > semaphore.wait(WallTime::infinity()); > } > >-void ResourceLoadStatisticsPersistentStorage::ref() >+REF_RETURN_TYPE ResourceLoadStatisticsPersistentStorage::ref() > { > m_memoryStore.ref(); >+ DEFAULT_REF_RETURN; > } > >-void ResourceLoadStatisticsPersistentStorage::deref() >+void ResourceLoadStatisticsPersistentStorage::deref(DEREF_ARGUMENT_TYPE) > { >- m_memoryStore.deref(); >+ m_memoryStore.deref(DEREF_DEFAULT_ARGUMENTS); > } > > #if !PLATFORM(IOS) >diff --git a/Source/WebKit/UIProcess/ResourceLoadStatisticsPersistentStorage.h b/Source/WebKit/UIProcess/ResourceLoadStatisticsPersistentStorage.h >index b8d12f1717d..236aa574582 100644 >--- a/Source/WebKit/UIProcess/ResourceLoadStatisticsPersistentStorage.h >+++ b/Source/WebKit/UIProcess/ResourceLoadStatisticsPersistentStorage.h >@@ -50,8 +50,8 @@ public: > > void finishAllPendingWorkSynchronously(); > >- void ref(); >- void deref(); >+ REF_RETURN_TYPE ref(); >+ void deref(DEREF_ARGUMENT_TYPE); > > enum class ForceImmediateWrite { > No, >diff --git a/Source/WebKit/UIProcess/WebContextSupplement.h b/Source/WebKit/UIProcess/WebContextSupplement.h >index 80ca3a533a1..a3ccf48dcf2 100644 >--- a/Source/WebKit/UIProcess/WebContextSupplement.h >+++ b/Source/WebKit/UIProcess/WebContextSupplement.h >@@ -63,12 +63,12 @@ public: > WebProcessPool* processPool() const { return m_processPool; } > void clearProcessPool() { m_processPool = nullptr; } > >- void ref() { refWebContextSupplement(); } >- void deref() { derefWebContextSupplement(); } >+ REF_RETURN_TYPE ref() { return refWebContextSupplement(); } >+ void deref(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) { derefWebContextSupplement(DEREF_ARGUMENT_NAME); } > > private: >- virtual void refWebContextSupplement() = 0; >- virtual void derefWebContextSupplement() = 0; >+ virtual REF_RETURN_TYPE refWebContextSupplement() = 0; >+ virtual void derefWebContextSupplement(DEREF_DECLARE_ARGUMENTS_WITH_DEFAULTS) = 0; > > WebProcessPool* m_processPool; > }; >diff --git a/Source/WebKit/UIProcess/WebCookieManagerProxy.cpp b/Source/WebKit/UIProcess/WebCookieManagerProxy.cpp >index af0e3ee2548..1d9e4f94b72 100644 >--- a/Source/WebKit/UIProcess/WebCookieManagerProxy.cpp >+++ b/Source/WebKit/UIProcess/WebCookieManagerProxy.cpp >@@ -97,14 +97,14 @@ void WebCookieManagerProxy::processDidClose(NetworkProcessProxy*) > m_callbacks.invalidate(CallbackBase::Error::ProcessExited); > } > >-void WebCookieManagerProxy::refWebContextSupplement() >+REF_RETURN_TYPE WebCookieManagerProxy::refWebContextSupplement() > { >- API::Object::ref(); >+ return API::Object::ref(); > } > >-void WebCookieManagerProxy::derefWebContextSupplement() >+void WebCookieManagerProxy::derefWebContextSupplement(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) > { >- API::Object::deref(); >+ API::Object::deref(DEREF_ARGUMENT_NAME); > } > > void WebCookieManagerProxy::getHostnamesWithCookies(PAL::SessionID sessionID, Function<void (API::Array*, CallbackBase::Error)>&& callbackFunction) >diff --git a/Source/WebKit/UIProcess/WebCookieManagerProxy.h b/Source/WebKit/UIProcess/WebCookieManagerProxy.h >index 97f14add6df..ceb0c87b9af 100644 >--- a/Source/WebKit/UIProcess/WebCookieManagerProxy.h >+++ b/Source/WebKit/UIProcess/WebCookieManagerProxy.h >@@ -122,8 +122,8 @@ private: > void processPoolDestroyed() override; > void processDidClose(WebProcessProxy*) override; > void processDidClose(NetworkProcessProxy*) override; >- void refWebContextSupplement() override; >- void derefWebContextSupplement() override; >+ REF_RETURN_TYPE refWebContextSupplement() override; >+ void derefWebContextSupplement(DEREF_ARGUMENT_TYPE) override; > > // IPC::MessageReceiver > void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override; >diff --git a/Source/WebKit/UIProcess/WebGeolocationManagerProxy.cpp b/Source/WebKit/UIProcess/WebGeolocationManagerProxy.cpp >index 52b011f5dba..883d90aae64 100644 >--- a/Source/WebKit/UIProcess/WebGeolocationManagerProxy.cpp >+++ b/Source/WebKit/UIProcess/WebGeolocationManagerProxy.cpp >@@ -76,14 +76,14 @@ void WebGeolocationManagerProxy::processDidClose(WebProcessProxy* webProcessProx > removeRequester(webProcessProxy); > } > >-void WebGeolocationManagerProxy::refWebContextSupplement() >+REF_RETURN_TYPE WebGeolocationManagerProxy::refWebContextSupplement() > { >- API::Object::ref(); >+ return API::Object::ref(); > } > >-void WebGeolocationManagerProxy::derefWebContextSupplement() >+void WebGeolocationManagerProxy::derefWebContextSupplement(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) > { >- API::Object::deref(); >+ API::Object::deref(DEREF_ARGUMENT_NAME); > } > > void WebGeolocationManagerProxy::providerDidChangePosition(WebGeolocationPosition* position) >diff --git a/Source/WebKit/UIProcess/WebGeolocationManagerProxy.h b/Source/WebKit/UIProcess/WebGeolocationManagerProxy.h >index 15153920730..1f61d785b10 100644 >--- a/Source/WebKit/UIProcess/WebGeolocationManagerProxy.h >+++ b/Source/WebKit/UIProcess/WebGeolocationManagerProxy.h >@@ -64,8 +64,8 @@ private: > // WebContextSupplement > void processPoolDestroyed() override; > void processDidClose(WebProcessProxy*) override; >- void refWebContextSupplement() override; >- void derefWebContextSupplement() override; >+ REF_RETURN_TYPE refWebContextSupplement() override; >+ void derefWebContextSupplement(DEREF_ARGUMENT_TYPE) override; > > // IPC::MessageReceiver > void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override; >diff --git a/Source/WebKit/UIProcess/WebMediaSessionFocusManager.cpp b/Source/WebKit/UIProcess/WebMediaSessionFocusManager.cpp >index 2cdcd176529..17df05d256c 100644 >--- a/Source/WebKit/UIProcess/WebMediaSessionFocusManager.cpp >+++ b/Source/WebKit/UIProcess/WebMediaSessionFocusManager.cpp >@@ -47,14 +47,14 @@ WebMediaSessionFocusManager::WebMediaSessionFocusManager(WebProcessPool* process > > // WebContextSupplement > >-void WebMediaSessionFocusManager::refWebContextSupplement() >+REF_RETURN_TYPE WebMediaSessionFocusManager::refWebContextSupplement() > { >- API::Object::ref(); >+ return API::Object::ref(); > } > >-void WebMediaSessionFocusManager::derefWebContextSupplement() >+void WebMediaSessionFocusManager::derefWebContextSupplement(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) > { >- API::Object::deref(); >+ API::Object::deref(DEREF_ARGUMENT_NAME); > } > > void WebMediaSessionFocusManager::initializeClient(const WKMediaSessionFocusManagerClientBase* client) >diff --git a/Source/WebKit/UIProcess/WebMediaSessionFocusManager.h b/Source/WebKit/UIProcess/WebMediaSessionFocusManager.h >index 24c7037df6a..8aa3e09f463 100644 >--- a/Source/WebKit/UIProcess/WebMediaSessionFocusManager.h >+++ b/Source/WebKit/UIProcess/WebMediaSessionFocusManager.h >@@ -58,8 +58,8 @@ private: > explicit WebMediaSessionFocusManager(WebProcessPool*); > > // WebContextSupplement >- void refWebContextSupplement() override; >- void derefWebContextSupplement() override; >+ REF_RETURN_TYPE refWebContextSupplement() override; >+ void derefWebContextSupplement(DEREF_ARGUMENT_TYPE) override; > > void updatePlaybackAttribute(WKMediaSessionFocusManagerPlaybackAttribute, bool); > >diff --git a/Source/WebKit/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h b/Source/WebKit/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h >index 28c9889900d..856dcaef9b0 100644 >--- a/Source/WebKit/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h >+++ b/Source/WebKit/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h >@@ -76,8 +76,8 @@ public: > > void getAllDatabaseNames(const WebCore::SecurityOriginData& topOrigin, const WebCore::SecurityOriginData& openingOrigin, uint64_t callbackID) final; > >- void ref() override { RefCounted<WebIDBConnectionToServer>::ref(); } >- void deref() override { RefCounted<WebIDBConnectionToServer>::deref(); } >+ REF_RETURN_TYPE ref() override { return RefCounted<WebIDBConnectionToServer>::ref(); } >+ void deref(DEREF_ARGUMENT_TYPE DEREF_ARGUMENT_NAME) override { RefCounted<WebIDBConnectionToServer>::deref(DEREF_ARGUMENT_NAME); } > > // Messages received from StorageProcess > void didDeleteDatabase(const WebCore::IDBResultData&); >diff --git a/Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.cpp b/Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.cpp >index f842b8426f9..44599752495 100644 >--- a/Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.cpp >+++ b/Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.cpp >@@ -610,8 +610,10 @@ Vector<String> InjectedBundle::liveDocumentURLs() > { > Vector<String> result; > >- for (const auto* document : Document::allDocuments()) >+ for (const auto* document : Document::allDocuments()) { >+ WTFLogAlways("InjectedBundle::liveDocumentURLs: document %p (refcount %d) %s", document, document->refCount(), document->url().string().utf8().data()); > result.append(document->url().string()); >+ } > > return result; > } >diff --git a/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp b/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp >index e41e8318099..aa82cd55e6c 100644 >--- a/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp >+++ b/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp >@@ -62,7 +62,7 @@ void InjectedBundlePageLoaderClient::willLoadURLRequest(WebPage& page, const Res > static void releaseSharedBuffer(unsigned char*, const void* data) > { > // Balanced by ref() in InjectedBundlePageLoaderClient::willLoadDataRequest(). >- static_cast<SharedBuffer*>(const_cast<void*>(data))->deref(); >+ static_cast<SharedBuffer*>(const_cast<void*>(data))->deref(DEREF_DEFAULT_ARGUMENTS); > } > > void InjectedBundlePageLoaderClient::willLoadDataRequest(WebPage& page, const ResourceRequest& request, SharedBuffer* sharedBuffer, const String& MIMEType, const String& encodingName, const URL& unreachableURL, API::Object* userData) >diff --git a/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm b/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm >index c1ac4d58e4f..a711e516715 100644 >--- a/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm >+++ b/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm >@@ -941,7 +941,7 @@ static void jsPDFDocInitialize(JSContextRef ctx, JSObjectRef object) > static void jsPDFDocFinalize(JSObjectRef object) > { > PDFPlugin* pdfView = static_cast<PDFPlugin*>(JSObjectGetPrivate(object)); >- pdfView->deref(); >+ pdfView->deref(DEREF_DEFAULT_ARGUMENTS); > } > > JSValueRef PDFPlugin::jsPDFDocPrint(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) >diff --git a/Source/WebKit/WebProcess/Plugins/PluginView.cpp b/Source/WebKit/WebProcess/Plugins/PluginView.cpp >index 90e0109e966..a2af8472260 100644 >--- a/Source/WebKit/WebProcess/Plugins/PluginView.cpp >+++ b/Source/WebKit/WebProcess/Plugins/PluginView.cpp >@@ -1654,7 +1654,7 @@ void PluginView::unprotectPluginFromDestruction() > return; > } > >- deref(); >+ deref(DEREF_DEFAULT_ARGUMENTS); > } > > void PluginView::didFinishLoad(WebFrame* webFrame) >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp b/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp >index e9fc74da4eb..dba0dd9d0a7 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp >@@ -137,7 +137,7 @@ void WebFrameLoaderClient::frameLoaderDestroyed() > m_frame->invalidate(); > > // Balances explicit ref() in WebFrame::create(). >- m_frame->deref(); >+ m_frame->deref(DEREF_DEFAULT_ARGUMENTS); > } > > bool WebFrameLoaderClient::hasHTMLView() const >diff --git a/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm b/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm >index d02ed721a7b..3114da746ed 100644 >--- a/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm >+++ b/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm >@@ -392,7 +392,7 @@ void TiledCoreAnimationDrawingArea::dispatchAfterEnsuringUpdatedScrollPosition(W > if (!m_layerTreeStateIsFrozen) > m_layerFlushScheduler.resume(); > >- webPage->deref(); >+ webPage->deref(DEREF_DEFAULT_ARGUMENTS); > }); > #else > function(); >diff --git a/Source/WebKitLegacy/ios/WebCoreSupport/WebGeolocation.mm b/Source/WebKitLegacy/ios/WebCoreSupport/WebGeolocation.mm >index dac61c1f5d4..83fa610002e 100644 >--- a/Source/WebKitLegacy/ios/WebCoreSupport/WebGeolocation.mm >+++ b/Source/WebKitLegacy/ios/WebCoreSupport/WebGeolocation.mm >@@ -56,7 +56,7 @@ - (void)setIsAllowed:(BOOL)allowed > - (void)dealloc > { > if (_private) >- reinterpret_cast<Geolocation*>(_private)->deref(); >+ reinterpret_cast<Geolocation*>(_private)->deref(DEREF_DEFAULT_ARGUMENTS); > [super dealloc]; > } > >diff --git a/Source/WebKitLegacy/mac/DOM/DOM.mm b/Source/WebKitLegacy/mac/DOM/DOM.mm >index 83d56d04486..6074c1e3182 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOM.mm >+++ b/Source/WebKitLegacy/mac/DOM/DOM.mm >@@ -839,14 +839,14 @@ @implementation DOMNodeFilter > - (void)dealloc > { > if (_internal) >- reinterpret_cast<WebCore::NodeFilter*>(_internal)->deref(); >+ reinterpret_cast<WebCore::NodeFilter*>(_internal)->deref(DEREF_DEFAULT_ARGUMENTS); > [super dealloc]; > } > > - (void)finalize > { > if (_internal) >- reinterpret_cast<WebCore::NodeFilter*>(_internal)->deref(); >+ reinterpret_cast<WebCore::NodeFilter*>(_internal)->deref(DEREF_DEFAULT_ARGUMENTS); > [super finalize]; > } > >diff --git a/Source/WebKitLegacy/mac/DOM/DOMBlob.mm b/Source/WebKitLegacy/mac/DOM/DOMBlob.mm >index 75914db9672..c5d051efcc7 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOMBlob.mm >+++ b/Source/WebKitLegacy/mac/DOM/DOMBlob.mm >@@ -46,7 +46,7 @@ - (void)dealloc > return; > > if (_internal) >- IMPL->deref(); >+ IMPL->deref(DEREF_DEFAULT_ARGUMENTS); > [super dealloc]; > } > >diff --git a/Source/WebKitLegacy/mac/DOM/DOMCSSRule.mm b/Source/WebKitLegacy/mac/DOM/DOMCSSRule.mm >index 760fb5b1885..cacb51a0fa6 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOMCSSRule.mm >+++ b/Source/WebKitLegacy/mac/DOM/DOMCSSRule.mm >@@ -49,7 +49,7 @@ - (void)dealloc > return; > > if (_internal) >- IMPL->deref(); >+ IMPL->deref(DEREF_DEFAULT_ARGUMENTS); > [super dealloc]; > } > >diff --git a/Source/WebKitLegacy/mac/DOM/DOMCSSRuleList.mm b/Source/WebKitLegacy/mac/DOM/DOMCSSRuleList.mm >index 3cac5c2ce81..9bedbc8bcd2 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOMCSSRuleList.mm >+++ b/Source/WebKitLegacy/mac/DOM/DOMCSSRuleList.mm >@@ -48,7 +48,7 @@ - (void)dealloc > return; > > if (_internal) >- IMPL->deref(); >+ IMPL->deref(DEREF_DEFAULT_ARGUMENTS); > [super dealloc]; > } > >diff --git a/Source/WebKitLegacy/mac/DOM/DOMCSSStyleDeclaration.mm b/Source/WebKitLegacy/mac/DOM/DOMCSSStyleDeclaration.mm >index 0a0677df6a1..9ec710cee70 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOMCSSStyleDeclaration.mm >+++ b/Source/WebKitLegacy/mac/DOM/DOMCSSStyleDeclaration.mm >@@ -51,7 +51,7 @@ - (void)dealloc > return; > > if (_internal) >- IMPL->deref(); >+ IMPL->deref(DEREF_DEFAULT_ARGUMENTS); > [super dealloc]; > } > >diff --git a/Source/WebKitLegacy/mac/DOM/DOMCSSValue.mm b/Source/WebKitLegacy/mac/DOM/DOMCSSValue.mm >index 799fb619a2a..890a120297f 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOMCSSValue.mm >+++ b/Source/WebKitLegacy/mac/DOM/DOMCSSValue.mm >@@ -46,7 +46,7 @@ - (void)dealloc > return; > > if (_internal) >- IMPL->deref(); >+ IMPL->deref(DEREF_DEFAULT_ARGUMENTS); > [super dealloc]; > } > >diff --git a/Source/WebKitLegacy/mac/DOM/DOMCounter.mm b/Source/WebKitLegacy/mac/DOM/DOMCounter.mm >index b0e4af42e2d..a4511ada197 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOMCounter.mm >+++ b/Source/WebKitLegacy/mac/DOM/DOMCounter.mm >@@ -46,7 +46,7 @@ - (void)dealloc > return; > > if (_internal) >- IMPL->deref(); >+ IMPL->deref(DEREF_DEFAULT_ARGUMENTS); > [super dealloc]; > } > >diff --git a/Source/WebKitLegacy/mac/DOM/DOMEvent.mm b/Source/WebKitLegacy/mac/DOM/DOMEvent.mm >index 9aca41b65fa..62d1aee280b 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOMEvent.mm >+++ b/Source/WebKitLegacy/mac/DOM/DOMEvent.mm >@@ -48,7 +48,7 @@ - (void)dealloc > return; > > if (_internal) >- IMPL->deref(); >+ IMPL->deref(DEREF_DEFAULT_ARGUMENTS); > [super dealloc]; > } > >diff --git a/Source/WebKitLegacy/mac/DOM/DOMFileList.mm b/Source/WebKitLegacy/mac/DOM/DOMFileList.mm >index a2674fe7f90..056e149fcee 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOMFileList.mm >+++ b/Source/WebKitLegacy/mac/DOM/DOMFileList.mm >@@ -47,7 +47,7 @@ - (void)dealloc > return; > > if (_internal) >- IMPL->deref(); >+ IMPL->deref(DEREF_DEFAULT_ARGUMENTS); > [super dealloc]; > } > >diff --git a/Source/WebKitLegacy/mac/DOM/DOMHTMLCollection.mm b/Source/WebKitLegacy/mac/DOM/DOMHTMLCollection.mm >index 7fe73819bdd..f0c7ded158d 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOMHTMLCollection.mm >+++ b/Source/WebKitLegacy/mac/DOM/DOMHTMLCollection.mm >@@ -50,7 +50,7 @@ - (void)dealloc > return; > > if (_internal) >- IMPL->deref(); >+ IMPL->deref(DEREF_DEFAULT_ARGUMENTS); > [super dealloc]; > } > >diff --git a/Source/WebKitLegacy/mac/DOM/DOMHTMLOptionsCollection.mm b/Source/WebKitLegacy/mac/DOM/DOMHTMLOptionsCollection.mm >index fdfa6e8fc33..f0a127e4785 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOMHTMLOptionsCollection.mm >+++ b/Source/WebKitLegacy/mac/DOM/DOMHTMLOptionsCollection.mm >@@ -51,7 +51,7 @@ - (void)dealloc > return; > > if (_internal) >- IMPL->deref(); >+ IMPL->deref(DEREF_DEFAULT_ARGUMENTS); > [super dealloc]; > } > >diff --git a/Source/WebKitLegacy/mac/DOM/DOMImplementation.mm b/Source/WebKitLegacy/mac/DOM/DOMImplementation.mm >index 7442ea9ade0..2475aa3f479 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOMImplementation.mm >+++ b/Source/WebKitLegacy/mac/DOM/DOMImplementation.mm >@@ -53,7 +53,7 @@ - (void)dealloc > if (WebCoreObjCScheduleDeallocateOnMainThread([DOMImplementation class], self)) > return; > if (_internal) >- unwrap(*self).deref(); >+ unwrap(*self).deref(DEREF_DEFAULT_ARGUMENTS); > [super dealloc]; > } > >diff --git a/Source/WebKitLegacy/mac/DOM/DOMMediaError.mm b/Source/WebKitLegacy/mac/DOM/DOMMediaError.mm >index 139556c55aa..6ffa625ed62 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOMMediaError.mm >+++ b/Source/WebKitLegacy/mac/DOM/DOMMediaError.mm >@@ -51,7 +51,7 @@ - (void)dealloc > return; > > if (_internal) >- IMPL->deref(); >+ IMPL->deref(DEREF_DEFAULT_ARGUMENTS); > [super dealloc]; > } > >diff --git a/Source/WebKitLegacy/mac/DOM/DOMMediaList.mm b/Source/WebKitLegacy/mac/DOM/DOMMediaList.mm >index 2df34205b6b..eede6d2ef82 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOMMediaList.mm >+++ b/Source/WebKitLegacy/mac/DOM/DOMMediaList.mm >@@ -48,7 +48,7 @@ - (void)dealloc > return; > > if (_internal) >- IMPL->deref(); >+ IMPL->deref(DEREF_DEFAULT_ARGUMENTS); > [super dealloc]; > } > >diff --git a/Source/WebKitLegacy/mac/DOM/DOMNamedNodeMap.mm b/Source/WebKitLegacy/mac/DOM/DOMNamedNodeMap.mm >index 5dd39564dd4..433410145bd 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOMNamedNodeMap.mm >+++ b/Source/WebKitLegacy/mac/DOM/DOMNamedNodeMap.mm >@@ -47,7 +47,7 @@ - (void)dealloc > return; > > if (_internal) >- IMPL->deref(); >+ IMPL->deref(DEREF_DEFAULT_ARGUMENTS); > [super dealloc]; > } > >diff --git a/Source/WebKitLegacy/mac/DOM/DOMNode.mm b/Source/WebKitLegacy/mac/DOM/DOMNode.mm >index ec130f4f463..07c552e0ca6 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOMNode.mm >+++ b/Source/WebKitLegacy/mac/DOM/DOMNode.mm >@@ -78,7 +78,7 @@ - (void)dealloc > if (WebCoreObjCScheduleDeallocateOnMainThread([DOMNode class], self)) > return; > if (_internal) >- unwrap(*self).deref(); >+ unwrap(*self).deref(DEREF_DEFAULT_ARGUMENTS); > [super dealloc]; > } > >diff --git a/Source/WebKitLegacy/mac/DOM/DOMNodeIterator.mm b/Source/WebKitLegacy/mac/DOM/DOMNodeIterator.mm >index 6cb2b242e68..1973d154074 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOMNodeIterator.mm >+++ b/Source/WebKitLegacy/mac/DOM/DOMNodeIterator.mm >@@ -51,7 +51,7 @@ - (void)dealloc > > if (_internal) { > [self detach]; >- IMPL->deref(); >+ IMPL->deref(DEREF_DEFAULT_ARGUMENTS); > }; > [super dealloc]; > } >diff --git a/Source/WebKitLegacy/mac/DOM/DOMNodeList.mm b/Source/WebKitLegacy/mac/DOM/DOMNodeList.mm >index 1bbf01bf794..6fef2591bff 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOMNodeList.mm >+++ b/Source/WebKitLegacy/mac/DOM/DOMNodeList.mm >@@ -46,7 +46,7 @@ - (void)dealloc > return; > > if (_internal) >- IMPL->deref(); >+ IMPL->deref(DEREF_DEFAULT_ARGUMENTS); > [super dealloc]; > } > >diff --git a/Source/WebKitLegacy/mac/DOM/DOMRGBColor.mm b/Source/WebKitLegacy/mac/DOM/DOMRGBColor.mm >index 8ab7a52e874..48a198883c9 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOMRGBColor.mm >+++ b/Source/WebKitLegacy/mac/DOM/DOMRGBColor.mm >@@ -53,7 +53,7 @@ - (void)dealloc > return; > > if (_internal) >- IMPL->deref(); >+ IMPL->deref(DEREF_DEFAULT_ARGUMENTS); > [super dealloc]; > } > >diff --git a/Source/WebKitLegacy/mac/DOM/DOMRange.mm b/Source/WebKitLegacy/mac/DOM/DOMRange.mm >index 24f85f71f6e..86d28d3446c 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOMRange.mm >+++ b/Source/WebKitLegacy/mac/DOM/DOMRange.mm >@@ -49,7 +49,7 @@ - (void)dealloc > return; > > if (_internal) >- IMPL->deref(); >+ IMPL->deref(DEREF_DEFAULT_ARGUMENTS); > [super dealloc]; > } > >diff --git a/Source/WebKitLegacy/mac/DOM/DOMRect.mm b/Source/WebKitLegacy/mac/DOM/DOMRect.mm >index 58bbcd57664..fa13d9e40f9 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOMRect.mm >+++ b/Source/WebKitLegacy/mac/DOM/DOMRect.mm >@@ -47,7 +47,7 @@ - (void)dealloc > return; > > if (_internal) >- IMPL->deref(); >+ IMPL->deref(DEREF_DEFAULT_ARGUMENTS); > [super dealloc]; > } > >diff --git a/Source/WebKitLegacy/mac/DOM/DOMStyleSheet.mm b/Source/WebKitLegacy/mac/DOM/DOMStyleSheet.mm >index 526ad97ec03..3c676b05e55 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOMStyleSheet.mm >+++ b/Source/WebKitLegacy/mac/DOM/DOMStyleSheet.mm >@@ -51,7 +51,7 @@ - (void)dealloc > return; > > if (_internal) >- IMPL->deref(); >+ IMPL->deref(DEREF_DEFAULT_ARGUMENTS); > [super dealloc]; > } > >diff --git a/Source/WebKitLegacy/mac/DOM/DOMStyleSheetList.mm b/Source/WebKitLegacy/mac/DOM/DOMStyleSheetList.mm >index a0539a6e85d..2923242594f 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOMStyleSheetList.mm >+++ b/Source/WebKitLegacy/mac/DOM/DOMStyleSheetList.mm >@@ -49,7 +49,7 @@ - (void)dealloc > return; > > if (_internal) >- IMPL->deref(); >+ IMPL->deref(DEREF_DEFAULT_ARGUMENTS); > [super dealloc]; > } > >diff --git a/Source/WebKitLegacy/mac/DOM/DOMTimeRanges.mm b/Source/WebKitLegacy/mac/DOM/DOMTimeRanges.mm >index f0836202dcb..6dea7d44da9 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOMTimeRanges.mm >+++ b/Source/WebKitLegacy/mac/DOM/DOMTimeRanges.mm >@@ -50,7 +50,7 @@ - (void)dealloc > return; > > if (_internal) >- IMPL->deref(); >+ IMPL->deref(DEREF_DEFAULT_ARGUMENTS); > [super dealloc]; > } > >diff --git a/Source/WebKitLegacy/mac/DOM/DOMTokenList.mm b/Source/WebKitLegacy/mac/DOM/DOMTokenList.mm >index a7196c6d023..0f41abd5ff8 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOMTokenList.mm >+++ b/Source/WebKitLegacy/mac/DOM/DOMTokenList.mm >@@ -47,7 +47,7 @@ - (void)dealloc > return; > > if (_internal) >- IMPL->deref(); >+ IMPL->deref(DEREF_DEFAULT_ARGUMENTS); > [super dealloc]; > } > >diff --git a/Source/WebKitLegacy/mac/DOM/DOMTreeWalker.mm b/Source/WebKitLegacy/mac/DOM/DOMTreeWalker.mm >index de0419fe9d1..f25a9b203c9 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOMTreeWalker.mm >+++ b/Source/WebKitLegacy/mac/DOM/DOMTreeWalker.mm >@@ -48,7 +48,7 @@ - (void)dealloc > return; > > if (_internal) >- IMPL->deref(); >+ IMPL->deref(DEREF_DEFAULT_ARGUMENTS); > [super dealloc]; > } > >diff --git a/Source/WebKitLegacy/mac/DOM/DOMXPath.mm b/Source/WebKitLegacy/mac/DOM/DOMXPath.mm >index 53dc22de1ea..0cc5f0b9b6f 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOMXPath.mm >+++ b/Source/WebKitLegacy/mac/DOM/DOMXPath.mm >@@ -41,14 +41,14 @@ @implementation DOMNativeXPathNSResolver > - (void)dealloc > { > if (_internal) >- IMPL->deref(); >+ IMPL->deref(DEREF_DEFAULT_ARGUMENTS); > [super dealloc]; > } > > - (void)finalize > { > if (_internal) >- IMPL->deref(); >+ IMPL->deref(DEREF_DEFAULT_ARGUMENTS); > [super finalize]; > } > >diff --git a/Source/WebKitLegacy/mac/DOM/DOMXPathExpression.mm b/Source/WebKitLegacy/mac/DOM/DOMXPathExpression.mm >index 0e0e0695763..e2de5befe3b 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOMXPathExpression.mm >+++ b/Source/WebKitLegacy/mac/DOM/DOMXPathExpression.mm >@@ -48,7 +48,7 @@ - (void)dealloc > return; > > if (_internal) >- IMPL->deref(); >+ IMPL->deref(DEREF_DEFAULT_ARGUMENTS); > [super dealloc]; > } > >diff --git a/Source/WebKitLegacy/mac/DOM/DOMXPathResult.mm b/Source/WebKitLegacy/mac/DOM/DOMXPathResult.mm >index 9e21ffc81ad..a4929493da8 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOMXPathResult.mm >+++ b/Source/WebKitLegacy/mac/DOM/DOMXPathResult.mm >@@ -47,7 +47,7 @@ - (void)dealloc > return; > > if (_internal) >- IMPL->deref(); >+ IMPL->deref(DEREF_DEFAULT_ARGUMENTS); > [super dealloc]; > } > >diff --git a/Source/WebKitLegacy/mac/History/WebBackForwardList.mm b/Source/WebKitLegacy/mac/History/WebBackForwardList.mm >index 78e30f9fbe0..0260acfa4ee 100644 >--- a/Source/WebKitLegacy/mac/History/WebBackForwardList.mm >+++ b/Source/WebKitLegacy/mac/History/WebBackForwardList.mm >@@ -120,7 +120,7 @@ - (void)dealloc > if (backForwardList) { > ASSERT(backForwardList->closed()); > backForwardLists().remove(backForwardList); >- backForwardList->deref(); >+ backForwardList->deref(DEREF_DEFAULT_ARGUMENTS); > } > > [super dealloc]; >diff --git a/Source/WebKitLegacy/mac/WebCoreSupport/WebSecurityOrigin.mm b/Source/WebKitLegacy/mac/WebCoreSupport/WebSecurityOrigin.mm >index 4e4c13dfb73..c3c12515472 100644 >--- a/Source/WebKitLegacy/mac/WebCoreSupport/WebSecurityOrigin.mm >+++ b/Source/WebKitLegacy/mac/WebCoreSupport/WebSecurityOrigin.mm >@@ -104,7 +104,7 @@ - (BOOL)isEqual:(id)anObject > - (void)dealloc > { > if (_private) >- reinterpret_cast<SecurityOrigin*>(_private)->deref(); >+ reinterpret_cast<SecurityOrigin*>(_private)->deref(DEREF_DEFAULT_ARGUMENTS); > if (_applicationCacheQuotaManager) > [(NSObject *)_applicationCacheQuotaManager release]; > if (_databaseQuotaManager) >diff --git a/Tools/DumpRenderTree/TestRunner.cpp b/Tools/DumpRenderTree/TestRunner.cpp >index f8ad9515174..9a39781cdfb 100644 >--- a/Tools/DumpRenderTree/TestRunner.cpp >+++ b/Tools/DumpRenderTree/TestRunner.cpp >@@ -2051,7 +2051,7 @@ static JSValueRef runUIScriptCallback(JSContextRef context, JSObjectRef, JSObjec > static void testRunnerObjectFinalize(JSObjectRef object) > { > TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(object)); >- controller->deref(); >+ controller->deref(DEREF_DEFAULT_ARGUMENTS); > } > > // Object Creation >diff --git a/Tools/DumpRenderTree/mac/DumpRenderTree.mm b/Tools/DumpRenderTree/mac/DumpRenderTree.mm >index 1f7202f78c4..f4d06e81a99 100644 >--- a/Tools/DumpRenderTree/mac/DumpRenderTree.mm >+++ b/Tools/DumpRenderTree/mac/DumpRenderTree.mm >@@ -1228,6 +1228,10 @@ static void dumpLiveDocuments() > WTFLogAlways("%u live documents:", WebCore::Document::allDocuments().size()); > for (const auto* document : WebCore::Document::allDocuments()) { > WTFLogAlways("Document %p (refCount %d, referencingNodeCount %u) %s", document, document->refCount(), document->referencingNodeCount(), document->url().string().utf8().data()); >+ >+ WTFLogAlways("Document %p reference stacks:\n"); >+ document->refTracker().dumpRemainingReferences(); >+ WTFLogAlways("\n"); > } > } > >diff --git a/Tools/TestRunnerShared/Bindings/JSWrapper.cpp b/Tools/TestRunnerShared/Bindings/JSWrapper.cpp >index 6f47c1062ee..fa45af5a30c 100644 >--- a/Tools/TestRunnerShared/Bindings/JSWrapper.cpp >+++ b/Tools/TestRunnerShared/Bindings/JSWrapper.cpp >@@ -74,7 +74,7 @@ void JSWrapper::finalize(JSObjectRef object) > JSWrappable* wrappable = unwrapObject(object); > if (!wrappable) > return; >- wrappable->deref(); >+ wrappable->deref(DEREF_DEFAULT_ARGUMENTS); > } > > } // namespace WTR
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186269
:
341904
|
348580
|
348584
|
348586
|
348588
|
348589
|
348592
|
348595
|
348596
|
348605
|
348606
|
348608
|
348610
|
348613
|
348614
|
348632
|
348640