Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 : * vim: set ts=8 sts=4 et sw=4 tw=99:
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 ds_IdValuePair_h
8 : #define ds_IdValuePair_h
9 :
10 : #include "jsapi.h"
11 :
12 : #include "NamespaceImports.h"
13 : #include "gc/Tracer.h"
14 : #include "js/GCVector.h"
15 : #include "js/Id.h"
16 :
17 : namespace js {
18 :
19 : struct IdValuePair
20 : {
21 : Value value;
22 : jsid id;
23 :
24 6191 : IdValuePair()
25 6191 : : value(UndefinedValue()), id(JSID_EMPTY)
26 6191 : {}
27 226 : explicit IdValuePair(jsid idArg)
28 226 : : value(UndefinedValue()), id(idArg)
29 226 : {}
30 2664 : IdValuePair(jsid idArg, const Value& valueArg)
31 2664 : : value(valueArg), id(idArg)
32 2664 : {}
33 :
34 0 : void trace(JSTracer* trc) {
35 0 : TraceRoot(trc, &value, "IdValuePair::value");
36 0 : TraceRoot(trc, &id, "IdValuePair::id");
37 0 : }
38 : };
39 :
40 : using IdValueVector = JS::GCVector<IdValuePair>;
41 :
42 : } /* namespace js */
43 :
44 : #endif /* ds_IdValuePair_h */
|