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 #ifndef mozilla_dom_PerformanceTiming_h
8 #define mozilla_dom_PerformanceTiming_h
10 #include "mozilla/Attributes.h"
11 #include "mozilla/BasePrincipal.h"
12 #include "mozilla/StaticPrefs_dom.h"
13 #include "nsContentUtils.h"
14 #include "nsDOMNavigationTiming.h"
15 #include "nsRFPService.h"
16 #include "nsWrapperCache.h"
17 #include "Performance.h"
18 #include "nsITimedChannel.h"
19 #include "mozilla/dom/PerformanceTimingTypes.h"
20 #include "mozilla/ipc/IPDLParamTraits.h"
21 #include "ipc/IPCMessageUtils.h"
22 #include "ipc/IPCMessageUtilsSpecializations.h"
23 #include "mozilla/net/nsServerTiming.h"
27 namespace mozilla::dom
{
29 class PerformanceTiming
;
31 class PerformanceTimingData final
{
32 friend class PerformanceTiming
;
33 friend struct mozilla::ipc::IPDLParamTraits
<
34 mozilla::dom::PerformanceTimingData
>;
37 PerformanceTimingData() = default; // For deserialization
38 // This can return null.
39 static PerformanceTimingData
* Create(nsITimedChannel
* aChannel
,
40 nsIHttpChannel
* aHttpChannel
,
41 DOMHighResTimeStamp aZeroTime
,
42 nsAString
& aInitiatorType
,
43 nsAString
& aEntryName
);
45 PerformanceTimingData(nsITimedChannel
* aChannel
, nsIHttpChannel
* aHttpChannel
,
46 DOMHighResTimeStamp aZeroTime
);
48 explicit PerformanceTimingData(const IPCPerformanceTimingData
& aIPCData
);
50 IPCPerformanceTimingData
ToIPC();
52 void SetPropertiesFromHttpChannel(nsIHttpChannel
* aHttpChannel
,
53 nsITimedChannel
* aChannel
);
55 bool IsInitialized() const { return mInitialized
; }
57 const nsString
& NextHopProtocol() const { return mNextHopProtocol
; }
59 uint64_t TransferSize() const { return mTransferSize
; }
61 uint64_t EncodedBodySize() const { return mEncodedBodySize
; }
63 uint64_t DecodedBodySize() const { return mDecodedBodySize
; }
67 * The TimeStamp recorded for a specific event. This TimeStamp can
69 * @return the duration of an event with a given TimeStamp, relative to the
70 * navigationStart TimeStamp (the moment the user landed on the
71 * page), if the given TimeStamp is valid. Otherwise, it will return
72 * the FetchStart timing value.
74 inline DOMHighResTimeStamp
TimeStampToReducedDOMHighResOrFetchStart(
75 Performance
* aPerformance
, TimeStamp aStamp
) {
76 MOZ_ASSERT(aPerformance
);
78 if (aStamp
.IsNull()) {
79 return FetchStartHighRes(aPerformance
);
82 DOMHighResTimeStamp rawTimestamp
=
83 TimeStampToDOMHighRes(aPerformance
, aStamp
);
85 return nsRFPService::ReduceTimePrecisionAsMSecs(
86 rawTimestamp
, aPerformance
->GetRandomTimelineSeed(),
87 aPerformance
->IsSystemPrincipal(), aPerformance
->CrossOriginIsolated());
91 * The nsITimedChannel records an absolute timestamp for each event.
92 * The nsDOMNavigationTiming will record the moment when the user landed on
93 * the page. This is a window.performance unique timestamp, so it can be used
94 * for all the events (navigation timing and resource timing events).
96 * The algorithm operates in 2 steps:
97 * 1. The first step is to subtract the two timestamps: the argument (the
98 * event's timestamp) and the navigation start timestamp. This will result in
99 * a relative timestamp of the event (relative to the navigation start -
100 * window.performance.timing.navigationStart).
101 * 2. The second step is to add any required offset (the mZeroTime). For now,
102 * this offset value is either 0 (for the resource timing), or equal to
103 * "performance.navigationStart" (for navigation timing).
104 * For the resource timing, mZeroTime is set to 0, causing the result to be a
106 * For the navigation timing, mZeroTime is set to
107 * "performance.navigationStart" causing the result be an absolute time.
110 * The TimeStamp recorded for a specific event. This TimeStamp can't
112 * @return number of milliseconds value as one of:
113 * - relative to the navigation start time, time the user has landed on the
115 * - an absolute wall clock time since the unix epoch
117 inline DOMHighResTimeStamp
TimeStampToDOMHighRes(Performance
* aPerformance
,
118 TimeStamp aStamp
) const {
119 MOZ_ASSERT(aPerformance
);
120 MOZ_ASSERT(!aStamp
.IsNull());
122 TimeDuration duration
= aStamp
- aPerformance
->CreationTimeStamp();
123 return duration
.ToMilliseconds() + mZeroTime
;
126 // The last channel's AsyncOpen time. This may occur before the FetchStart
128 DOMHighResTimeStamp
AsyncOpenHighRes(Performance
* aPerformance
);
130 // High resolution (used by resource timing)
131 DOMHighResTimeStamp
WorkerStartHighRes(Performance
* aPerformance
);
132 DOMHighResTimeStamp
FetchStartHighRes(Performance
* aPerformance
);
133 DOMHighResTimeStamp
RedirectStartHighRes(Performance
* aPerformance
);
134 DOMHighResTimeStamp
RedirectEndHighRes(Performance
* aPerformance
);
135 DOMHighResTimeStamp
DomainLookupStartHighRes(Performance
* aPerformance
);
136 DOMHighResTimeStamp
DomainLookupEndHighRes(Performance
* aPerformance
);
137 DOMHighResTimeStamp
ConnectStartHighRes(Performance
* aPerformance
);
138 DOMHighResTimeStamp
SecureConnectionStartHighRes(Performance
* aPerformance
);
139 DOMHighResTimeStamp
ConnectEndHighRes(Performance
* aPerformance
);
140 DOMHighResTimeStamp
RequestStartHighRes(Performance
* aPerformance
);
141 DOMHighResTimeStamp
ResponseStartHighRes(Performance
* aPerformance
);
142 DOMHighResTimeStamp
ResponseEndHighRes(Performance
* aPerformance
);
144 DOMHighResTimeStamp
ZeroTime() const { return mZeroTime
; }
146 uint8_t RedirectCountReal() const { return mRedirectCount
; }
147 uint8_t GetRedirectCount() const;
149 bool AllRedirectsSameOrigin() const { return mAllRedirectsSameOrigin
; }
151 // If this is false the values of redirectStart/End will be 0 This is false if
152 // no redirects occured, or if any of the responses failed the
153 // timing-allow-origin check in HttpBaseChannel::TimingAllowCheck
155 // If aEnsureSameOriginAndIgnoreTAO is false, it checks if all redirects pass
156 // TAO. When it is true, it checks if all redirects are same-origin and
157 // ignores the result of TAO.
158 bool ShouldReportCrossOriginRedirect(
159 bool aEnsureSameOriginAndIgnoreTAO
) const;
161 // Cached result of CheckAllowedOrigin. If false, security sensitive
162 // attributes of the resourceTiming object will be set to 0
163 bool TimingAllowed() const { return mTimingAllowed
; }
165 nsTArray
<nsCOMPtr
<nsIServerTiming
>> GetServerTiming();
168 // Checks if the resource is either same origin as the page that started
169 // the load, or if the response contains the Timing-Allow-Origin header
170 // with a value of * or matching the domain of the loading Principal
171 bool CheckAllowedOrigin(nsIHttpChannel
* aResourceChannel
,
172 nsITimedChannel
* aChannel
);
174 nsTArray
<nsCOMPtr
<nsIServerTiming
>> mServerTiming
;
175 nsString mNextHopProtocol
;
177 TimeStamp mAsyncOpen
;
178 TimeStamp mRedirectStart
;
179 TimeStamp mRedirectEnd
;
180 TimeStamp mDomainLookupStart
;
181 TimeStamp mDomainLookupEnd
;
182 TimeStamp mConnectStart
;
183 TimeStamp mSecureConnectionStart
;
184 TimeStamp mConnectEnd
;
185 TimeStamp mRequestStart
;
186 TimeStamp mResponseStart
;
187 TimeStamp mCacheReadStart
;
188 TimeStamp mResponseEnd
;
189 TimeStamp mCacheReadEnd
;
191 // ServiceWorker interception timing information
192 TimeStamp mWorkerStart
;
193 TimeStamp mWorkerRequestStart
;
194 TimeStamp mWorkerResponseEnd
;
196 // This is an offset that will be added to each timing ([ms] resolution).
197 // There are only 2 possible values: (1) logicaly equal to navigationStart
198 // TimeStamp (results are absolute timstamps - wallclock); (2) "0" (results
199 // are relative to the navigation start).
200 DOMHighResTimeStamp mZeroTime
= 0;
202 DOMHighResTimeStamp mFetchStart
= 0;
204 uint64_t mEncodedBodySize
= 0;
205 uint64_t mTransferSize
= 0;
206 uint64_t mDecodedBodySize
= 0;
208 uint8_t mRedirectCount
= 0;
210 bool mAllRedirectsSameOrigin
= false;
212 bool mAllRedirectsPassTAO
= false;
214 bool mSecureConnection
= false;
216 bool mTimingAllowed
= false;
218 bool mInitialized
= false;
221 // Script "performance.timing" object
222 class PerformanceTiming final
: public nsWrapperCache
{
225 * @param aPerformance
226 * The performance object (the JS parent).
227 * This will allow access to "window.performance.timing" attribute
228 * for the navigation timing (can't be null).
230 * An nsITimedChannel used to gather all the networking timings by
231 * both the navigation timing and the resource timing (can't be null).
232 * @param aHttpChannel
233 * An nsIHttpChannel (the resource's http channel).
234 * This will be used by the resource timing cross-domain check
236 * Argument is null for the navigation timing (navigation timing uses
237 * another algorithm for the cross-domain redirects).
239 * The offset that will be added to the timestamp of each event. This
240 * argument should be equal to performance.navigationStart for
241 * navigation timing and "0" for the resource timing.
243 PerformanceTiming(Performance
* aPerformance
, nsITimedChannel
* aChannel
,
244 nsIHttpChannel
* aHttpChannel
,
245 DOMHighResTimeStamp aZeroTime
);
246 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(PerformanceTiming
)
247 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(PerformanceTiming
)
249 nsDOMNavigationTiming
* GetDOMTiming() const {
250 return mPerformance
->GetDOMTiming();
253 Performance
* GetParentObject() const { return mPerformance
; }
255 virtual JSObject
* WrapObject(JSContext
* cx
,
256 JS::Handle
<JSObject
*> aGivenProto
) override
;
258 // PerformanceNavigation WebIDL methods
259 DOMTimeMilliSec
NavigationStart() const {
260 if (!StaticPrefs::dom_enable_performance()) {
263 return nsRFPService::ReduceTimePrecisionAsMSecs(
264 GetDOMTiming()->GetNavigationStart(),
265 mPerformance
->GetRandomTimelineSeed(),
266 mPerformance
->IsSystemPrincipal(), mPerformance
->CrossOriginIsolated());
269 DOMTimeMilliSec
UnloadEventStart() {
270 if (!StaticPrefs::dom_enable_performance()) {
273 return nsRFPService::ReduceTimePrecisionAsMSecs(
274 GetDOMTiming()->GetUnloadEventStart(),
275 mPerformance
->GetRandomTimelineSeed(),
276 mPerformance
->IsSystemPrincipal(), mPerformance
->CrossOriginIsolated());
279 DOMTimeMilliSec
UnloadEventEnd() {
280 if (!StaticPrefs::dom_enable_performance()) {
283 return nsRFPService::ReduceTimePrecisionAsMSecs(
284 GetDOMTiming()->GetUnloadEventEnd(),
285 mPerformance
->GetRandomTimelineSeed(),
286 mPerformance
->IsSystemPrincipal(), mPerformance
->CrossOriginIsolated());
289 // Low resolution (used by navigation timing)
290 DOMTimeMilliSec
FetchStart();
291 DOMTimeMilliSec
RedirectStart();
292 DOMTimeMilliSec
RedirectEnd();
293 DOMTimeMilliSec
DomainLookupStart();
294 DOMTimeMilliSec
DomainLookupEnd();
295 DOMTimeMilliSec
ConnectStart();
296 DOMTimeMilliSec
SecureConnectionStart();
297 DOMTimeMilliSec
ConnectEnd();
298 DOMTimeMilliSec
RequestStart();
299 DOMTimeMilliSec
ResponseStart();
300 DOMTimeMilliSec
ResponseEnd();
302 DOMTimeMilliSec
DomLoading() {
303 if (!StaticPrefs::dom_enable_performance()) {
306 return nsRFPService::ReduceTimePrecisionAsMSecs(
307 GetDOMTiming()->GetDomLoading(), mPerformance
->GetRandomTimelineSeed(),
308 mPerformance
->IsSystemPrincipal(), mPerformance
->CrossOriginIsolated());
311 DOMTimeMilliSec
DomInteractive() const {
312 if (!StaticPrefs::dom_enable_performance()) {
315 return nsRFPService::ReduceTimePrecisionAsMSecs(
316 GetDOMTiming()->GetDomInteractive(),
317 mPerformance
->GetRandomTimelineSeed(),
318 mPerformance
->IsSystemPrincipal(), mPerformance
->CrossOriginIsolated());
321 DOMTimeMilliSec
DomContentLoadedEventStart() const {
322 if (!StaticPrefs::dom_enable_performance()) {
325 return nsRFPService::ReduceTimePrecisionAsMSecs(
326 GetDOMTiming()->GetDomContentLoadedEventStart(),
327 mPerformance
->GetRandomTimelineSeed(),
328 mPerformance
->IsSystemPrincipal(), mPerformance
->CrossOriginIsolated());
331 DOMTimeMilliSec
DomContentLoadedEventEnd() const {
332 if (!StaticPrefs::dom_enable_performance()) {
335 return nsRFPService::ReduceTimePrecisionAsMSecs(
336 GetDOMTiming()->GetDomContentLoadedEventEnd(),
337 mPerformance
->GetRandomTimelineSeed(),
338 mPerformance
->IsSystemPrincipal(), mPerformance
->CrossOriginIsolated());
341 DOMTimeMilliSec
DomComplete() const {
342 if (!StaticPrefs::dom_enable_performance()) {
345 return nsRFPService::ReduceTimePrecisionAsMSecs(
346 GetDOMTiming()->GetDomComplete(), mPerformance
->GetRandomTimelineSeed(),
347 mPerformance
->IsSystemPrincipal(), mPerformance
->CrossOriginIsolated());
350 DOMTimeMilliSec
LoadEventStart() const {
351 if (!StaticPrefs::dom_enable_performance()) {
354 return nsRFPService::ReduceTimePrecisionAsMSecs(
355 GetDOMTiming()->GetLoadEventStart(),
356 mPerformance
->GetRandomTimelineSeed(),
357 mPerformance
->IsSystemPrincipal(), mPerformance
->CrossOriginIsolated());
360 DOMTimeMilliSec
LoadEventEnd() const {
361 if (!StaticPrefs::dom_enable_performance()) {
364 return nsRFPService::ReduceTimePrecisionAsMSecs(
365 GetDOMTiming()->GetLoadEventEnd(),
366 mPerformance
->GetRandomTimelineSeed(),
367 mPerformance
->IsSystemPrincipal(), mPerformance
->CrossOriginIsolated());
370 DOMTimeMilliSec
TimeToNonBlankPaint() const {
371 if (!StaticPrefs::dom_enable_performance()) {
374 return nsRFPService::ReduceTimePrecisionAsMSecs(
375 GetDOMTiming()->GetTimeToNonBlankPaint(),
376 mPerformance
->GetRandomTimelineSeed(),
377 mPerformance
->IsSystemPrincipal(), mPerformance
->CrossOriginIsolated());
380 DOMTimeMilliSec
TimeToContentfulPaint() const {
381 if (!StaticPrefs::dom_enable_performance()) {
384 return nsRFPService::ReduceTimePrecisionAsMSecs(
385 GetDOMTiming()->GetTimeToContentfulComposite(),
386 mPerformance
->GetRandomTimelineSeed(),
387 mPerformance
->IsSystemPrincipal(), mPerformance
->CrossOriginIsolated());
390 DOMTimeMilliSec
TimeToDOMContentFlushed() const {
391 if (!StaticPrefs::dom_enable_performance()) {
394 return nsRFPService::ReduceTimePrecisionAsMSecs(
395 GetDOMTiming()->GetTimeToDOMContentFlushed(),
396 mPerformance
->GetRandomTimelineSeed(),
397 mPerformance
->IsSystemPrincipal(), mPerformance
->CrossOriginIsolated());
400 DOMTimeMilliSec
TimeToFirstInteractive() const {
401 if (!StaticPrefs::dom_enable_performance()) {
404 return nsRFPService::ReduceTimePrecisionAsMSecs(
405 GetDOMTiming()->GetTimeToTTFI(), mPerformance
->GetRandomTimelineSeed(),
406 mPerformance
->IsSystemPrincipal(), mPerformance
->CrossOriginIsolated());
409 PerformanceTimingData
* Data() const { return mTimingData
.get(); }
412 ~PerformanceTiming();
414 bool IsTopLevelContentDocument() const;
416 RefPtr
<Performance
> mPerformance
;
418 UniquePtr
<PerformanceTimingData
> mTimingData
;
421 } // namespace mozilla::dom
423 namespace mozilla::ipc
{
426 struct IPDLParamTraits
<mozilla::dom::PerformanceTimingData
> {
427 using paramType
= mozilla::dom::PerformanceTimingData
;
428 static void Write(IPC::MessageWriter
* aWriter
, IProtocol
* aActor
,
429 const paramType
& aParam
) {
430 WriteIPDLParam(aWriter
, aActor
, aParam
.mServerTiming
);
431 WriteIPDLParam(aWriter
, aActor
, aParam
.mNextHopProtocol
);
432 WriteIPDLParam(aWriter
, aActor
, aParam
.mAsyncOpen
);
433 WriteIPDLParam(aWriter
, aActor
, aParam
.mRedirectStart
);
434 WriteIPDLParam(aWriter
, aActor
, aParam
.mRedirectEnd
);
435 WriteIPDLParam(aWriter
, aActor
, aParam
.mDomainLookupStart
);
436 WriteIPDLParam(aWriter
, aActor
, aParam
.mDomainLookupEnd
);
437 WriteIPDLParam(aWriter
, aActor
, aParam
.mConnectStart
);
438 WriteIPDLParam(aWriter
, aActor
, aParam
.mSecureConnectionStart
);
439 WriteIPDLParam(aWriter
, aActor
, aParam
.mConnectEnd
);
440 WriteIPDLParam(aWriter
, aActor
, aParam
.mRequestStart
);
441 WriteIPDLParam(aWriter
, aActor
, aParam
.mResponseStart
);
442 WriteIPDLParam(aWriter
, aActor
, aParam
.mCacheReadStart
);
443 WriteIPDLParam(aWriter
, aActor
, aParam
.mResponseEnd
);
444 WriteIPDLParam(aWriter
, aActor
, aParam
.mCacheReadEnd
);
445 WriteIPDLParam(aWriter
, aActor
, aParam
.mWorkerStart
);
446 WriteIPDLParam(aWriter
, aActor
, aParam
.mWorkerRequestStart
);
447 WriteIPDLParam(aWriter
, aActor
, aParam
.mWorkerResponseEnd
);
448 WriteIPDLParam(aWriter
, aActor
, aParam
.mZeroTime
);
449 WriteIPDLParam(aWriter
, aActor
, aParam
.mFetchStart
);
450 WriteIPDLParam(aWriter
, aActor
, aParam
.mEncodedBodySize
);
451 WriteIPDLParam(aWriter
, aActor
, aParam
.mTransferSize
);
452 WriteIPDLParam(aWriter
, aActor
, aParam
.mDecodedBodySize
);
453 WriteIPDLParam(aWriter
, aActor
, aParam
.mRedirectCount
);
454 WriteIPDLParam(aWriter
, aActor
, aParam
.mAllRedirectsSameOrigin
);
455 WriteIPDLParam(aWriter
, aActor
, aParam
.mAllRedirectsPassTAO
);
456 WriteIPDLParam(aWriter
, aActor
, aParam
.mSecureConnection
);
457 WriteIPDLParam(aWriter
, aActor
, aParam
.mTimingAllowed
);
458 WriteIPDLParam(aWriter
, aActor
, aParam
.mInitialized
);
461 static bool Read(IPC::MessageReader
* aReader
, IProtocol
* aActor
,
462 paramType
* aResult
) {
463 if (!ReadIPDLParam(aReader
, aActor
, &aResult
->mServerTiming
)) {
466 if (!ReadIPDLParam(aReader
, aActor
, &aResult
->mNextHopProtocol
)) {
469 if (!ReadIPDLParam(aReader
, aActor
, &aResult
->mAsyncOpen
)) {
472 if (!ReadIPDLParam(aReader
, aActor
, &aResult
->mRedirectStart
)) {
475 if (!ReadIPDLParam(aReader
, aActor
, &aResult
->mRedirectEnd
)) {
478 if (!ReadIPDLParam(aReader
, aActor
, &aResult
->mDomainLookupStart
)) {
481 if (!ReadIPDLParam(aReader
, aActor
, &aResult
->mDomainLookupEnd
)) {
484 if (!ReadIPDLParam(aReader
, aActor
, &aResult
->mConnectStart
)) {
487 if (!ReadIPDLParam(aReader
, aActor
, &aResult
->mSecureConnectionStart
)) {
490 if (!ReadIPDLParam(aReader
, aActor
, &aResult
->mConnectEnd
)) {
493 if (!ReadIPDLParam(aReader
, aActor
, &aResult
->mRequestStart
)) {
496 if (!ReadIPDLParam(aReader
, aActor
, &aResult
->mResponseStart
)) {
499 if (!ReadIPDLParam(aReader
, aActor
, &aResult
->mCacheReadStart
)) {
502 if (!ReadIPDLParam(aReader
, aActor
, &aResult
->mResponseEnd
)) {
505 if (!ReadIPDLParam(aReader
, aActor
, &aResult
->mCacheReadEnd
)) {
508 if (!ReadIPDLParam(aReader
, aActor
, &aResult
->mWorkerStart
)) {
511 if (!ReadIPDLParam(aReader
, aActor
, &aResult
->mWorkerRequestStart
)) {
514 if (!ReadIPDLParam(aReader
, aActor
, &aResult
->mWorkerResponseEnd
)) {
517 if (!ReadIPDLParam(aReader
, aActor
, &aResult
->mZeroTime
)) {
520 if (!ReadIPDLParam(aReader
, aActor
, &aResult
->mFetchStart
)) {
523 if (!ReadIPDLParam(aReader
, aActor
, &aResult
->mEncodedBodySize
)) {
526 if (!ReadIPDLParam(aReader
, aActor
, &aResult
->mTransferSize
)) {
529 if (!ReadIPDLParam(aReader
, aActor
, &aResult
->mDecodedBodySize
)) {
532 if (!ReadIPDLParam(aReader
, aActor
, &aResult
->mRedirectCount
)) {
535 if (!ReadIPDLParam(aReader
, aActor
, &aResult
->mAllRedirectsSameOrigin
)) {
538 if (!ReadIPDLParam(aReader
, aActor
, &aResult
->mAllRedirectsPassTAO
)) {
541 if (!ReadIPDLParam(aReader
, aActor
, &aResult
->mSecureConnection
)) {
544 if (!ReadIPDLParam(aReader
, aActor
, &aResult
->mTimingAllowed
)) {
547 if (!ReadIPDLParam(aReader
, aActor
, &aResult
->mInitialized
)) {
555 struct IPDLParamTraits
<nsIServerTiming
*> {
556 static void Write(IPC::MessageWriter
* aWriter
, IProtocol
* aActor
,
557 nsIServerTiming
* aParam
) {
559 Unused
<< aParam
->GetName(name
);
561 Unused
<< aParam
->GetDuration(&duration
);
562 nsAutoCString description
;
563 Unused
<< aParam
->GetDescription(description
);
564 WriteIPDLParam(aWriter
, aActor
, name
);
565 WriteIPDLParam(aWriter
, aActor
, duration
);
566 WriteIPDLParam(aWriter
, aActor
, description
);
569 static bool Read(IPC::MessageReader
* aReader
, IProtocol
* aActor
,
570 RefPtr
<nsIServerTiming
>* aResult
) {
573 nsAutoCString description
;
574 if (!ReadIPDLParam(aReader
, aActor
, &name
)) {
577 if (!ReadIPDLParam(aReader
, aActor
, &duration
)) {
580 if (!ReadIPDLParam(aReader
, aActor
, &description
)) {
584 RefPtr
<nsServerTiming
> timing
= new nsServerTiming();
585 timing
->SetName(name
);
586 timing
->SetDuration(duration
);
587 timing
->SetDescription(description
);
588 *aResult
= timing
.forget();
593 } // namespace mozilla::ipc
595 #endif // mozilla_dom_PerformanceTiming_h