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 #include "mozilla/DebuggerOnGCRunnable.h"
12 #include "mozilla/CycleCollectedJSContext.h"
13 #include "mozilla/dom/ScriptSettings.h"
14 #include "mozilla/SchedulerGroup.h"
19 nsresult
DebuggerOnGCRunnable::Enqueue(JSContext
* aCx
,
20 const JS::GCDescription
& aDesc
) {
21 auto gcEvent
= aDesc
.toGCEvent(aCx
);
23 return NS_ERROR_OUT_OF_MEMORY
;
26 RefPtr
<DebuggerOnGCRunnable
> runOnGC
=
27 new DebuggerOnGCRunnable(std::move(gcEvent
));
28 return NS_DispatchToCurrentThread(runOnGC
);
32 DebuggerOnGCRunnable::Run() {
35 if (!JS::dbg::FireOnGarbageCollectionHook(jsapi
.cx(), std::move(mGCData
))) {
36 return NS_ERROR_OUT_OF_MEMORY
;
41 nsresult
DebuggerOnGCRunnable::Cancel() {
46 } // namespace mozilla