author JW Wang <>
Tue, 10 Feb 2015 18:19:00 +0100
changeset 250209 acb510bddaddccafc7fc05550fd56a42053607f6
parent 222732 3bc727b5027c0caa433cdc83c7e6c962e6083890
child 257987 a20c7910a82fa2df2f3398c1108d102bac9128b0
permissions -rw-r--r--
Bug 1130917 - Part 3 - fix EME gtests. r=edwin. a=lmandel

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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 */

// nsRepeatService
#ifndef nsRepeatService_h__
#define nsRepeatService_h__

#include "nsCOMPtr.h"
#include "nsITimer.h"


#ifdef XP_MACOSX
#define REPEAT_DELAY        25
#define REPEAT_DELAY        50

class nsITimer;

class nsRepeatService MOZ_FINAL : public nsITimerCallback

  typedef void (* Callback)(void* aData);

  // Start dispatching timer events to the callback. There is no memory
  // management of aData here; it is the caller's responsibility to call
  // Stop() before aData's memory is released.
  void Start(Callback aCallback, void* aData,
             uint32_t aInitialDelay = INITAL_REPEAT_DELAY);
  // Stop dispatching timer events to the callback. If the repeat service
  // is not currently configured with the given callback and data, this
  // is just ignored.
  void Stop(Callback aCallback, void* aData);

  static nsRepeatService* GetInstance();
  static void Shutdown();


  virtual ~nsRepeatService();

  Callback           mCallback;
  void*              mCallbackData;
  nsCOMPtr<nsITimer> mRepeatTimer;
  static nsRepeatService* gInstance;

}; // class nsRepeatService