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 - "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',
/* 191 - "prototypeNoCodeEvents" */ 'p', 'r', 'o', 't', 'o', 't', 'y', 'p', 'e', 'N', 'o', 'C', 'o', 'd', 'e', 'E', 'v', 'e', 'n', 't', 's', '\0',
/* 213 - "pageload" */ 'p', 'a', 'g', 'e', 'l', 'o', 'a', 'd', '\0',
/* 222 - "pageloadBaseDomain" */ 'p', 'a', 'g', 'e', 'l', 'o', 'a', 'd', 'B', 'a', 's', 'e', 'D', 'o', 'm', 'a', 'i', 'n', '\0',
/* 241 - "useCounters" */ 'u', 's', 'e', 'C', 'o', 'u', 'n', 't', 'e', 'r', 's', '\0',
/* 253 - "unexpectedScriptLoad" */ 'u', 'n', 'e', 'x', 'p', 'e', 'c', 't', 'e', 'd', 'S', 'c', 'r', 'i', 'p', 't', 'L', 'o', 'a', 'd', '\0',
/* 274 - "fxAccounts" */ 'f', 'x', 'A', 'c', 'c', 'o', 'u', 'n', 't', 's', '\0',
/* 285 - "sync" */ 's', 'y', 'n', 'c', '\0',
/* 290 - "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',
/* 315 - "hangReport" */ 'h', 'a', 'n', 'g', 'R', 'e', 'p', 'o', 'r', 't', '\0',
/* 326 - "backgroundTasks" */ 'b', 'a', 'c', 'k', 'g', 'r', 'o', 'u', 'n', 'd', 'T', 'a', 's', 'k', 's', '\0',
/* 342 - "captchaDetection" */ 'c', 'a', 'p', 't', 'c', 'h', 'a', 'D', 'e', 't', 'e', 'c', 't', 'i', 'o', 'n', '\0',
/* 359 - "crash" */ 'c', 'r', 'a', 's', 'h', '\0',
/* 365 - "dauReporting" */ 'd', 'a', 'u', 'R', 'e', 'p', 'o', 'r', 't', 'i', 'n', 'g', '\0',
/* 378 - "tempFogInitialState" */ 't', 'e', 'm', 'p', 'F', 'o', 'g', 'I', 'n', 'i', 't', 'i', 'a', 'l', 'S', 't', 'a', 't', 'e', '\0',
/* 398 - "collectionDisabledPing" */ 'c', 'o', 'l', 'l', 'e', 'c', 't', 'i', 'o', 'n', 'D', 'i', 's', 'a', 'b', 'l', 'e', 'd', 'P', 'i', 'n', 'g', '\0',
/* 421 - "disabledPing" */ 'd', 'i', 's', 'a', 'b', 'l', 'e', 'd', 'P', 'i', 'n', 'g', '\0',
/* 434 - "onePingOnly" */ 'o', 'n', 'e', 'P', 'i', 'n', 'g', 'O', 'n', 'l', 'y', '\0',
/* 446 - "rideAlongPing" */ 'r', 'i', 'd', 'e', 'A', 'l', 'o', 'n', 'g', 'P', 'i', 'n', 'g', '\0',
/* 460 - "testOhttpPing" */ 't', 'e', 's', 't', 'O', 'h', 't', 't', 'p', 'P', 'i', 'n', 'g', '\0',
/* 474 - "testPing" */ 't', 'e', 's', 't', 'P', 'i', 'n', 'g', '\0',
/* 483 - "heartbeat" */ 'h', 'e', 'a', 'r', 't', 'b', 'e', 'a', 't', '\0',
/* 493 - "nimbusTargetingContext" */ 'n', 'i', 'm', 'b', 'u', 's', 'T', 'a', 'r', 'g', 'e', 't', 'i', 'n', 'g', 'C', 'o', 'n', 't', 'e', 'x', 't', '\0',
/* 516 - "brokenSiteReport" */ 'b', 'r', 'o', 'k', 'e', 'n', 'S', 'i', 't', 'e', 'R', 'e', 'p', 'o', 'r', 't', '\0',
/* 533 - "userCharacteristics" */ 'u', 's', 'e', 'r', 'C', 'h', 'a', 'r', 'a', 'c', 't', 'e', 'r', 'i', 's', 't', 'i', 'c', 's', '\0',
/* 553 - "onboardingOptOut" */ 'o', 'n', 'b', 'o', 'a', 'r', 'd', 'i', 'n', 'g', 'O', 'p', 't', 'O', 'u', 't', '\0',
/* 570 - "thirdPartyModules" */ 't', 'h', 'i', 'r', 'd', 'P', 'a', 'r', 't', 'y', 'M', 'o', 'd', 'u', 'l', 'e', 's', '\0',
/* 588 - "usageDeletionRequest" */ 'u', 's', 'a', 'g', 'e', 'D', 'e', 'l', 'e', 't', 'i', 'o', 'n', 'R', 'e', 'q', 'u', 'e', 's', 't', '\0',
/* 609 - "usageReporting" */ 'u', 's', 'a', 'g', 'e', 'R', 'e', 'p', 'o', 'r', 't', 'i', 'n', 'g', '\0',
/* 624 - "firstStartup" */ 'f', 'i', 'r', 's', 't', 'S', 't', 'a', 'r', 't', 'u', 'p', '\0',
/* 637 - "defaultAgent" */ 'd', 'e', 'f', 'a', 'u', 'l', 't', 'A', 'g', 'e', 'n', 't', '\0',
/* 650 - "backgroundUpdate" */ 'b', 'a', 'c', 'k', 'g', 'r', 'o', 'u', 'n', 'd', 'U', 'p', 'd', 'a', 't', 'e', '\0',
/* 667 - "update" */ 'u', 'p', 'd', 'a', 't', 'e', '\0',
};
const ping_entry_t sPingByNameLookupEntries[] = {
1769850,
1835406,
1376546,
65536,
1900965,
917695,
1442107,
2490921,
2818685,
786576,
524361,
131088,
2228707,
721012,
1311005,
262181,
2163162,
393267,
655463,
1507654,
2949787,
1638759,
2294253,
1114353,
589908,
1704301,
2097612,
1179901,
2622028,
2359812,
1573206,
1245458,
2032062,
2687585,
1048798,
196631,
1966514,
2884234,
2556474,
458816,
327722,
983253,
2425365,
852134,
2753136
};
Maybe<uint32_t>
PingByNameLookup(const ns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 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