gecko-dev/toolkit/xre/DllPrefetchExperimentRegistryInfo.h
Emma Malysz 83e824f0c1 Bug 1640087: Part 2: tuck optimized prefetches behind a preference. r=dthayer,aklotz
PrefetchRegistryInfo is intended to be a temporary file in order to conduct
this experiment on startup times vs. retention.
Most of the implementation is similar to LauncherRegistryInfo.
If we startup and the registry is different than the preference,
we will want to use the preference for the purpose of this experiment.

Differential Revision: https://phabricator.services.mozilla.com/D76993
2020-06-22 16:38:15 +00:00

51 lines
1.4 KiB
C++

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
#ifndef mozilla_DllPrefetchExperimentRegistryInfo_h
#define mozilla_DllPrefetchExperimentRegistryInfo_h
#include "mozilla/Maybe.h"
#include "mozilla/WinHeaderOnlyUtils.h"
#include "nsWindowsHelpers.h"
/**
* This is a temporary file in order to conduct an experiment on the impact of
* startup time on retention (see Bug 1640087).
* This was generally adapted from LauncherRegistryInfo.h
*/
namespace mozilla {
enum class AlteredDllPrefetchMode {
CurrentPrefetch,
NoPrefetch,
OptimizedPrefetch
};
class DllPrefetchExperimentRegistryInfo final {
public:
DllPrefetchExperimentRegistryInfo() : mBinPath(GetFullBinaryPath().get()) {}
~DllPrefetchExperimentRegistryInfo() {}
Result<Ok, nsresult> ReflectPrefToRegistry(int32_t aVal);
Result<Ok, nsresult> ReadRegistryValueData(DWORD expectedType);
AlteredDllPrefetchMode GetAlteredDllPrefetchMode();
private:
Result<Ok, nsresult> Open();
nsAutoRegKey mRegKey;
nsString mBinPath;
int32_t mPrefetchMode;
static const wchar_t kExperimentSubKeyPath[];
};
} // namespace mozilla
#endif // mozilla_DllPrefetchExperimentRegistryInfo_h