1/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2/* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 4 * You can obtain one at http://mozilla.org/MPL/2.0/. 5 * 6 * The origin of this IDL file is 7 * https://w3c.github.io/hr-time/#sec-performance 8 * https://w3c.github.io/navigation-timing/#extensions-to-the-performance-interface 9 * https://w3c.github.io/performance-timeline/#extensions-to-the-performance-interface 10 * https://w3c.github.io/resource-timing/#sec-extensions-performance-interface 11 * https://w3c.github.io/user-timing/#extensions-performance-interface 12 * 13 * Copyright © 2015 W3C® (MIT, ERCIM, Keio, Beihang). 14 * W3C liability, trademark and document use rules apply. 15 */ 16 17// DOMTimeStamp is deprecated, use EpochTimeStamp instead. 18typedef unsigned long long DOMTimeStamp; 19typedef unsigned long long EpochTimeStamp; 20typedef double DOMHighResTimeStamp; 21typedef sequence <PerformanceEntry> PerformanceEntryList; 22 23// https://w3c.github.io/hr-time/#sec-performance 24[Exposed=(Window,Worker)] 25interface Performance : EventTarget { 26 [DependsOn=DeviceState, Affects=Nothing] 27 DOMHighResTimeStamp now(); 28 29 [Constant] 30 readonly attribute DOMHighResTimeStamp timeOrigin; 31 32 [Default] object toJSON(); 33}; 34 35// https://w3c.github.io/navigation-timing/#extensions-to-the-performance-interface 36[Exposed=Window] 37partial interface Performance { 38 [Constant] 39 readonly attribute PerformanceTiming timing; 40 [Constant] 41 readonly attribute PerformanceNavigation navigation; 42}; 43 44// https://w3c.github.io/performance-timeline/#extensions-to-the-performance-interface 45[Exposed=(Window,Worker)] 46partial interface Performance { 47 PerformanceEntryList getEntries(); 48 PerformanceEntryList getEntriesByType(DOMString entryType); 49 PerformanceEntryList getEntriesByName(DOMString name, optional DOMString 50 entryType); 51}; 52 53// https://w3c.github.io/resource-timing/#sec-extensions-performance-interface 54[Exposed=(Window,Worker)] 55partial interface Performance { 56 void clearResourceTimings(); 57 void setResourceTimingBufferSize(unsigned long maxSize); 58 attribute EventHandler onresourcetimingbufferfull; 59}; 60 61// GC microbenchmarks, pref-guarded, not for general use (bug 1125412) 62[Exposed=Window] 63partial interface Performance { 64 [Pref="dom.enable_memory_stats"] 65 readonly attribute object mozMemory; 66}; 67 68// https://w3c.github.io/user-timing/#extensions-performance-interface 69[Exposed=(Window,Worker)] 70partial interface Performance { 71 [Throws] 72 void mark(DOMString markName); 73 void clearMarks(optional DOMString markName); 74 [Throws] 75 void measure(DOMString measureName, optional DOMString startMark, optional DOMString endMark); 76 void clearMeasures(optional DOMString measureName); 77}; 78 79[Exposed=Window] 80partial interface Performance { 81 [Pref="dom.enable_event_timing", SameObject] 82 readonly attribute EventCounts eventCounts; 83}; 84 85