diff options
Diffstat (limited to 'xpcom')
-rw-r--r-- | xpcom/base/CycleCollectedJSContext.cpp | 4 | ||||
-rw-r--r-- | xpcom/base/nsCycleCollector.cpp | 19 | ||||
-rw-r--r-- | xpcom/base/nsMemoryReporterManager.cpp | 1 | ||||
-rw-r--r-- | xpcom/build/XPCOMInit.cpp | 13 | ||||
-rw-r--r-- | xpcom/components/ManifestParser.cpp | 8 | ||||
-rw-r--r-- | xpcom/glue/Observer.h | 14 | ||||
-rw-r--r-- | xpcom/glue/nsTArray-inl.h | 32 | ||||
-rw-r--r-- | xpcom/glue/nsTArray.h | 126 | ||||
-rw-r--r-- | xpcom/glue/nsTHashtable.h | 4 | ||||
-rw-r--r-- | xpcom/string/nsReadableUtilsImpl.h | 2 | ||||
-rw-r--r-- | xpcom/string/nsTSubstring.h | 83 | ||||
-rw-r--r-- | xpcom/threads/HangMonitor.cpp | 2 |
12 files changed, 241 insertions, 67 deletions
diff --git a/xpcom/base/CycleCollectedJSContext.cpp b/xpcom/base/CycleCollectedJSContext.cpp index 4af8fe4dd..206984656 100644 --- a/xpcom/base/CycleCollectedJSContext.cpp +++ b/xpcom/base/CycleCollectedJSContext.cpp @@ -1537,7 +1537,6 @@ IncrementalFinalizeRunnable::Run() return NS_OK; } - TimeStamp start = TimeStamp::Now(); ReleaseNow(true); if (mDeferredFinalizeFunctions.Length()) { @@ -1547,9 +1546,6 @@ IncrementalFinalizeRunnable::Run() } } - uint32_t duration = (uint32_t)((TimeStamp::Now() - start).ToMilliseconds()); - Telemetry::Accumulate(Telemetry::DEFERRED_FINALIZE_ASYNC, duration); - return NS_OK; } diff --git a/xpcom/base/nsCycleCollector.cpp b/xpcom/base/nsCycleCollector.cpp index b2c15a1dd..7109d85bd 100644 --- a/xpcom/base/nsCycleCollector.cpp +++ b/xpcom/base/nsCycleCollector.cpp @@ -528,15 +528,6 @@ public: #define CC_GRAPH_ASSERT(b) #endif -#define CC_TELEMETRY(_name, _value) \ - PR_BEGIN_MACRO \ - if (NS_IsMainThread()) { \ - Telemetry::Accumulate(Telemetry::CYCLE_COLLECTOR##_name, _value); \ - } else { \ - Telemetry::Accumulate(Telemetry::CYCLE_COLLECTOR_WORKER##_name, _value); \ - } \ - PR_END_MACRO - enum NodeColor { black, white, grey }; // This structure should be kept as small as possible; we may expect @@ -2966,7 +2957,6 @@ nsCycleCollector::ScanWeakMaps() if (failed) { MOZ_ASSERT(false, "Ran out of memory in ScanWeakMaps"); - CC_TELEMETRY(_OOM, true); } } @@ -3109,7 +3099,6 @@ nsCycleCollector::ScanIncrementalRoots() if (failed) { NS_ASSERTION(false, "Ran out of memory in ScanIncrementalRoots"); - CC_TELEMETRY(_OOM, true); } } @@ -3171,7 +3160,6 @@ nsCycleCollector::ScanBlackNodes() if (failed) { NS_ASSERTION(false, "Ran out of memory in ScanBlackNodes"); - CC_TELEMETRY(_OOM, true); } } @@ -3501,7 +3489,6 @@ nsCycleCollector::FixGrayBits(bool aForceGC, TimeLog& aTimeLog) bool needGC = !mJSContext->AreGCGrayBitsValid(); // Only do a telemetry ping for non-shutdown CCs. - CC_TELEMETRY(_NEED_GC, needGC); if (!needGC) { return; } @@ -3537,9 +3524,9 @@ nsCycleCollector::CleanupAfterCollection() mGraph.Clear(); timeLog.Checkpoint("CleanupAfterCollection::mGraph.Clear()"); +#ifdef COLLECT_TIME_DEBUG uint32_t interval = (uint32_t)((TimeStamp::Now() - mCollectionStart).ToMilliseconds()); -#ifdef COLLECT_TIME_DEBUG printf("cc: total cycle collector time was %ums in %u slices\n", interval, mResults.mNumSlices); printf("cc: visited %u ref counted and %u GCed objects, freed %d ref counted and %d GCed objects", @@ -3553,10 +3540,6 @@ nsCycleCollector::CleanupAfterCollection() printf(".\ncc: \n"); #endif - CC_TELEMETRY( , interval); - CC_TELEMETRY(_VISITED_REF_COUNTED, mResults.mVisitedRefCounted); - CC_TELEMETRY(_VISITED_GCED, mResults.mVisitedGCed); - CC_TELEMETRY(_COLLECTED, mWhiteNodeCount); timeLog.Checkpoint("CleanupAfterCollection::telemetry"); if (mJSContext) { diff --git a/xpcom/base/nsMemoryReporterManager.cpp b/xpcom/base/nsMemoryReporterManager.cpp index 2d4f3fa9c..bfeda063b 100644 --- a/xpcom/base/nsMemoryReporterManager.cpp +++ b/xpcom/base/nsMemoryReporterManager.cpp @@ -440,7 +440,6 @@ ResidentDistinguishedAmountHelper(int64_t* aN, bool aDoPurge) { #ifdef HAVE_JEMALLOC_STATS if (aDoPurge) { - Telemetry::AutoTimer<Telemetry::MEMORY_FREE_PURGED_PAGES_MS> timer; jemalloc_purge_freed_pages(); } #endif diff --git a/xpcom/build/XPCOMInit.cpp b/xpcom/build/XPCOMInit.cpp index e8ee5828a..b89f51a98 100644 --- a/xpcom/build/XPCOMInit.cpp +++ b/xpcom/build/XPCOMInit.cpp @@ -123,6 +123,8 @@ extern nsresult nsStringInputStreamConstructor(nsISupports*, REFNSIID, void**); #include "nsMemoryInfoDumper.h" #include "nsSecurityConsoleMessage.h" #include "nsMessageLoop.h" +#include "nss.h" +#include "ssl.h" #include "nsStatusReporterManager.h" @@ -1043,6 +1045,17 @@ ShutdownXPCOM(nsIServiceManager* aServMgr) sInitializedJS = false; } + // At this point all networking threads should have been joined and the + // component manager is shut down. Any remaining objects that hold NSS + // resources (should!) have been released, so we can safely shut down NSS. + if (NSS_IsInitialized()) { + SSL_ClearSessionCache(); + // XXX: It would be nice if we can enforce this shutdown. + if (NSS_Shutdown() != SECSuccess) { + NS_WARNING("NSS Shutdown failed - some resources are still in use"); + } + } + // Release our own singletons // Do this _after_ shutting down the component manager, because the // JS component loader will use XPConnect to call nsIModule::canUnload, diff --git a/xpcom/components/ManifestParser.cpp b/xpcom/components/ManifestParser.cpp index 4dcfc8402..7188c0ec5 100644 --- a/xpcom/components/ManifestParser.cpp +++ b/xpcom/components/ManifestParser.cpp @@ -637,14 +637,6 @@ ParseManifest(NSLocationType aType, FileLocation& aFile, char* aBuf, continue; } -#ifndef MOZ_BINARY_EXTENSIONS - if (directive->apponly && NS_APP_LOCATION != aType) { - LogMessageWithContext(aFile, line, - "Only application manifests may use the '%s' directive.", token); - continue; - } -#endif - if (directive->componentonly && NS_SKIN_LOCATION == aType) { LogMessageWithContext(aFile, line, "Skin manifest not allowed to use '%s' directive.", diff --git a/xpcom/glue/Observer.h b/xpcom/glue/Observer.h index 958e5e4a9..cf9e507dd 100644 --- a/xpcom/glue/Observer.h +++ b/xpcom/glue/Observer.h @@ -7,7 +7,7 @@ #ifndef mozilla_Observer_h #define mozilla_Observer_h -#include "nsTArray.h" +#include "nsTObserverArray.h" namespace mozilla { @@ -48,7 +48,7 @@ public: */ void AddObserver(Observer<T>* aObserver) { - mObservers.AppendElement(aObserver); + mObservers.AppendElementUnlessExists(aObserver); } /** @@ -67,15 +67,15 @@ public: void Broadcast(const T& aParam) { - nsTArray<Observer<T>*> observersCopy(mObservers); - uint32_t size = observersCopy.Length(); - for (uint32_t i = 0; i < size; ++i) { - observersCopy[i]->Notify(aParam); + typename nsTObserverArray<Observer<T>*>::ForwardIterator iter(mObservers); + while (iter.HasMore()) { + Observer<T>* obs = iter.GetNext(); + obs->Notify(aParam); } } protected: - nsTArray<Observer<T>*> mObservers; + nsTObserverArray<Observer<T>*> mObservers; }; } // namespace mozilla diff --git a/xpcom/glue/nsTArray-inl.h b/xpcom/glue/nsTArray-inl.h index af57c9866..7e667a327 100644 --- a/xpcom/glue/nsTArray-inl.h +++ b/xpcom/glue/nsTArray-inl.h @@ -111,6 +111,23 @@ bool IsTwiceTheRequiredBytesRepresentableAsUint32(size_t aCapacity, template<class Alloc, class Copy> template<typename ActualAlloc> typename ActualAlloc::ResultTypeProxy +nsTArray_base<Alloc, Copy>::ExtendCapacity(size_type aLength, + size_type aCount, + size_type aElemSize) +{ + mozilla::CheckedInt<size_type> newLength = aLength; + newLength += aCount; + + if (!newLength.isValid()) { + return ActualAlloc::FailureResult(); + } + + return this->EnsureCapacity<ActualAlloc>(newLength.value(), aElemSize); +} + +template<class Alloc, class Copy> +template<typename ActualAlloc> +typename ActualAlloc::ResultTypeProxy nsTArray_base<Alloc, Copy>::EnsureCapacity(size_type aCapacity, size_type aElemSize) { @@ -275,26 +292,21 @@ nsTArray_base<Alloc, Copy>::ShiftData(index_type aStart, template<class Alloc, class Copy> template<typename ActualAlloc> -bool +typename ActualAlloc::ResultTypeProxy nsTArray_base<Alloc, Copy>::InsertSlotsAt(index_type aIndex, size_type aCount, size_type aElemSize, size_t aElemAlign) { MOZ_ASSERT(aIndex <= Length(), "Bogus insertion index"); - size_type newLen = Length() + aCount; - - EnsureCapacity<ActualAlloc>(newLen, aElemSize); - - // Check for out of memory conditions - if (Capacity() < newLen) { - return false; + if (!ActualAlloc::Successful(this->ExtendCapacity<ActualAlloc>(Length(), aCount, aElemSize))) { + return ActualAlloc::FailureResult(); } - + // Move the existing elements as needed. Note that this will // change our mLength, so no need to call IncrementLength. ShiftData<ActualAlloc>(aIndex, 0, aCount, aElemSize, aElemAlign); - return true; + return ActualAlloc::SuccessResult(); } // nsTArray_base::IsAutoArrayRestorer is an RAII class which takes diff --git a/xpcom/glue/nsTArray.h b/xpcom/glue/nsTArray.h index ca74a41f7..82586a79a 100644 --- a/xpcom/glue/nsTArray.h +++ b/xpcom/glue/nsTArray.h @@ -12,6 +12,7 @@ #include "mozilla/Assertions.h" #include "mozilla/Attributes.h" #include "mozilla/BinarySearch.h" +#include "mozilla/CheckedInt.h" #include "mozilla/fallible.h" #include "mozilla/Function.h" #include "mozilla/MathAlgorithms.h" @@ -19,6 +20,7 @@ #include "mozilla/Move.h" #include "mozilla/ReverseIterator.h" #include "mozilla/TypeTraits.h" +#include "mozilla/Span.h" #include <string.h> @@ -420,6 +422,17 @@ protected: typename ActualAlloc::ResultTypeProxy EnsureCapacity(size_type aCapacity, size_type aElemSize); + // Extend the storage to accommodate aCount extra elements. + // @param aLength The current size of the array. + // @param aCount The number of elements to add. + // @param aElemSize The size of an array element. + // @return False if insufficient memory is available or the new length + // would overflow; true otherwise. + template<typename ActualAlloc> + typename ActualAlloc::ResultTypeProxy ExtendCapacity(size_type aLength, + size_type aCount, + size_type aElemSize); + // Tries to resize the storage to the minimum required amount. If this fails, // the array is left as-is. // @param aElemSize The size of an array element. @@ -461,8 +474,9 @@ protected: // @param aElementSize the size of an array element. // @param aElemAlign the alignment in bytes of an array element. template<typename ActualAlloc> - bool InsertSlotsAt(index_type aIndex, size_type aCount, - size_type aElementSize, size_t aElemAlign); + typename ActualAlloc::ResultTypeProxy + InsertSlotsAt(index_type aIndex, size_type aCount, + size_type aElementSize, size_t aElemAlign); template<typename ActualAlloc, class Allocator> typename ActualAlloc::ResultTypeProxy @@ -1112,6 +1126,18 @@ public: const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } const_reverse_iterator crend() const { return rend(); } + // Span integration + + operator mozilla::Span<elem_type>() + { + return mozilla::Span<elem_type>(Elements(), Length()); + } + + operator mozilla::Span<const elem_type>() const + { + return mozilla::Span<const elem_type>(Elements(), Length()); + } + // // Search methods // @@ -1336,6 +1362,16 @@ protected: return ReplaceElementsAt<Item, ActualAlloc>( aStart, aCount, aArray.Elements(), aArray.Length()); } + + template<class Item, typename ActualAlloc = Alloc> + elem_type* ReplaceElementsAt(index_type aStart, + size_type aCount, + mozilla::Span<const Item> aSpan) + { + return ReplaceElementsAt<Item, ActualAlloc>( + aStart, aCount, aSpan.Elements(), aSpan.Length()); + } + public: template<class Item> @@ -1347,6 +1383,15 @@ public: return ReplaceElementsAt<Item, FallibleAlloc>(aStart, aCount, aArray); } + template<class Item> + MOZ_MUST_USE elem_type* ReplaceElementsAt(index_type aStart, + size_type aCount, + mozilla::Span<const Item> aSpan, + const mozilla::fallible_t&) + { + return ReplaceElementsAt<Item, FallibleAlloc>(aStart, aCount, aSpan); + } + // A variation on the ReplaceElementsAt method defined above. protected: template<class Item, typename ActualAlloc = Alloc> @@ -1399,6 +1444,15 @@ protected: return ReplaceElementsAt<Item, ActualAlloc>( aIndex, 0, aArray.Elements(), aArray.Length()); } + + template<class Item, typename ActualAlloc = Alloc> + elem_type* InsertElementsAt(index_type aIndex, + mozilla::Span<const Item> aSpan) + { + return ReplaceElementsAt<Item, ActualAlloc>( + aIndex, 0, aSpan.Elements(), aSpan.Length()); + } + public: template<class Item, class Allocator> @@ -1425,6 +1479,14 @@ public: return InsertElementAt<FallibleAlloc>(aIndex); } + template<class Item> + MOZ_MUST_USE elem_type* InsertElementsAt(index_type aIndex, + mozilla::Span<const Item> aSpan, + const mozilla::fallible_t&) + { + return InsertElementsAt<Item, FallibleAlloc>(aIndex, aSpan); + } + // Insert a new element, move constructing if possible. protected: template<class Item, typename ActualAlloc = Alloc> @@ -1526,6 +1588,13 @@ protected: template<class Item, typename ActualAlloc = Alloc> elem_type* AppendElements(const Item* aArray, size_type aArrayLen); + template<class Item, typename ActualAlloc = Alloc> + elem_type* AppendElements(mozilla::Span<const Item> aSpan) + { + return AppendElements<Item, FallibleAlloc>(aSpan.Elements(), + aSpan.Length()); + } + public: template<class Item> @@ -1536,6 +1605,15 @@ public: return AppendElements<Item, FallibleAlloc>(aArray, aArrayLen); } + template<class Item> + /* MOZ_MUST_USE */ + elem_type* AppendElements(mozilla::Span<const Item> aSpan, + const mozilla::fallible_t&) + { + return AppendElements<Item, FallibleAlloc>(aSpan.Elements(), + aSpan.Length()); + } + // A variation on the AppendElements method defined above. protected: template<class Item, class Allocator, typename ActualAlloc = Alloc> @@ -1590,8 +1668,8 @@ public: protected: template<typename ActualAlloc = Alloc> elem_type* AppendElements(size_type aCount) { - if (!ActualAlloc::Successful(this->template EnsureCapacity<ActualAlloc>( - Length() + aCount, sizeof(elem_type)))) { + if (!ActualAlloc::Successful(this->template ExtendCapacity<ActualAlloc>( + Length(), aCount, sizeof(elem_type)))) { return nullptr; } elem_type* elems = Elements() + Length(); @@ -1807,9 +1885,8 @@ protected: template<typename ActualAlloc = Alloc> elem_type* InsertElementsAt(index_type aIndex, size_type aCount) { - if (!base_type::template InsertSlotsAt<ActualAlloc>(aIndex, aCount, - sizeof(elem_type), - MOZ_ALIGNOF(elem_type))) { + if (!ActualAlloc::Successful(this->template InsertSlotsAt<ActualAlloc>( + aIndex, aCount, sizeof(elem_type), MOZ_ALIGNOF(elem_type)))) { return nullptr; } @@ -1982,9 +2059,8 @@ auto nsTArray_Impl<E, Alloc>::InsertElementsAt(index_type aIndex, size_type aCount, const Item& aItem) -> elem_type* { - if (!base_type::template InsertSlotsAt<ActualAlloc>(aIndex, aCount, - sizeof(elem_type), - MOZ_ALIGNOF(elem_type))) { + if (!ActualAlloc::Successful(this->template InsertSlotsAt<ActualAlloc>( + aIndex, aCount, sizeof(elem_type), MOZ_ALIGNOF(elem_type)))) { return nullptr; } @@ -2003,6 +2079,7 @@ template<typename ActualAlloc> auto nsTArray_Impl<E, Alloc>::InsertElementAt(index_type aIndex) -> elem_type* { + // Length() + 1 is guaranteed to not overflow, so EnsureCapacity is OK. if (!ActualAlloc::Successful(this->template EnsureCapacity<ActualAlloc>( Length() + 1, sizeof(elem_type)))) { return nullptr; @@ -2019,6 +2096,7 @@ template<class Item, typename ActualAlloc> auto nsTArray_Impl<E, Alloc>::InsertElementAt(index_type aIndex, Item&& aItem) -> elem_type* { + // Length() + 1 is guaranteed to not overflow, so EnsureCapacity is OK. if (!ActualAlloc::Successful(this->template EnsureCapacity<ActualAlloc>( Length() + 1, sizeof(elem_type)))) { return nullptr; @@ -2035,8 +2113,8 @@ template<class Item, typename ActualAlloc> auto nsTArray_Impl<E, Alloc>::AppendElements(const Item* aArray, size_type aArrayLen) -> elem_type* { - if (!ActualAlloc::Successful(this->template EnsureCapacity<ActualAlloc>( - Length() + aArrayLen, sizeof(elem_type)))) { + if (!ActualAlloc::Successful(this->template ExtendCapacity<ActualAlloc>( + Length(), aArrayLen, sizeof(elem_type)))) { return nullptr; } index_type len = Length(); @@ -2058,8 +2136,8 @@ nsTArray_Impl<E, Alloc>::AppendElements(nsTArray_Impl<Item, Allocator>&& aArray) index_type len = Length(); index_type otherLen = aArray.Length(); - if (!Alloc::Successful(this->template EnsureCapacity<Alloc>( - len + otherLen, sizeof(elem_type)))) { + if (!Alloc::Successful(this->template ExtendCapacity<Alloc>( + len, otherLen, sizeof(elem_type)))) { return nullptr; } copy_type::MoveNonOverlappingRegion(Elements() + len, aArray.Elements(), otherLen, @@ -2075,6 +2153,7 @@ template<class Item, typename ActualAlloc> auto nsTArray_Impl<E, Alloc>::AppendElement(Item&& aItem) -> elem_type* { + // Length() + 1 is guaranteed to not overflow, so EnsureCapacity is OK. if (!ActualAlloc::Successful(this->template EnsureCapacity<ActualAlloc>( Length() + 1, sizeof(elem_type)))) { return nullptr; @@ -2347,6 +2426,25 @@ struct nsTArray_CopyChooser<AutoTArray<E, N>> typedef nsTArray_CopyWithConstructors<AutoTArray<E, N>> Type; }; +// Span integration +namespace mozilla { + +template<class ElementType, class TArrayAlloc> +Span<ElementType> +MakeSpan(nsTArray_Impl<ElementType, TArrayAlloc>& aTArray) +{ + return aTArray; +} + +template<class ElementType, class TArrayAlloc> +Span<const ElementType> +MakeSpan(const nsTArray_Impl<ElementType, TArrayAlloc>& aTArray) +{ + return aTArray; +} + +} // namespace mozilla + // Assert that AutoTArray doesn't have any extra padding inside. // // It's important that the data stored in this auto array takes up a multiple of diff --git a/xpcom/glue/nsTHashtable.h b/xpcom/glue/nsTHashtable.h index 705b0294e..830f52e88 100644 --- a/xpcom/glue/nsTHashtable.h +++ b/xpcom/glue/nsTHashtable.h @@ -372,7 +372,7 @@ template<class EntryType> PLDHashNumber nsTHashtable<EntryType>::s_HashKey(const void* aKey) { - return EntryType::HashKey(static_cast<const KeyTypePointer>(aKey)); + return EntryType::HashKey(static_cast<KeyTypePointer>(aKey)); } template<class EntryType> @@ -381,7 +381,7 @@ nsTHashtable<EntryType>::s_MatchEntry(const PLDHashEntryHdr* aEntry, const void* aKey) { return ((const EntryType*)aEntry)->KeyEquals( - static_cast<const KeyTypePointer>(aKey)); + static_cast<KeyTypePointer>(aKey)); } template<class EntryType> diff --git a/xpcom/string/nsReadableUtilsImpl.h b/xpcom/string/nsReadableUtilsImpl.h index ff1497b51..94f18dffc 100644 --- a/xpcom/string/nsReadableUtilsImpl.h +++ b/xpcom/string/nsReadableUtilsImpl.h @@ -18,7 +18,7 @@ inline bool IsASCII(char16_t aChar) { inline const char16_t* aligned(const char16_t* aPtr, const uintptr_t aMask) { return reinterpret_cast<const char16_t*>( - reinterpret_cast<const uintptr_t>(aPtr) & ~aMask); + reinterpret_cast<uintptr_t>(aPtr) & ~aMask); } /** diff --git a/xpcom/string/nsTSubstring.h b/xpcom/string/nsTSubstring.h index a08036b1f..53b4fb9a8 100644 --- a/xpcom/string/nsTSubstring.h +++ b/xpcom/string/nsTSubstring.h @@ -7,6 +7,8 @@ #include "mozilla/Casting.h" #include "mozilla/MemoryReporting.h" +#include "mozilla/IntegerTypeTraits.h" +#include "mozilla/Span.h" #ifndef MOZILLA_INTERNAL_API #error Cannot use internal string classes without MOZILLA_INTERNAL_API defined. Use the frozen header nsStringAPI.h instead. @@ -798,6 +800,68 @@ public: } #endif + /** + * Span integration + */ + + operator mozilla::Span<char_type>() + { + return mozilla::MakeSpan(BeginWriting(), Length()); + } + + operator mozilla::Span<const char_type>() const + { + return mozilla::MakeSpan(BeginReading(), Length()); + } + + void Append(mozilla::Span<const char_type> aSpan) + { + auto len = aSpan.Length(); + MOZ_RELEASE_ASSERT(len <= mozilla::MaxValue<size_type>::value); + Append(aSpan.Elements(), len); + } + + MOZ_MUST_USE bool Append(mozilla::Span<const char_type> aSpan, + const fallible_t& aFallible) + { + auto len = aSpan.Length(); + if (len > mozilla::MaxValue<size_type>::value) { + return false; + } + return Append(aSpan.Elements(), len, aFallible); + } + +#if !defined(CharT_is_PRUnichar) + operator mozilla::Span<uint8_t>() + { + return mozilla::MakeSpan(reinterpret_cast<uint8_t*>(BeginWriting()), + Length()); + } + + operator mozilla::Span<const uint8_t>() const + { + return mozilla::MakeSpan(reinterpret_cast<const uint8_t*>(BeginReading()), + Length()); + } + + void Append(mozilla::Span<const uint8_t> aSpan) + { + auto len = aSpan.Length(); + MOZ_RELEASE_ASSERT(len <= mozilla::MaxValue<size_type>::value); + Append(reinterpret_cast<const char*>(aSpan.Elements()), len); + } + + MOZ_MUST_USE bool Append(mozilla::Span<const uint8_t> aSpan, + const fallible_t& aFallible) + { + auto len = aSpan.Length(); + if (len > mozilla::MaxValue<size_type>::value) { + return false; + } + return Append( + reinterpret_cast<const char*>(aSpan.Elements()), len, aFallible); + } +#endif /** * string data is never null, but can be marked void. if true, the @@ -1184,3 +1248,22 @@ operator>(const nsTSubstring_CharT::base_string_type& aLhs, { return Compare(aLhs, aRhs) > 0; } + +/** + * Span integration + */ +namespace mozilla { + +inline Span<CharT> +MakeSpan(nsTSubstring_CharT& aString) +{ + return aString; +} + +inline Span<const CharT> +MakeSpan(const nsTSubstring_CharT& aString) +{ + return aString; +} + +} // namespace mozilla diff --git a/xpcom/threads/HangMonitor.cpp b/xpcom/threads/HangMonitor.cpp index 6def6ed61..8003ef515 100644 --- a/xpcom/threads/HangMonitor.cpp +++ b/xpcom/threads/HangMonitor.cpp @@ -249,8 +249,6 @@ NotifyActivity(ActivityType aActivityType) // If we have UI activity we should reset the timer and report it if (aActivityType == kUIActivity) { - mozilla::Telemetry::Accumulate(mozilla::Telemetry::EVENTLOOP_UI_ACTIVITY_EXP_MS, - cumulativeUILagMS); cumulativeUILagMS = 0; } |