Bug 1429647 Switch privacy.reduceTimerPrecision and privacy.resistFingerprinting to use Relaxed Semantics r=froydnj,mystor

MozReview-Commit-ID: HdW4tmQAcTT

--HG--
extra : rebase_source : c1e1c44a79cb0449da22c8fce954da078c1972e4
This commit is contained in:
Tom Ritter 2018-01-24 18:09:43 -06:00
Родитель 5431ec74a5
Коммит 41b3b96b98
3 изменённых файлов: 17 добавлений и 7 удалений

Просмотреть файл

@ -54,7 +54,7 @@ using mozilla::ArrayLength;
using mozilla::IsFinite;
using mozilla::IsNaN;
using mozilla::NumbersAreIdentical;
using mozilla::ReleaseAcquire;
using mozilla::Relaxed;
using JS::AutoCheckCannotGC;
using JS::ClippedTime;
@ -63,7 +63,7 @@ using JS::TimeClip;
using JS::ToInteger;
// When this value is non-zero, we'll round the time by this resolution.
static Atomic<uint32_t, ReleaseAcquire> sResolutionUsec;
static Atomic<uint32_t, Relaxed> sResolutionUsec;
/*
* The JS 'Date' object is patterned after the Java 'Date' object.

Просмотреть файл

@ -58,12 +58,22 @@ static mozilla::LazyLogModule gResistFingerprintingLog("nsResistFingerprinting")
NS_IMPL_ISUPPORTS(nsRFPService, nsIObserver)
/*
* The below variables are marked with 'Relaxed' memory ordering. We don't
* particurally care that threads have a percently consistent view of the values
* of these prefs. They are not expected to change often, and having an outdated
* view is not particurally harmful. They will eventually become consistent.
*
* The variables will, however, be read often (specifically sResolutionUSec on
* each timer rounding) so performance is important.
*/
static StaticRefPtr<nsRFPService> sRFPService;
static bool sInitialized = false;
Atomic<bool, ReleaseAcquire> nsRFPService::sPrivacyResistFingerprinting;
Atomic<bool, ReleaseAcquire> nsRFPService::sPrivacyTimerPrecisionReduction;
Atomic<bool, Relaxed> nsRFPService::sPrivacyResistFingerprinting;
Atomic<bool, Relaxed> nsRFPService::sPrivacyTimerPrecisionReduction;
// Note: anytime you want to use this variable, you should probably use TimerResolution() instead
Atomic<uint32_t, ReleaseAcquire> sResolutionUSec;
Atomic<uint32_t, Relaxed> sResolutionUSec;
static uint32_t sVideoFramesPerSec;
static uint32_t sVideoDroppedRatio;
static uint32_t sTargetVideoRes;

Просмотреть файл

@ -247,8 +247,8 @@ private:
const WidgetKeyboardEvent* aKeyboardEvent,
SpoofingKeyboardCode& aOut);
static Atomic<bool, ReleaseAcquire> sPrivacyResistFingerprinting;
static Atomic<bool, ReleaseAcquire> sPrivacyTimerPrecisionReduction;
static Atomic<bool, Relaxed> sPrivacyResistFingerprinting;
static Atomic<bool, Relaxed> sPrivacyTimerPrecisionReduction;
static nsDataHashtable<KeyboardHashKey, const SpoofingKeyboardCode*>* sSpoofingKeyboardCodes;