PerformanceWorker.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /* -*- Mode: C++; tab-width: 8; 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
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef mozilla_dom_PerformanceWorker_h
  6. #define mozilla_dom_PerformanceWorker_h
  7. #include "Performance.h"
  8. namespace mozilla {
  9. namespace dom {
  10. namespace workers {
  11. class WorkerPrivate;
  12. }
  13. class PerformanceWorker final : public Performance
  14. {
  15. public:
  16. explicit PerformanceWorker(workers::WorkerPrivate* aWorkerPrivate);
  17. virtual PerformanceTiming* Timing() override
  18. {
  19. MOZ_CRASH("This should not be called on workers.");
  20. return nullptr;
  21. }
  22. virtual PerformanceNavigation* Navigation() override
  23. {
  24. MOZ_CRASH("This should not be called on workers.");
  25. return nullptr;
  26. }
  27. virtual void AddEntry(nsIHttpChannel* channel,
  28. nsITimedChannel* timedChannel) override
  29. {
  30. MOZ_CRASH("This should not be called on workers.");
  31. }
  32. TimeStamp CreationTimeStamp() const override;
  33. DOMHighResTimeStamp CreationTime() const override;
  34. #ifdef MOZ_DEVTOOLS_SERVER
  35. virtual void GetMozMemory(JSContext *aCx,
  36. JS::MutableHandle<JSObject*> aObj) override
  37. {
  38. MOZ_CRASH("This should not be called on workers.");
  39. }
  40. #endif
  41. virtual nsDOMNavigationTiming* GetDOMTiming() const override
  42. {
  43. MOZ_CRASH("This should not be called on workers.");
  44. return nullptr;
  45. }
  46. virtual nsITimedChannel* GetChannel() const override
  47. {
  48. MOZ_CRASH("This should not be called on workers.");
  49. return nullptr;
  50. }
  51. protected:
  52. ~PerformanceWorker();
  53. nsISupports* GetAsISupports() override
  54. {
  55. return nullptr;
  56. }
  57. void InsertUserEntry(PerformanceEntry* aEntry) override;
  58. void DispatchBufferFullEvent() override
  59. {
  60. MOZ_CRASH("This should not be called on workers.");
  61. }
  62. private:
  63. workers::WorkerPrivate* mWorkerPrivate;
  64. };
  65. } // namespace dom
  66. } // namespace mozilla
  67. #endif // mozilla_dom_PerformanceWorker_h