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 js_UbiNodeUtils_h
8 #define js_UbiNodeUtils_h
12 #include "js/UbiNode.h"
13 #include "js/UniquePtr.h"
16 using JS::ubi::EdgeRange
;
17 using JS::ubi::EdgeVector
;
21 // An EdgeRange concrete class that simply holds a vector of Edges,
22 // populated by the addTracerEdges method.
23 class SimpleEdgeRange
: public EdgeRange
{
28 void settle() { front_
= i
< edges
.length() ? &edges
[i
] : nullptr; }
31 explicit SimpleEdgeRange() : edges(), i(0) {}
33 bool addTracerEdges(JSRuntime
* rt
, void* thing
, JS::TraceKind kind
,
36 bool addEdge(Edge edge
) {
37 if (!edges
.append(std::move(edge
))) return false;
42 void popFront() override
{
51 #endif // js_UbiNodeUtils_h