Bug 1910362 - Create new Nimbus helper r=aaronmt,ohorvath
[gecko.git] / xpcom / base / DebuggerOnGCRunnable.h
blob93ac48b56c07176b9c1139113f5fee84aaa3eecd
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/. */
7 #ifndef mozilla_DebuggerOnGCRunnable_h
8 #define mozilla_DebuggerOnGCRunnable_h
10 #include <utility>
12 #include "js/GCAPI.h"
13 #include "mozilla/UniquePtr.h"
14 #include "nsThreadUtils.h"
16 namespace mozilla {
18 // Runnable to fire the SpiderMonkey Debugger API's onGarbageCollection hook.
19 class DebuggerOnGCRunnable : public CancelableRunnable {
20 JS::dbg::GarbageCollectionEvent::Ptr mGCData;
22 explicit DebuggerOnGCRunnable(JS::dbg::GarbageCollectionEvent::Ptr&& aGCData)
23 : CancelableRunnable("DebuggerOnGCRunnable"),
24 mGCData(std::move(aGCData)) {}
26 public:
27 static nsresult Enqueue(JSContext* aCx, const JS::GCDescription& aDesc);
29 NS_DECL_NSIRUNNABLE
30 nsresult Cancel() override;
33 } // namespace mozilla
35 #endif // ifdef mozilla_dom_DebuggerOnGCRunnable_h