2015-05-03 22:32:37 +03: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: */
|
2013-10-16 05:35:44 +04:00
|
|
|
/* 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/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_PerformanceEntry_h___
|
|
|
|
#define mozilla_dom_PerformanceEntry_h___
|
|
|
|
|
|
|
|
#include "nsDOMNavigationTiming.h"
|
2015-07-01 16:56:00 +03:00
|
|
|
#include "nsString.h"
|
|
|
|
#include "nsWrapperCache.h"
|
2013-10-16 05:35:44 +04:00
|
|
|
|
2015-05-25 19:53:07 +03:00
|
|
|
class nsISupports;
|
|
|
|
|
2013-10-16 05:35:44 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
2015-08-18 01:13:20 +03:00
|
|
|
class PerformanceResourceTiming;
|
2013-10-16 05:35:44 +04:00
|
|
|
|
|
|
|
// http://www.w3.org/TR/performance-timeline/#performanceentry
|
|
|
|
class PerformanceEntry : public nsISupports, public nsWrapperCache {
|
2014-06-23 23:56:07 +04:00
|
|
|
protected:
|
|
|
|
virtual ~PerformanceEntry();
|
|
|
|
|
2013-10-16 05:35:44 +04:00
|
|
|
public:
|
2015-05-25 19:53:07 +03:00
|
|
|
PerformanceEntry(nsISupports* aParent, const nsAString& aName,
|
2015-02-04 08:46:23 +03:00
|
|
|
const nsAString& aEntryType);
|
2013-10-16 05:35:44 +04:00
|
|
|
|
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(PerformanceEntry)
|
|
|
|
|
2015-05-25 19:53:07 +03:00
|
|
|
nsISupports* GetParentObject() const { return mParent; }
|
2013-10-16 05:35:44 +04:00
|
|
|
|
|
|
|
void GetName(nsAString& aName) const { aName = mName; }
|
|
|
|
|
|
|
|
const nsAString& GetName() const { return mName; }
|
|
|
|
|
|
|
|
void SetName(const nsAString& aName) { mName = aName; }
|
|
|
|
|
|
|
|
void GetEntryType(nsAString& aEntryType) const { aEntryType = mEntryType; }
|
|
|
|
|
|
|
|
const nsAString& GetEntryType() { return mEntryType; }
|
|
|
|
|
|
|
|
void SetEntryType(const nsAString& aEntryType) { mEntryType = aEntryType; }
|
|
|
|
|
|
|
|
virtual DOMHighResTimeStamp StartTime() const { return 0; }
|
|
|
|
|
|
|
|
virtual DOMHighResTimeStamp Duration() const { return 0; }
|
|
|
|
|
2015-08-18 01:13:20 +03:00
|
|
|
virtual const PerformanceResourceTiming* ToResourceTiming() const {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2017-07-27 10:05:51 +03:00
|
|
|
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
|
|
|
|
|
2013-10-16 05:35:44 +04:00
|
|
|
protected:
|
2017-07-27 10:05:51 +03:00
|
|
|
virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
|
|
|
|
|
2017-09-28 09:26:11 +03:00
|
|
|
private:
|
2015-05-25 19:53:07 +03:00
|
|
|
nsCOMPtr<nsISupports> mParent;
|
2013-10-16 05:35:44 +04:00
|
|
|
nsString mName;
|
|
|
|
nsString mEntryType;
|
|
|
|
};
|
|
|
|
|
2017-09-02 15:39:19 +03:00
|
|
|
// Helper classes
|
|
|
|
class MOZ_STACK_CLASS PerformanceEntryComparator final {
|
|
|
|
public:
|
|
|
|
bool Equals(const PerformanceEntry* aElem1,
|
|
|
|
const PerformanceEntry* aElem2) const {
|
|
|
|
MOZ_ASSERT(aElem1 && aElem2, "Trying to compare null performance entries");
|
|
|
|
return aElem1->StartTime() == aElem2->StartTime();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool LessThan(const PerformanceEntry* aElem1,
|
|
|
|
const PerformanceEntry* aElem2) const {
|
|
|
|
MOZ_ASSERT(aElem1 && aElem2, "Trying to compare null performance entries");
|
|
|
|
return aElem1->StartTime() < aElem2->StartTime();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-10-16 05:35:44 +04:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif /* mozilla_dom_PerformanceEntry_h___ */
|