dom/base/TimeoutBudgetManager.h
author Andreas Farre <farre@mozilla.com>
Fri, 12 Oct 2018 18:01:19 +0000
changeset 499664 4a230b07f0cbf48e87dcb4265ea2d00893bb1b62
parent 441766 cb123c84818a3c491fb9d63f00891d23f515cf6f
child 508163 6f3709b3878117466168c40affa7bca0b60cf75b
permissions -rw-r--r--
Bug 1437064 - Remove tracking timeouts list from TimeoutManager. r=chutten,Ehsan Differential Revision: https://phabricator.services.mozilla.com/D7878

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef mozilla_dom_timeoutbudgetmanager_h
#define mozilla_dom_timeoutbudgetmanager_h

#include "mozilla/TimeStamp.h"

namespace mozilla {
namespace dom {

class Timeout;

class TimeoutBudgetManager
{
public:
  static TimeoutBudgetManager& Get();
  void StartRecording(const TimeStamp& aNow);
  void StopRecording();
  TimeDuration RecordExecution(const TimeStamp& aNow,
                               const Timeout* aTimeout);
private:
  TimeoutBudgetManager() = default;

  TimeStamp mStart;
};

} // namespace dom
} // namespace mozilla

#endif // mozilla_dom_timeoutbudgetmanager_h