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 "PerformanceServerTiming.h"
8 #include "nsITimedChannel.h"
10 #include "mozilla/dom/PerformanceServerTimingBinding.h"
12 namespace mozilla::dom
{
14 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(PerformanceServerTiming
, mParent
)
16 NS_IMPL_CYCLE_COLLECTING_ADDREF(PerformanceServerTiming
)
17 NS_IMPL_CYCLE_COLLECTING_RELEASE(PerformanceServerTiming
)
19 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(PerformanceServerTiming
)
20 NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
21 NS_INTERFACE_MAP_ENTRY(nsISupports
)
24 JSObject
* PerformanceServerTiming::WrapObject(
25 JSContext
* aCx
, JS::Handle
<JSObject
*> aGivenProto
) {
26 return mozilla::dom::PerformanceServerTiming_Binding::Wrap(aCx
, this,
30 void PerformanceServerTiming::GetName(nsAString
& aName
) const {
38 if (NS_WARN_IF(NS_FAILED(mServerTiming
->GetName(name
)))) {
42 aName
.Assign(NS_ConvertUTF8toUTF16(name
));
45 DOMHighResTimeStamp
PerformanceServerTiming::Duration() const {
51 if (NS_WARN_IF(NS_FAILED(mServerTiming
->GetDuration(&duration
)))) {
58 void PerformanceServerTiming::GetDescription(nsAString
& aDescription
) const {
63 nsAutoCString description
;
64 if (NS_WARN_IF(NS_FAILED(mServerTiming
->GetDescription(description
)))) {
68 aDescription
.Assign(NS_ConvertUTF8toUTF16(description
));
71 } // namespace mozilla::dom