Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/DDLogValue.h
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* vim:set ts=2 sw=2 sts=2 et cindent: */
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 DDLogValue_h_
8
#define DDLogValue_h_
9
10
#include "DDLogObject.h"
11
#include "MediaResult.h"
12
#include "mozilla/Variant.h"
13
#include "nsString.h"
14
15
namespace mozilla {
16
17
// Placeholder when no value is needed.
18
struct DDNoValue
19
{
20
};
21
22
// Value capturing a range (typically an offset and a number of bytes in a
23
// resource).
24
struct DDRange
25
{
26
  const int64_t mOffset;
27
  const int64_t mBytes;
28
  DDRange(int64_t aOffset, int64_t aBytes)
29
    : mOffset(aOffset)
30
    , mBytes(aBytes)
31
0
  {
32
0
  }
33
};
34
35
// Value associated with a log message.
36
using DDLogValue = Variant<DDNoValue,
37
                           DDLogObject,
38
                           const char*, // Assumed to be a literal string.
39
                           const nsCString,
40
                           bool,
41
                           int8_t,
42
                           uint8_t,
43
                           int16_t,
44
                           uint16_t,
45
                           int32_t,
46
                           uint32_t,
47
                           int64_t,
48
                           uint64_t,
49
                           double,
50
                           DDRange,
51
                           nsresult,
52
                           MediaResult>;
53
54
void
55
AppendToString(const DDLogValue& aValue, nsCString& aString);
56
57
class JSONWriter;
58
void
59
ToJSON(const DDLogValue& aValue,
60
       JSONWriter& aJSONWriter,
61
       const char* aPropertyName);
62
63
} // namespace mozilla
64
65
#endif // DDLogValue_h_