Source code
Copy as Markdown
Other Tools
// -*- mode: C++ -*-
// AUTOGENERATED BY glean_parser. DO NOT EDIT.
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
#include "mozilla/glean/bindings/GleanJSPingsLookup.h"
#include "mozilla/PerfectHash.h"
#include "nsString.h"
#include "mozilla/PerfectHash.h"
#define GLEAN_PING_INDEX_BITS (16)
#define GLEAN_PING_ID(entry) ((entry) >> GLEAN_PING_INDEX_BITS)
#define GLEAN_PING_INDEX(entry) ((entry) & ((1UL << GLEAN_PING_INDEX_BITS) - 1))
namespace mozilla::glean {
// Contains the ping id and the index into the ping string table.
using ping_entry_t = uint32_t;
Maybe<uint32_t> ping_result_check(const nsACString& aKey, ping_entry_t aEntry);
#if defined(_MSC_VER) && !defined(__clang__)
const char gPingStringTable[] = {
#else
constexpr char gPingStringTable[] = {
#endif
/* 0 - "messagingSystem" */ 'm', 'e', 's', 's', 'a', 'g', 'i', 'n', 'g', 'S', 'y', 's', 't', 'e', 'm', '\0',
/* 16 - "newtab" */ 'n', 'e', 'w', 't', 'a', 'b', '\0',
/* 23 - "newtabContent" */ 'n', 'e', 'w', 't', 'a', 'b', 'C', 'o', 'n', 't', 'e', 'n', 't', '\0',
/* 37 - "spoc" */ 's', 'p', 'o', 'c', '\0',
/* 42 - "topSites" */ 't', 'o', 'p', 'S', 'i', 't', 'e', 's', '\0',
/* 51 - "pocketButton" */ 'p', 'o', 'c', 'k', 'e', 't', 'B', 'u', 't', 't', 'o', 'n', '\0',
/* 64 - "profiles" */ 'p', 'r', 'o', 'f', 'i', 'l', 'e', 's', '\0',
/* 73 - "searchWith" */ 's', 'e', 'a', 'r', 'c', 'h', 'W', 'i', 't', 'h', '\0',
/* 84 - "serpCategorization" */ 's', 'e', 'r', 'p', 'C', 'a', 't', 'e', 'g', 'o', 'r', 'i', 'z', 'a', 't', 'i', 'o', 'n', '\0',
/* 103 - "quickSuggest" */ 'q', 'u', 'i', 'c', 'k', 'S', 'u', 'g', 'g', 'e', 's', 't', '\0',
/* 116 - "quickSuggestDeletionRequest" */ 'q', 'u', 'i', 'c', 'k', 'S', 'u', 'g', 'g', 'e', 's', 't', 'D', 'e', 'l', 'e', 't', 'i', 'o', 'n', 'R', 'e', 'q', 'u', 'e', 's', 't', '\0',
/* 144 - "urlbarKeywordExposure" */ 'u', 'r', 'l', 'b', 'a', 'r', 'K', 'e', 'y', 'w', 'o', 'r', 'd', 'E', 'x', 'p', 'o', 's', 'u', 'r', 'e', '\0',
/* 166 - "dataLeakBlocker" */ 'd', 'a', 't', 'a', 'L', 'e', 'a', 'k', 'B', 'l', 'o', 'c', 'k', 'e', 'r', '\0',
/* 182 - "contextIdDeletionRequest" */ 'c', 'o', 'n', 't', 'e', 'x', 't', 'I', 'd', 'D', 'e', 'l', 'e', 't', 'i', 'o', 'n', 'R', 'e', 'q', 'u', 'e', 's', 't', '\0',
/* 207 - "prototypeNoCodeEvents" */ 'p', 'r', 'o', 't', 'o', 't', 'y', 'p', 'e', 'N', 'o', 'C', 'o', 'd', 'e', 'E', 'v', 'e', 'n', 't', 's', '\0',
/* 229 - "pageload" */ 'p', 'a', 'g', 'e', 'l', 'o', 'a', 'd', '\0',
/* 238 - "pageloadBaseDomain" */ 'p', 'a', 'g', 'e', 'l', 'o', 'a', 'd', 'B', 'a', 's', 'e', 'D', 'o', 'm', 'a', 'i', 'n', '\0',
/* 257 - "useCounters" */ 'u', 's', 'e', 'C', 'o', 'u', 'n', 't', 'e', 'r', 's', '\0',
/* 269 - "unexpectedScriptLoad" */ 'u', 'n', 'e', 'x', 'p', 'e', 'c', 't', 'e', 'd', 'S', 'c', 'r', 'i', 'p', 't', 'L', 'o', 'a', 'd', '\0',
/* 290 - "fxAccounts" */ 'f', 'x', 'A', 'c', 'c', 'o', 'u', 'n', 't', 's', '\0',
/* 301 - "sync" */ 's', 'y', 'n', 'c', '\0',
/* 306 - "bounceTrackingProtection" */ 'b', 'o', 'u', 'n', 'c', 'e', 'T', 'r', 'a', 'c', 'k', 'i', 'n', 'g', 'P', 'r', 'o', 't', 'e', 'c', 't', 'i', 'o', 'n', '\0',
/* 331 - "hangReport" */ 'h', 'a', 'n', 'g', 'R', 'e', 'p', 'o', 'r', 't', '\0',
/* 342 - "backgroundTasks" */ 'b', 'a', 'c', 'k', 'g', 'r', 'o', 'u', 'n', 'd', 'T', 'a', 's', 'k', 's', '\0',
/* 358 - "captchaDetection" */ 'c', 'a', 'p', 't', 'c', 'h', 'a', 'D', 'e', 't', 'e', 'c', 't', 'i', 'o', 'n', '\0',
/* 375 - "crash" */ 'c', 'r', 'a', 's', 'h', '\0',
/* 381 - "traces" */ 't', 'r', 'a', 'c', 'e', 's', '\0',
/* 388 - "dauReporting" */ 'd', 'a', 'u', 'R', 'e', 'p', 'o', 'r', 't', 'i', 'n', 'g', '\0',
/* 401 - "tempFogInitialState" */ 't', 'e', 'm', 'p', 'F', 'o', 'g', 'I', 'n', 'i', 't', 'i', 'a', 'l', 'S', 't', 'a', 't', 'e', '\0',
/* 421 - "collectionDisabledPing" */ 'c', 'o', 'l', 'l', 'e', 'c', 't', 'i', 'o', 'n', 'D', 'i', 's', 'a', 'b', 'l', 'e', 'd', 'P', 'i', 'n', 'g', '\0',
/* 444 - "disabledPing" */ 'd', 'i', 's', 'a', 'b', 'l', 'e', 'd', 'P', 'i', 'n', 'g', '\0',
/* 457 - "onePingOnly" */ 'o', 'n', 'e', 'P', 'i', 'n', 'g', 'O', 'n', 'l', 'y', '\0',
/* 469 - "rideAlongPing" */ 'r', 'i', 'd', 'e', 'A', 'l', 'o', 'n', 'g', 'P', 'i', 'n', 'g', '\0',
/* 483 - "testOhttpPing" */ 't', 'e', 's', 't', 'O', 'h', 't', 't', 'p', 'P', 'i', 'n', 'g', '\0',
/* 497 - "testPing" */ 't', 'e', 's', 't', 'P', 'i', 'n', 'g', '\0',
/* 506 - "heartbeat" */ 'h', 'e', 'a', 'r', 't', 'b', 'e', 'a', 't', '\0',
/* 516 - "nimbusTargetingContext" */ 'n', 'i', 'm', 'b', 'u', 's', 'T', 'a', 'r', 'g', 'e', 't', 'i', 'n', 'g', 'C', 'o', 'n', 't', 'e', 'x', 't', '\0',
/* 539 - "brokenSiteReport" */ 'b', 'r', 'o', 'k', 'e', 'n', 'S', 'i', 't', 'e', 'R', 'e', 'p', 'o', 'r', 't', '\0',
/* 556 - "userCharacteristics" */ 'u', 's', 'e', 'r', 'C', 'h', 'a', 'r', 'a', 'c', 't', 'e', 'r', 'i', 's', 't', 'i', 'c', 's', '\0',
/* 576 - "onboardingOptOut" */ 'o', 'n', 'b', 'o', 'a', 'r', 'd', 'i', 'n', 'g', 'O', 'p', 't', 'O', 'u', 't', '\0',
/* 593 - "thirdPartyModules" */ 't', 'h', 'i', 'r', 'd', 'P', 'a', 'r', 't', 'y', 'M', 'o', 'd', 'u', 'l', 'e', 's', '\0',
/* 611 - "usageDeletionRequest" */ 'u', 's', 'a', 'g', 'e', 'D', 'e', 'l', 'e', 't', 'i', 'o', 'n', 'R', 'e', 'q', 'u', 'e', 's', 't', '\0',
/* 632 - "usageReporting" */ 'u', 's', 'a', 'g', 'e', 'R', 'e', 'p', 'o', 'r', 't', 'i', 'n', 'g', '\0',
/* 647 - "firstStartup" */ 'f', 'i', 'r', 's', 't', 'S', 't', 'a', 'r', 't', 'u', 'p', '\0',
/* 660 - "defaultAgent" */ 'd', 'e', 'f', 'a', 'u', 'l', 't', 'A', 'g', 'e', 'n', 't', '\0',
/* 673 - "backgroundUpdate" */ 'b', 'a', 'c', 'k', 'g', 'r', 'o', 'u', 'n', 'd', 'U', 'p', 'd', 'a', 't', 'e', '\0',
/* 690 - "update" */ 'u', 'p', 'd', 'a', 't', 'e', '\0',
};
const ping_entry_t sPingByNameLookupEntries[] = {
2294257,
2753123,
1507659,
393267,
1311010,
786576,
1376557,
917686,
2163157,
655463,
1638758,
1245453,
589908,
1114350,
1900945,
3080882,
2884231,
721012,
1048805,
2818680,
2359802,
196631,
262181,
2622016,
65536,
327722,
2097609,
1442098,
3015329,
1704311,
2687569,
524361,
2490907,
983247,
131088,
2556460,
2228707,
458816,
2949780,
2032060,
1966501,
1179905,
1573206,
2425348,
1769853,
852134,
1835396
};
Maybe<uint32_t>
PingByNameLookup(const nsACString& aKey)
{
static const uint8_t BASES[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 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 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
const char* bytes = aKey.BeginReading();
size_t length = aKey.Length();
auto& entry = mozilla::perfecthash::Lookup(bytes, length, BASES,
sPingByNameLookupEntries);
return ping_result_check(aKey, entry);
}
/**
* Get a ping's name given its entry from the PHF.
*/
const char* GetPingName(ping_entry_t aEntry) {
uint32_t idx = GLEAN_PING_INDEX(aEntry);
MOZ_ASSERT(idx < sizeof(gPingStringTable), "Ping index larger than string table");
return &gPingStringTable[idx];
}
/**
* Check if the found entry is pointing at the correct ping.
* PHF can false-positive a result when the key isn't present, so we check
* for a string match. If it fails, return Nothing(). If we found it,
* return the ping's id.
*/
Maybe<uint32_t> ping_result_check(const nsACString& aKey, ping_entry_t aEntry) {
uint32_t idx = GLEAN_PING_INDEX(aEntry);
uint32_t id = GLEAN_PING_ID(aEntry);
if (MOZ_UNLIKELY(idx > sizeof(gPingStringTable))) {
return Nothing();
}
if (aKey.EqualsASCII(&gPingStringTable[idx])) {
return Some(id);
}
return Nothing();
}
#undef GLEAN_PING_INDEX_BITS
#undef GLEAN_PING_ID
#undef GLEAN_PING_INDEX
} // namespace mozilla::glean