Line data Source code
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 mozilla_DebuggerOnGCRunnable_h
8 : #define mozilla_DebuggerOnGCRunnable_h
9 :
10 : #include "nsThreadUtils.h"
11 : #include "js/GCAPI.h"
12 : #include "mozilla/Move.h"
13 : #include "mozilla/UniquePtr.h"
14 :
15 : namespace mozilla {
16 :
17 : // Runnable to fire the SpiderMonkey Debugger API's onGarbageCollection hook.
18 0 : class DebuggerOnGCRunnable : public CancelableRunnable
19 : {
20 : JS::dbg::GarbageCollectionEvent::Ptr mGCData;
21 :
22 0 : explicit DebuggerOnGCRunnable(JS::dbg::GarbageCollectionEvent::Ptr&& aGCData)
23 0 : : CancelableRunnable("DebuggerOnGCRunnable"), mGCData(Move(aGCData))
24 0 : { }
25 :
26 : public:
27 : static nsresult Enqueue(JSContext* aCx, const JS::GCDescription& aDesc);
28 :
29 : NS_DECL_NSIRUNNABLE
30 : nsresult Cancel() override;
31 : };
32 :
33 : } // namespace mozilla
34 :
35 : #endif // ifdef mozilla_dom_DebuggerOnGCRunnable_h
|