1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "PerformanceEntry.h"
8 #include "MainThreadUtils.h"
10 using namespace mozilla::dom
;
12 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(PerformanceEntry
, mParent
)
14 NS_IMPL_CYCLE_COLLECTING_ADDREF(PerformanceEntry
)
15 NS_IMPL_CYCLE_COLLECTING_RELEASE(PerformanceEntry
)
17 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(PerformanceEntry
)
18 NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
19 NS_INTERFACE_MAP_ENTRY(nsISupports
)
22 PerformanceEntry::PerformanceEntry(nsISupports
* aParent
, const nsAString
& aName
,
23 const nsAString
& aEntryType
)
25 mName(NS_Atomize(aName
)),
26 mEntryType(NS_Atomize(aEntryType
)) {}
28 PerformanceEntry::~PerformanceEntry() = default;
30 size_t PerformanceEntry::SizeOfExcludingThis(
31 mozilla::MallocSizeOf aMallocSizeOf
) const {
32 // mName and mEntryType are considered to be owned by nsAtomTable.
36 size_t PerformanceEntry::SizeOfIncludingThis(
37 mozilla::MallocSizeOf aMallocSizeOf
) const {
38 return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf
);
41 bool PerformanceEntry::ShouldAddEntryToObserverBuffer(
42 PerformanceObserverInit
& aOption
) const {
43 if (aOption
.mType
.WasPassed()) {
44 if (GetEntryType()->Equals(aOption
.mType
.Value())) {
48 if (aOption
.mEntryTypes
.Value().Contains(
49 nsDependentAtomString(GetEntryType()))) {