PerformanceMeasure.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233
  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. #include "PerformanceMeasure.h"
  6. #include "MainThreadUtils.h"
  7. #include "mozilla/dom/PerformanceMeasureBinding.h"
  8. using namespace mozilla::dom;
  9. PerformanceMeasure::PerformanceMeasure(nsISupports* aParent,
  10. const nsAString& aName,
  11. DOMHighResTimeStamp aStartTime,
  12. DOMHighResTimeStamp aEndTime)
  13. : PerformanceEntry(aParent, aName, NS_LITERAL_STRING("measure")),
  14. mStartTime(aStartTime),
  15. mDuration(aEndTime - aStartTime)
  16. {
  17. // mParent is null in workers.
  18. MOZ_ASSERT(mParent || !NS_IsMainThread());
  19. }
  20. PerformanceMeasure::~PerformanceMeasure()
  21. {
  22. }
  23. JSObject*
  24. PerformanceMeasure::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
  25. {
  26. return PerformanceMeasureBinding::Wrap(aCx, this, aGivenProto);
  27. }