diff options
Diffstat (limited to 'Source/WebCore/page/Navigator.cpp')
| -rw-r--r-- | Source/WebCore/page/Navigator.cpp | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/Source/WebCore/page/Navigator.cpp b/Source/WebCore/page/Navigator.cpp index b88015b79..25895bf54 100644 --- a/Source/WebCore/page/Navigator.cpp +++ b/Source/WebCore/page/Navigator.cpp @@ -2,7 +2,7 @@ * Copyright (C) 2000 Harri Porten (porten@kde.org) * Copyright (c) 2000 Daniel Molkentin (molkentin@kde.org) * Copyright (c) 2000 Stefan Schimanski (schimmi@kde.org) - * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc. + * Copyright (C) 2003, 2004, 2005, 2006 Apple Inc. * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) * * This library is free software; you can redistribute it and/or @@ -37,10 +37,12 @@ #include "ScriptController.h" #include "SecurityOrigin.h" #include "Settings.h" -#include "StorageNamespace.h" #include <wtf/HashSet.h> +#include <wtf/NumberOfCores.h> #include <wtf/StdLibExtras.h> +using namespace WTF; + namespace WebCore { Navigator::Navigator(Frame* frame) @@ -132,6 +134,28 @@ bool Navigator::javaEnabled() const return true; } +#if defined(ENABLE_NAVIGATOR_HWCONCURRENCY) +int Navigator::hardwareConcurrency() const +{ + // Enforce a maximum for the number of cores reported to mitigate + // fingerprinting for the minority of machines with large numbers of cores. + // If machines with more than 8 cores become commonplace, we should bump this number. + // see https://bugs.webkit.org/show_bug.cgi?id=132588 for the + // rationale behind this decision. +#if PLATFORM(IOS) + const int maxCoresToReport = 2; +#else + const int maxCoresToReport = 8; +#endif + int hardwareConcurrency = numberOfProcessorCores(); + + if (hardwareConcurrency > maxCoresToReport) + return maxCoresToReport; + + return hardwareConcurrency; +} +#endif + #if PLATFORM(IOS) bool Navigator::standalone() const { |
