ResourceLoadStatistics.h [plain text]
#pragma once
#include "CanvasActivityRecord.h"
#include <wtf/HashCountedSet.h>
#include <wtf/HashSet.h>
#include <wtf/OptionSet.h>
#include <wtf/URL.h>
#include <wtf/WallTime.h>
#include <wtf/text/StringHash.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
class KeyedDecoder;
class KeyedEncoder;
struct ResourceLoadStatistics {
explicit ResourceLoadStatistics(const String& primaryDomain)
: highLevelDomain(primaryDomain)
{
}
ResourceLoadStatistics() = default;
ResourceLoadStatistics(const ResourceLoadStatistics&) = delete;
ResourceLoadStatistics& operator=(const ResourceLoadStatistics&) = delete;
ResourceLoadStatistics(ResourceLoadStatistics&&) = default;
ResourceLoadStatistics& operator=(ResourceLoadStatistics&&) = default;
WEBCORE_EXPORT static String primaryDomain(const URL&);
WEBCORE_EXPORT static String primaryDomain(StringView host);
WEBCORE_EXPORT static WallTime reduceTimeResolution(WallTime);
WEBCORE_EXPORT void encode(KeyedEncoder&) const;
WEBCORE_EXPORT bool decode(KeyedDecoder&, unsigned modelVersion);
WEBCORE_EXPORT String toString() const;
WEBCORE_EXPORT void merge(const ResourceLoadStatistics&);
String highLevelDomain;
WallTime lastSeen;
bool hadUserInteraction { false };
WallTime mostRecentUserInteractionTime { WallTime::fromRawSeconds(-1) };
bool grandfathered { false };
HashSet<String> storageAccessUnderTopFrameOrigins;
HashCountedSet<String> topFrameUniqueRedirectsTo;
HashCountedSet<String> topFrameUniqueRedirectsFrom;
HashCountedSet<String> subframeUnderTopFrameOrigins;
HashCountedSet<String> subresourceUnderTopFrameOrigins;
HashCountedSet<String> subresourceUniqueRedirectsTo;
HashCountedSet<String> subresourceUniqueRedirectsFrom;
bool isPrevalentResource { false };
bool isVeryPrevalentResource { false };
unsigned dataRecordsRemoved { 0 };
unsigned timesAccessedAsFirstPartyDueToUserInteraction { 0 };
unsigned timesAccessedAsFirstPartyDueToStorageAccessAPI { 0 };
enum class NavigatorAPI : uint64_t {
AppVersion = 1 << 0,
UserAgent = 1 << 1,
Plugins = 1 << 2,
MimeTypes = 1 << 3,
CookieEnabled = 1 << 4,
JavaEnabled = 1 << 5,
};
enum class ScreenAPI : uint64_t {
Height = 1 << 0,
Width = 1 << 1,
ColorDepth = 1 << 2,
PixelDepth = 1 << 3,
AvailLeft = 1 << 4,
AvailTop = 1 << 5,
AvailHeight = 1 << 6,
AvailWidth = 1 << 7,
};
#if ENABLE(WEB_API_STATISTICS)
HashCountedSet<String> topFrameRegistrableDomainsWhichAccessedWebAPIs;
HashSet<String> fontsFailedToLoad;
HashSet<String> fontsSuccessfullyLoaded;
CanvasActivityRecord canvasActivityRecord;
OptionSet<NavigatorAPI> navigatorFunctionsAccessed;
OptionSet<ScreenAPI> screenFunctionsAccessed;
#endif
};
}