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 { 13 namespace dom { 14 15 class WorkerPrivate; 16 17 class PerformanceWorker final : public Performance { 18 public: 19 explicit PerformanceWorker(WorkerPrivate* aWorkerPrivate); 20 AsPerformanceStorage()21 PerformanceStorage* AsPerformanceStorage() override { 22 MOZ_CRASH("This should not be called on workers."); 23 return nullptr; 24 } 25 Timing()26 virtual PerformanceTiming* Timing() override { 27 MOZ_CRASH("This should not be called on workers."); 28 return nullptr; 29 } 30 Navigation()31 virtual PerformanceNavigation* Navigation() override { 32 MOZ_CRASH("This should not be called on workers."); 33 return nullptr; 34 } 35 36 TimeStamp CreationTimeStamp() const override; 37 38 DOMHighResTimeStamp CreationTime() const override; 39 GetMozMemory(JSContext * aCx,JS::MutableHandle<JSObject * > aObj)40 virtual void GetMozMemory(JSContext* aCx, 41 JS::MutableHandle<JSObject*> aObj) override { 42 MOZ_CRASH("This should not be called on workers."); 43 } 44 GetDOMTiming()45 virtual nsDOMNavigationTiming* GetDOMTiming() const override { 46 MOZ_CRASH("This should not be called on workers."); 47 return nullptr; 48 } 49 50 virtual uint64_t GetRandomTimelineSeed() override; 51 GetChannel()52 virtual nsITimedChannel* GetChannel() const override { 53 MOZ_CRASH("This should not be called on workers."); 54 return nullptr; 55 } 56 57 protected: 58 ~PerformanceWorker(); 59 60 void InsertUserEntry(PerformanceEntry* aEntry) override; 61 DispatchBufferFullEvent()62 void DispatchBufferFullEvent() override { 63 // Nothing to do here. See bug 1432758. 64 } 65 66 private: 67 WorkerPrivate* mWorkerPrivate; 68 }; 69 70 } // namespace dom 71 } // namespace mozilla 72 73 #endif // mozilla_dom_PerformanceWorker_h 74