зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1600963 - reduce size of principal KeyVals; r=mccr8
By declaring the individual enum types to fit in a `uint8_t`, and rearranging the templated `KeyValT` struct, we can pack `KeyValT` to save a word of storage. Differential Revision: https://phabricator.services.mozilla.com/D55687 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
3c6e6ca1c9
Коммит
feb4f82205
|
@ -261,9 +261,10 @@ class BasePrincipal : public nsJSPrincipals {
|
|||
template<typename SerializedKey>
|
||||
struct KeyValT
|
||||
{
|
||||
static_assert(sizeof(SerializedKey) == 1, "SerializedKey should be a uint8_t");
|
||||
SerializedKey key;
|
||||
bool valueWasSerialized;
|
||||
nsCString value;
|
||||
SerializedKey key;
|
||||
};
|
||||
|
||||
private:
|
||||
|
|
|
@ -59,7 +59,7 @@ class ContentPrincipal final : public BasePrincipal {
|
|||
|
||||
virtual nsresult PopulateJSONObject(Json::Value& aObject) override;
|
||||
// Serializable keys are the valid enum fields the serialization supports
|
||||
enum SerializableKeys { eURI = 0, eDomain, eSuffix, eMax = eSuffix };
|
||||
enum SerializableKeys : uint8_t { eURI = 0, eDomain, eSuffix, eMax = eSuffix };
|
||||
typedef mozilla::BasePrincipal::KeyValT<SerializableKeys> KeyVal;
|
||||
|
||||
static already_AddRefed<BasePrincipal> FromProperties(
|
||||
|
|
|
@ -62,7 +62,7 @@ class ExpandedPrincipal : public nsIExpandedPrincipal,
|
|||
|
||||
virtual nsresult PopulateJSONObject(Json::Value& aObject) override;
|
||||
// Serializable keys are the valid enum fields the serialization supports
|
||||
enum SerializableKeys { eSpecs = 0, eSuffix, eMax = eSuffix };
|
||||
enum SerializableKeys : uint8_t { eSpecs = 0, eSuffix, eMax = eSuffix };
|
||||
typedef mozilla::BasePrincipal::KeyValT<SerializableKeys> KeyVal;
|
||||
|
||||
static already_AddRefed<BasePrincipal> FromProperties(
|
||||
|
|
|
@ -86,7 +86,7 @@ class NullPrincipal final : public BasePrincipal {
|
|||
virtual nsresult PopulateJSONObject(Json::Value& aObject) override;
|
||||
|
||||
// Serializable keys are the valid enum fields the serialization supports
|
||||
enum SerializableKeys { eSpec = 0, eSuffix, eMax = eSuffix };
|
||||
enum SerializableKeys : uint8_t { eSpec = 0, eSuffix, eMax = eSuffix };
|
||||
typedef mozilla::BasePrincipal::KeyValT<SerializableKeys> KeyVal;
|
||||
|
||||
static already_AddRefed<BasePrincipal> FromProperties(
|
||||
|
|
Загрузка…
Ссылка в новой задаче