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 XPCOM_THREADS_NSIDELAYEDRUNNABLEOBSERVER_H_ 8 #define XPCOM_THREADS_NSIDELAYEDRUNNABLEOBSERVER_H_ 9 10 #include "nsISupports.h" 11 12 namespace mozilla { 13 class DelayedRunnable; 14 } 15 16 #define NS_IDELAYEDRUNNABLEOBSERVER_IID \ 17 { \ 18 0xd226bade, 0xac13, 0x46fe, { \ 19 0x9f, 0xcc, 0xde, 0xe7, 0x48, 0x35, 0xcd, 0x82 \ 20 } \ 21 } 22 23 class NS_NO_VTABLE nsIDelayedRunnableObserver : public nsISupports { 24 public: 25 NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDELAYEDRUNNABLEOBSERVER_IID) 26 27 /** 28 * Called by the DelayedRunnable after being created, on the dispatching 29 * thread. This allows for various lifetime checks and gives assertions a 30 * chance to provide useful stack traces. 31 */ 32 virtual void OnDelayedRunnableCreated( 33 mozilla::DelayedRunnable* aRunnable) = 0; 34 /** 35 * Called by the DelayedRunnable on its target thread when delegating the 36 * responsibility for being run to its underlying timer. 37 */ 38 virtual void OnDelayedRunnableScheduled( 39 mozilla::DelayedRunnable* aRunnable) = 0; 40 /** 41 * Called by the DelayedRunnable on its target thread after having been run by 42 * its underlying timer. 43 */ 44 virtual void OnDelayedRunnableRan(mozilla::DelayedRunnable* aRunnable) = 0; 45 }; 46 47 NS_DEFINE_STATIC_IID_ACCESSOR(nsIDelayedRunnableObserver, 48 NS_IDELAYEDRUNNABLEOBSERVER_IID) 49 50 #endif 51