зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1191178 - Part 2: Add PerformanceRenderTiming and PerformanceCompositeTiming. r=smaug
--HG-- extra : rebase_source : a0cb9f4b60bfaa82dc07e231c8adfbe5eb430df4
This commit is contained in:
Родитель
0761bd2b97
Коммит
ff8c9910b9
|
@ -0,0 +1,30 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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 "PerformanceCompositeTiming.h"
|
||||
#include "mozilla/dom/PerformanceCompositeTimingBinding.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
PerformanceCompositeTiming::PerformanceCompositeTiming(nsISupports* aParent,
|
||||
const nsAString& aName,
|
||||
const DOMHighResTimeStamp& aStartTime,
|
||||
uint32_t aSourceFrameNumber)
|
||||
: PerformanceEntry(aParent, aName, NS_LITERAL_STRING("composite"))
|
||||
, mStartTime(aStartTime)
|
||||
, mSourceFrameNumber(aSourceFrameNumber)
|
||||
{
|
||||
MOZ_ASSERT(aParent, "Parent performance object should be provided");
|
||||
}
|
||||
|
||||
PerformanceCompositeTiming::~PerformanceCompositeTiming()
|
||||
{
|
||||
}
|
||||
|
||||
JSObject*
|
||||
PerformanceCompositeTiming::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
||||
{
|
||||
return PerformanceCompositeTimingBinding::Wrap(aCx, this, aGivenProto);
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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_performancecompositetiming_h___
|
||||
#define mozilla_dom_performancecompositetiming_h___
|
||||
|
||||
#include "mozilla/dom/PerformanceEntry.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
// http://www.w3.org/TR/frame-timing/#performancecompositetiming
|
||||
class PerformanceCompositeTiming final : public PerformanceEntry
|
||||
{
|
||||
public:
|
||||
PerformanceCompositeTiming(nsISupports* aParent,
|
||||
const nsAString& aName,
|
||||
const DOMHighResTimeStamp& aStartTime,
|
||||
uint32_t aSourceFrameNumber);
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
virtual DOMHighResTimeStamp StartTime() const override
|
||||
{
|
||||
return mStartTime;
|
||||
}
|
||||
|
||||
uint32_t SourceFrameNumber() const
|
||||
{
|
||||
return mSourceFrameNumber;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual ~PerformanceCompositeTiming();
|
||||
DOMHighResTimeStamp mStartTime;
|
||||
uint32_t mSourceFrameNumber;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif /* mozilla_dom_performancecompositetiming_h___ */
|
|
@ -0,0 +1,32 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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 "PerformanceRenderTiming.h"
|
||||
#include "mozilla/dom/PerformanceRenderTimingBinding.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
PerformanceRenderTiming::PerformanceRenderTiming(nsISupports* aParent,
|
||||
const nsAString& aName,
|
||||
const DOMHighResTimeStamp& aStartTime,
|
||||
const DOMHighResTimeStamp& aDuration,
|
||||
uint32_t aSourceFrameNumber)
|
||||
: PerformanceEntry(aParent, aName, NS_LITERAL_STRING("render"))
|
||||
, mStartTime(aStartTime)
|
||||
, mDuration(aDuration)
|
||||
, mSourceFrameNumber(aSourceFrameNumber)
|
||||
{
|
||||
MOZ_ASSERT(aParent, "Parent performance object should be provided");
|
||||
}
|
||||
|
||||
PerformanceRenderTiming::~PerformanceRenderTiming()
|
||||
{
|
||||
}
|
||||
|
||||
JSObject*
|
||||
PerformanceRenderTiming::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
||||
{
|
||||
return PerformanceRenderTimingBinding::Wrap(aCx, this, aGivenProto);
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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_performancerendertiming_h___
|
||||
#define mozilla_dom_performancerendertiming_h___
|
||||
|
||||
#include "mozilla/dom/PerformanceEntry.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
// http://www.w3.org/TR/frame-timing/#performancerendertiming
|
||||
class PerformanceRenderTiming final : public PerformanceEntry
|
||||
{
|
||||
public:
|
||||
PerformanceRenderTiming(nsISupports* aParent,
|
||||
const nsAString& aName,
|
||||
const DOMHighResTimeStamp& aStartTime,
|
||||
const DOMHighResTimeStamp& aDuration,
|
||||
uint32_t aSourceFrameNumber);
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
virtual DOMHighResTimeStamp StartTime() const override
|
||||
{
|
||||
return mStartTime;
|
||||
}
|
||||
|
||||
virtual DOMHighResTimeStamp Duration() const override
|
||||
{
|
||||
return mDuration;
|
||||
}
|
||||
|
||||
uint32_t SourceFrameNumber() const
|
||||
{
|
||||
return mSourceFrameNumber;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual ~PerformanceRenderTiming();
|
||||
DOMHighResTimeStamp mStartTime;
|
||||
DOMHighResTimeStamp mDuration;
|
||||
uint32_t mSourceFrameNumber;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif /* mozilla_dom_performancerendertiming_h___ */
|
|
@ -186,11 +186,13 @@ EXPORTS.mozilla.dom += [
|
|||
'NodeInfo.h',
|
||||
'NodeInfoInlines.h',
|
||||
'NodeIterator.h',
|
||||
'PerformanceCompositeTiming.h',
|
||||
'PerformanceEntry.h',
|
||||
'PerformanceMark.h',
|
||||
'PerformanceMeasure.h',
|
||||
'PerformanceObserver.h',
|
||||
'PerformanceObserverEntryList.h',
|
||||
'PerformanceRenderTiming.h',
|
||||
'PerformanceResourceTiming.h',
|
||||
'ProcessGlobal.h',
|
||||
'ResponsiveImageSelector.h',
|
||||
|
@ -327,11 +329,13 @@ UNIFIED_SOURCES += [
|
|||
'nsXMLContentSerializer.cpp',
|
||||
'nsXMLHttpRequest.cpp',
|
||||
'nsXMLNameSpaceMap.cpp',
|
||||
'PerformanceCompositeTiming.cpp',
|
||||
'PerformanceEntry.cpp',
|
||||
'PerformanceMark.cpp',
|
||||
'PerformanceMeasure.cpp',
|
||||
'PerformanceObserver.cpp',
|
||||
'PerformanceObserverEntryList.cpp',
|
||||
'PerformanceRenderTiming.cpp',
|
||||
'PerformanceResourceTiming.cpp',
|
||||
'PostMessageEvent.cpp',
|
||||
'ProcessGlobal.cpp',
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/.
|
||||
*
|
||||
* The origin of this IDL file is
|
||||
* http://www.w3.org/TR/frame-timing/#performancecompositetiming
|
||||
*
|
||||
* Copyright © 2015 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. W3C
|
||||
* liability, trademark and document use rules apply.
|
||||
*/
|
||||
|
||||
[Pref="dom.enable_frame_timing"]
|
||||
interface PerformanceCompositeTiming : PerformanceEntry
|
||||
{
|
||||
readonly attribute unsigned long sourceFrameNumber;
|
||||
|
||||
jsonifier;
|
||||
};
|
|
@ -0,0 +1,19 @@
|
|||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/.
|
||||
*
|
||||
* The origin of this IDL file is
|
||||
* http://www.w3.org/TR/frame-timing/#performancerendertiming
|
||||
*
|
||||
* Copyright © 2015 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. W3C
|
||||
* liability, trademark and document use rules apply.
|
||||
*/
|
||||
|
||||
[Pref="dom.enable_frame_timing"]
|
||||
interface PerformanceRenderTiming : PerformanceEntry
|
||||
{
|
||||
readonly attribute unsigned long sourceFrameNumber;
|
||||
|
||||
jsonifier;
|
||||
};
|
|
@ -349,12 +349,14 @@ WEBIDL_FILES = [
|
|||
'PannerNode.webidl',
|
||||
'ParentNode.webidl',
|
||||
'Performance.webidl',
|
||||
'PerformanceCompositeTiming.webidl',
|
||||
'PerformanceEntry.webidl',
|
||||
'PerformanceMark.webidl',
|
||||
'PerformanceMeasure.webidl',
|
||||
'PerformanceNavigation.webidl',
|
||||
'PerformanceObserver.webidl',
|
||||
'PerformanceObserverEntryList.webidl',
|
||||
'PerformanceRenderTiming.webidl',
|
||||
'PerformanceResourceTiming.webidl',
|
||||
'PerformanceTiming.webidl',
|
||||
'PeriodicWave.webidl',
|
||||
|
|
Загрузка…
Ссылка в новой задаче