2015-12-18 22:22:01 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2020-04-08 10:12:33 +00:00
|
|
|
#include "nsString.h"
|
Bug 1733308 - Fix non-unified builds errors in xpcom/base. r=xpcom-reviewers,mccr8
objdir/dist/include/mozilla/DeferredFinalize.h:30:1: error: unknown type name 'MOZ_NEVER_INLINE'
objdir/dist/include/mozilla/dom/BindingUtils.h:2776:5: error: no matching function for call to 'DeferredFinalize'
xpcom/base/AvailableMemoryTracker.cpp:55,40:: error: expected class name
xpcom/base/AvailableMemoryTracker.cpp:59,3:: error: 'AddRef' marked 'override' but does not override any member functions
xpcom/base/AvailableMemoryTracker.cpp:59,3:: error: 'QueryInterface' marked 'override' but does not override any member functions
xpcom/base/AvailableMemoryTracker.cpp:59,3:: error: 'Release' marked 'override' but does not override any member functions
xpcom/base/AvailableMemoryTracker.cpp:61,29:: error: unknown type name 'nsIHandleReportCallback'
xpcom/base/AvailableMemoryTracker.cpp:65,37:: error: use of undeclared identifier 'KIND_OTHER'
xpcom/base/AvailableMemoryTracker.cpp:65,49:: error: use of undeclared identifier 'UNITS_COUNT_CUMULATIVE'
xpcom/base/AvailableMemoryTracker.cpp:77,1:: error: invalid application of 'sizeof' to an incomplete type 'const QITableEntry []'
xpcom/base/AvailableMemoryTracker.cpp:77,1:: error: static_cast from '(anonymous namespace)::LowEventsReporter *' to 'nsISupports *', which are not related by inheritance, is not allowed
xpcom/base/AvailableMemoryTracker.cpp:77,38:: error: unknown type name 'nsIMemoryReporter'
xpcom/base/AvailableMemoryTracker.cpp:77,38:: error: use of undeclared identifier 'nsIMemoryReporter'
xpcom/base/AvailableMemoryTracker.cpp:187,3:: error: use of undeclared identifier 'RegisterLowMemoryEventsPhysicalDistinguishedAmount'
xpcom/base/AvailableMemoryWatcherWin.cpp:31,47:: error: base class has incomplete type
xpcom/base/AvailableMemoryWatcherWin.cpp:37,3:: error: unknown type name 'NS_DECL_NSIOBSERVER'
xpcom/base/AvailableMemoryWatcherWin.cpp:38,3:: error: 'virtual' can only appear on non-static member functions
xpcom/base/AvailableMemoryWatcherWin.cpp:38,3:: error: expected ';' at end of declaration list
xpcom/base/AvailableMemoryWatcherWin.cpp:38,3:: error: static_assert failed due to requirement 'std::is_convertible<mozilla::nsAvailableMemoryWatcher *, nsINamed *>::value' "nsITimerCallback implementations must also implement nsINamed"
xpcom/base/AvailableMemoryWatcherWin.cpp:39,3:: error: must use 'enum' tag to refer to type 'nsresult' in this scope
xpcom/base/AvailableMemoryWatcherWin.cpp:42,3:: error: must use 'enum' tag to refer to type 'nsresult' in this scope
xpcom/base/AvailableMemoryWatcherWin.cpp:102,1:: error: cannot initialize object parameter of type 'mozilla::nsAvailableMemoryWatcherBase' with an expression of type 'mozilla::nsAvailableMemoryWatcher'
xpcom/base/AvailableMemoryWatcherWin.cpp:102,1:: error: invalid application of 'sizeof' to an incomplete type 'const QITableEntry []'
xpcom/base/AvailableMemoryWatcherWin.cpp:102,1:: error: must use 'enum' tag to refer to type 'nsresult' in this scope
xpcom/base/AvailableMemoryWatcherWin.cpp:102,1:: error: static_cast from 'mozilla::nsAvailableMemoryWatcher *' to 'nsINamed *', which are not related by inheritance, is not allowed
xpcom/base/AvailableMemoryWatcherWin.cpp:102,1:: error: static_cast from 'mozilla::nsAvailableMemoryWatcher *' to 'nsIObserver *', which are not related by inheritance, is not allowed
xpcom/base/AvailableMemoryWatcherWin.cpp:102,1:: error: static_cast from 'mozilla::nsAvailableMemoryWatcher *' to 'nsITimerCallback *', which are not related by inheritance, is not allowed
xpcom/base/AvailableMemoryWatcherWin.cpp:103,59:: error: 'nsIObserver' does not refer to a value
xpcom/base/AvailableMemoryWatcherWin.cpp:103,59:: error: incomplete type 'nsIObserver' named in nested name specifier
xpcom/base/AvailableMemoryWatcherWin.cpp:140,45:: error: cannot initialize a parameter of type 'nsIObserver *' with an rvalue of type 'mozilla::nsAvailableMemoryWatcher *'
xpcom/base/AvailableMemoryWatcherWin.cpp:140,5:: error: must use 'enum' tag to refer to type 'nsresult' in this scope
xpcom/base/CycleCollectedJSRuntime.cpp:1605,7:: error: use of undeclared identifier 'PR_GetEnv'
xpcom/base/CycleCollectedJSRuntime.cpp:1605:7: error: use of undeclared identifier 'PR_GetEnv'
xpcom/base/DeferredFinalize.cpp:12,15:: error: out-of-line definition of 'DeferredFinalize' does not match any declaration in namespace 'mozilla'
xpcom/base/DeferredFinalize.cpp:12:15: error: out-of-line definition of 'DeferredFinalize' does not match any declaration in namespace 'mozilla'
xpcom/base/MemoryTelemetry.cpp:48,27:: error: unused variable 'kTotalMemoryCollectorTimeout' [-Werror,-Wunused-const-variable]
xpcom/base/MemoryTelemetry.cpp:48:27: error: unused variable 'kTotalMemoryCollectorTimeout' [-Werror,-Wunused-const-variable]
xpcom/base/nsErrorService.cpp:42,21:: error: use of function template name with no prior declaration in function call with explicit template arguments is a C++20 extension [-Werror,-Wc++20-extensions]
xpcom/base/nsErrorService.cpp:42,21:: error: use of undeclared identifier 'MakeUnique'; did you mean 'mozilla::MakeUnique'?
xpcom/base/nsErrorService.cpp:42:21: error: use of function template name with no prior declaration in function call with explicit template arguments is a C++20 extension [-Werror,-Wc++20-extensions]
xpcom/base/nsErrorService.cpp:42:21: error: use of undeclared identifier 'MakeUnique'; did you mean 'mozilla::MakeUnique'?
xpcom/base/nsMacPreferencesReader.mm:20:12: error: implicit instantiation of undefined template 'nsTSubstring<char16_t>'
xpcom/base/nsMacPreferencesReader.mm:24:60: error: use of undeclared identifier 'NSString'
xpcom/base/nsMacPreferencesReader.mm:24:69: error: expected expression
xpcom/base/nsMacPreferencesReader.mm:26:48: error: unknown type name 'NSArray'
xpcom/base/nsMacPreferencesReader.mm:28:30: error: use of undeclared identifier 'NSString'
xpcom/base/nsMacPreferencesReader.mm:29:30: error: no matching function for call to 'MakeStringSpan'
xpcom/base/nsMacPreferencesReader.mm:29:51: error: instance method '-UTF8String' not found (return type defaults to 'id') [-Werror,-Wobjc-method-access]
xpcom/base/nsMacPreferencesReader.mm:30:22: error: instance method '-isKindOfClass:' not found (return type defaults to 'id') [-Werror,-Wobjc-method-access]
xpcom/base/nsMacPreferencesReader.mm:30:37: error: receiver type 'int (*)(int)' is not 'id' or interface pointer, consider casting it to 'id' [-Werror,-Wreceiver-expr]
xpcom/base/nsMacPreferencesReader.mm:30:37: error: use of undeclared identifier 'NSNumber'; did you mean 'isnumber'?
xpcom/base/nsMacPreferencesReader.mm:30:46: error: instance method '-class' not found (return type defaults to 'id') [-Werror,-Wobjc-method-access]
xpcom/base/nsMacPreferencesReader.mm:31:27: error: cannot initialize a parameter of type 'int64_t' (aka 'long long') with an rvalue of type 'id'
xpcom/base/nsMacPreferencesReader.mm:31:33: error: instance method '-longLongValue' not found (return type defaults to 'id') [-Werror,-Wobjc-method-access]
xpcom/base/nsMacPreferencesReader.mm:32:37: error: use of undeclared identifier 'NSArray'
xpcom/base/nsMacPreferencesReader.mm:34:7: error: no matching function for call to 'EvaluateArray'
xpcom/base/nsMacPreferencesReader.mm:36:37: error: use of undeclared identifier 'NSDictionary'
xpcom/base/nsMacPreferencesReader.mm:38:7: error: no matching function for call to 'EvaluateDict'
xpcom/base/nsMacPreferencesReader.mm:44:60: error: use of undeclared identifier 'NSString'
xpcom/base/nsMacPreferencesReader.mm:44:69: error: expected expression
xpcom/base/nsSystemInfo.cpp:415,35:: error: no template named 'NotNull'; did you mean 'NonNull'?
xpcom/base/nsSystemInfo.cpp:419,25:: error: member reference type 'NonNull<IWSCProductList *>' is not a pointer; did you mean to use '.'?
xpcom/base/nsSystemInfo.cpp:419,27:: error: no member named 'get_Count' in 'mozilla::dom::NonNull<IWSCProductList *>'
xpcom/base/nsSystemInfo.cpp:426,19:: error: member reference type 'NonNull<IWSCProductList *>' is not a pointer; did you mean to use '.'?
xpcom/base/nsSystemInfo.cpp:426,21:: error: no member named 'get_Item' in 'mozilla::dom::NonNull<IWSCProductList *>'
xpcom/base/nsSystemInfo.cpp:484,17:: error: use of undeclared identifier 'ArrayLength'; did you mean 'mozilla::ArrayLength'?
xpcom/base/nsSystemInfo.cpp:484,47:: error: use of undeclared identifier 'ArrayLength'; did you mean 'mozilla::ArrayLength'?
xpcom/base/nsSystemInfo.cpp:487,36:: error: use of undeclared identifier 'ArrayLength'; did you mean 'mozilla::ArrayLength'?
xpcom/base/nsSystemInfo.cpp:500,10:: error: no matching function for call to 'EnumWSCProductList'
xpcom/base/nsSystemInfo.cpp:500,46:: error: use of undeclared identifier 'WrapNotNull'; did you mean 'mozilla::WrapNotNull'?
xpcom/base/nsTraceRefcnt.cpp:313,32:: error: use of undeclared identifier 'MakeUnique'
xpcom/base/nsTraceRefcnt.cpp:313:32: error: use of undeclared identifier 'MakeUnique'
xpcom/base/nsTraceRefcnt.cpp:461,19:: error: no matching member function for call to 'WithEntryHandle'
xpcom/base/nsTraceRefcnt.cpp:461:19: error: no matching member function for call to 'WithEntryHandle'
xpcom/base/nsTraceRefcnt.cpp:468,33:: error: use of function template name with no prior declaration in function call with explicit template arguments is a C++20 extension [-Werror,-Wc++20-extensions]
xpcom/base/nsTraceRefcnt.cpp:468,33:: error: use of undeclared identifier 'MakeUnique'
xpcom/base/nsTraceRefcnt.cpp:468:33: error: use of undeclared identifier 'MakeUnique'
xpcom/base/nsTraceRefcnt.cpp:736,20:: error: use of undeclared identifier '_write'
Differential Revision: https://phabricator.services.mozilla.com/D127036
2021-10-01 01:49:16 +00:00
|
|
|
#include "nsWrapperCacheInlines.h"
|
2015-12-18 22:22:01 +00:00
|
|
|
#include "jsapi.h"
|
|
|
|
#include "jsfriendapi.h"
|
|
|
|
|
|
|
|
void CycleCollectionNoteEdgeNameImpl(
|
|
|
|
nsCycleCollectionTraversalCallback& aCallback, const char* aName,
|
|
|
|
uint32_t aFlags) {
|
|
|
|
nsAutoCString arrayEdgeName(aName);
|
|
|
|
if (aFlags & CycleCollectionEdgeNameArrayFlag) {
|
|
|
|
arrayEdgeName.AppendLiteral("[i]");
|
|
|
|
}
|
|
|
|
aCallback.NoteNextEdgeName(arrayEdgeName.get());
|
|
|
|
}
|
|
|
|
|
2017-01-03 19:46:49 +00:00
|
|
|
void nsCycleCollectionParticipant::NoteJSChild(JS::GCCellPtr aGCThing,
|
|
|
|
const char* aName,
|
|
|
|
void* aClosure) {
|
2015-12-18 22:22:01 +00:00
|
|
|
nsCycleCollectionTraversalCallback* cb =
|
|
|
|
static_cast<nsCycleCollectionTraversalCallback*>(aClosure);
|
|
|
|
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(*cb, aName);
|
2018-11-15 09:11:10 +00:00
|
|
|
if (JS::IsCCTraceKind(aGCThing.kind())) {
|
2016-09-23 22:42:13 +00:00
|
|
|
cb->NoteJSChild(aGCThing);
|
2015-12-18 22:22:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void TraceCallbackFunc::Trace(JS::Heap<JS::Value>* aPtr, const char* aName,
|
|
|
|
void* aClosure) const {
|
2016-12-26 15:40:21 +00:00
|
|
|
if (aPtr->unbarrieredGet().isGCThing()) {
|
2021-02-03 20:13:10 +00:00
|
|
|
mCallback(aPtr->unbarrieredGet().toGCCellPtr(), aName, aClosure);
|
2015-12-18 22:22:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void TraceCallbackFunc::Trace(JS::Heap<jsid>* aPtr, const char* aName,
|
|
|
|
void* aClosure) const {
|
2020-04-26 17:03:01 +00:00
|
|
|
if (aPtr->unbarrieredGet().isGCThing()) {
|
2020-04-26 17:02:30 +00:00
|
|
|
mCallback(aPtr->unbarrieredGet().toGCCellPtr(), aName, aClosure);
|
2015-12-18 22:22:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void TraceCallbackFunc::Trace(JS::Heap<JSObject*>* aPtr, const char* aName,
|
|
|
|
void* aClosure) const {
|
2016-02-07 17:08:55 +00:00
|
|
|
if (*aPtr) {
|
|
|
|
mCallback(JS::GCCellPtr(aPtr->unbarrieredGet()), aName, aClosure);
|
2016-02-22 18:11:02 +00:00
|
|
|
}
|
2015-12-18 22:22:01 +00:00
|
|
|
}
|
|
|
|
|
2019-10-09 14:34:16 +00:00
|
|
|
void TraceCallbackFunc::Trace(nsWrapperCache* aPtr, const char* aName,
|
2015-12-31 13:21:49 +00:00
|
|
|
void* aClosure) const {
|
2019-10-09 14:34:16 +00:00
|
|
|
JSObject* obj = aPtr->GetWrapperPreserveColor();
|
|
|
|
if (obj) {
|
|
|
|
mCallback(JS::GCCellPtr(obj), aName, aClosure);
|
2016-02-22 18:11:02 +00:00
|
|
|
}
|
2015-12-31 13:21:49 +00:00
|
|
|
}
|
|
|
|
|
2015-12-18 22:22:01 +00:00
|
|
|
void TraceCallbackFunc::Trace(JS::TenuredHeap<JSObject*>* aPtr,
|
|
|
|
const char* aName, void* aClosure) const {
|
2016-10-07 11:58:37 +00:00
|
|
|
if (*aPtr) {
|
|
|
|
mCallback(JS::GCCellPtr(aPtr->unbarrieredGetPtr()), aName, aClosure);
|
2016-02-22 18:11:02 +00:00
|
|
|
}
|
2015-12-18 22:22:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void TraceCallbackFunc::Trace(JS::Heap<JSFunction*>* aPtr, const char* aName,
|
|
|
|
void* aClosure) const {
|
2016-02-07 17:08:55 +00:00
|
|
|
if (*aPtr) {
|
|
|
|
mCallback(JS::GCCellPtr(aPtr->unbarrieredGet()), aName, aClosure);
|
2016-02-22 18:11:02 +00:00
|
|
|
}
|
2015-12-18 22:22:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void TraceCallbackFunc::Trace(JS::Heap<JSString*>* aPtr, const char* aName,
|
|
|
|
void* aClosure) const {
|
2016-02-07 17:08:55 +00:00
|
|
|
if (*aPtr) {
|
|
|
|
mCallback(JS::GCCellPtr(aPtr->unbarrieredGet()), aName, aClosure);
|
2016-02-22 18:11:02 +00:00
|
|
|
}
|
2015-12-18 22:22:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void TraceCallbackFunc::Trace(JS::Heap<JSScript*>* aPtr, const char* aName,
|
|
|
|
void* aClosure) const {
|
2016-02-07 17:08:55 +00:00
|
|
|
if (*aPtr) {
|
|
|
|
mCallback(JS::GCCellPtr(aPtr->unbarrieredGet()), aName, aClosure);
|
2016-02-22 18:11:02 +00:00
|
|
|
}
|
2015-12-18 22:22:01 +00:00
|
|
|
}
|