michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_HangMonitor_h michael@0: #define mozilla_HangMonitor_h michael@0: michael@0: namespace mozilla { namespace HangMonitor { michael@0: michael@0: /** michael@0: * Signifies the type of activity in question michael@0: */ michael@0: enum ActivityType { michael@0: /* There is activity and it is known to be UI related activity. */ michael@0: kUIActivity, michael@0: michael@0: /* There is non UI activity and no UI activity is pending */ michael@0: kActivityNoUIAVail, michael@0: michael@0: /* There is non UI activity and UI activity is known to be pending */ michael@0: kActivityUIAVail, michael@0: michael@0: /* There is non UI activity and UI activity pending is unknown */ michael@0: kGeneralActivity michael@0: }; michael@0: michael@0: /** michael@0: * Start monitoring hangs. Should be called by the XPCOM startup process only. michael@0: */ michael@0: void Startup(); michael@0: michael@0: /** michael@0: * Stop monitoring hangs and join the thread. michael@0: */ michael@0: void Shutdown(); michael@0: michael@0: /** michael@0: * Notify the hang monitor of activity which will reset its internal timer. michael@0: * michael@0: * @param activityType The type of activity being reported. michael@0: * @see ActivityType michael@0: */ michael@0: void NotifyActivity(ActivityType activityType = kGeneralActivity); michael@0: michael@0: /* michael@0: * Notify the hang monitor that the browser is now idle and no detection should michael@0: * be done. michael@0: */ michael@0: void Suspend(); michael@0: michael@0: } } // namespace mozilla::HangMonitor michael@0: michael@0: #endif // mozilla_HangMonitor_h