PerformanceWorker.h (3218B)
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/. */ 6 7 #ifndef mozilla_dom_PerformanceWorker_h 8 #define mozilla_dom_PerformanceWorker_h 9 10 #include "Performance.h" 11 12 namespace mozilla::dom { 13 14 class WorkerGlobalScope; 15 class PerformanceInteractionMetrics; 16 17 class PerformanceWorker final : public Performance { 18 public: 19 explicit PerformanceWorker(WorkerGlobalScope* aGlobalScope); 20 21 PerformanceStorage* AsPerformanceStorage() override { 22 MOZ_CRASH("This should not be called on workers."); 23 return nullptr; 24 } 25 26 virtual PerformanceTiming* Timing() override { 27 MOZ_CRASH("This should not be called on workers."); 28 return nullptr; 29 } 30 31 virtual PerformanceNavigation* Navigation() override { 32 MOZ_CRASH("This should not be called on workers."); 33 return nullptr; 34 } 35 36 virtual void SetFCPTimingEntry(PerformancePaintTiming* aEntry) override { 37 MOZ_CRASH("This should not be called on workers."); 38 } 39 40 TimeStamp CreationTimeStamp() const override; 41 42 DOMHighResTimeStamp CreationTime() const override; 43 44 virtual void GetMozMemory(JSContext* aCx, 45 JS::MutableHandle<JSObject*> aObj) override { 46 MOZ_CRASH("This should not be called on workers."); 47 } 48 49 virtual nsDOMNavigationTiming* GetDOMTiming() const override { 50 MOZ_CRASH("This should not be called on workers."); 51 return nullptr; 52 } 53 54 virtual uint64_t GetRandomTimelineSeed() override; 55 56 virtual nsITimedChannel* GetChannel() const override { 57 MOZ_CRASH("This should not be called on workers."); 58 return nullptr; 59 } 60 61 void QueueNavigationTimingEntry() override { 62 MOZ_CRASH("This should not be called on workers."); 63 } 64 65 void UpdateNavigationTimingEntry() override { 66 MOZ_CRASH("This should not be called on workers."); 67 } 68 69 void InsertEventTimingEntry(PerformanceEventTiming*) override { 70 MOZ_CRASH("This should not be called on workers."); 71 } 72 73 void BufferEventTimingEntryIfNeeded(PerformanceEventTiming*) override { 74 MOZ_CRASH("This should not be called on workers."); 75 } 76 77 void DispatchPendingEventTimingEntries() override { 78 MOZ_CRASH("This should not be called on workders."); 79 } 80 81 PerformanceInteractionMetrics& GetPerformanceInteractionMetrics() override { 82 MOZ_CRASH("This should not be called on workers."); 83 } 84 85 void SetInteractionId(PerformanceEventTiming* aEventTiming, 86 const WidgetEvent* aEvent) override { 87 MOZ_CRASH("This should not be called on workers."); 88 } 89 90 class EventCounts* EventCounts() override { 91 MOZ_CRASH("This should not be called on workers"); 92 } 93 94 uint64_t InteractionCount() override { 95 MOZ_CRASH("This should not be called on workers"); 96 } 97 98 protected: 99 ~PerformanceWorker(); 100 101 void InsertUserEntry(PerformanceEntry* aEntry) override; 102 103 void DispatchResourceTimingBufferFullEvent() override { 104 // Nothing to do here. See bug 1432758. 105 } 106 }; 107 108 } // namespace mozilla::dom 109 110 #endif // mozilla_dom_PerformanceWorker_h