Bug 1461182 reduce nsHostRecord overhead by about 40 bytes r=bagder
MozReview-Commit-ID: DvmJE5LcDwQ
--- a/netwerk/dns/nsHostResolver.cpp
+++ b/netwerk/dns/nsHostResolver.cpp
@@ -185,32 +185,31 @@ nsHostKey::SizeOfExcludingThis(mozilla::
nsHostRecord::nsHostRecord(const nsHostKey& key)
: nsHostKey(key)
, addr_info_lock("nsHostRecord.addr_info_lock")
, addr_info_gencnt(0)
, addr_info(nullptr)
, addr(nullptr)
, negative(false)
, mResolving(0)
+ , mTRRSuccess(0)
+ , mNativeSuccess(0)
, mNative(false)
- , mTRRSuccess(0)
, mTRRUsed(false)
, mNativeUsed(false)
- , mNativeSuccess(false)
- , mFirstTRR(nullptr)
, onQueue(false)
, usingAnyThread(false)
, mDoomed(false)
, mDidCallbacks(false)
, mGetTtl(false)
+ , mResolveAgain(false)
, mTrrAUsed(INIT)
, mTrrAAAAUsed(INIT)
, mTrrLock("nsHostRecord.mTrrLock")
, mBlacklistedCount(0)
- , mResolveAgain(false)
{
}
void
nsHostRecord::Cancel()
{
MutexAutoLock trrlock(mTrrLock);
if (mTrrA) {
--- a/netwerk/dns/nsHostResolver.h
+++ b/netwerk/dns/nsHostResolver.h
@@ -171,48 +171,49 @@ public:
mozilla::net::ResolverMode mResolverMode;
private:
friend class nsHostResolver;
explicit nsHostRecord(const nsHostKey& key);
mozilla::LinkedList<RefPtr<nsResolveHostCallback>> mCallbacks;
+ nsAutoPtr<mozilla::net::AddrInfo> mFirstTRR; // partial TRR storage
- int mResolving; // counter of outstanding resolving calls
- bool mNative; // true if this record is being resolved "natively",
- // which means that it is either on the pending queue
- // or owned by one of the worker threads. */
- int mTRRSuccess; // number of successful TRR responses
- bool mTRRUsed; // TRR was used on this record
- bool mNativeUsed;
- int mNativeSuccess; // number of native lookup responses
- nsAutoPtr<mozilla::net::AddrInfo> mFirstTRR; // partial TRR storage
- bool onQueue; // true if pending and on the queue (not yet given to getaddrinfo())
- bool usingAnyThread; // true if off queue and contributing to mActiveAnyThreadCount
- bool mDoomed; // explicitly expired
- bool mDidCallbacks;
- bool mGetTtl;
+ uint16_t mResolving; // counter of outstanding resolving calls
+ uint8_t mTRRSuccess; // number of successful TRR responses
+ uint8_t mNativeSuccess; // number of native lookup responses
+
+ uint16_t mNative : 1; // true if this record is being resolved "natively",
+ // which means that it is either on the pending queue
+ // or owned by one of the worker threads. */
+ uint16_t mTRRUsed : 1; // TRR was used on this record
+ uint16_t mNativeUsed : 1;
+ uint16_t onQueue : 1; // true if pending and on the queue (not yet given to getaddrinfo())
+ uint16_t usingAnyThread : 1; // true if off queue and contributing to mActiveAnyThreadCount
+ uint16_t mDoomed : 1; // explicitly expired
+ uint16_t mDidCallbacks : 1;
+ uint16_t mGetTtl : 1;
+
+ // when the results from this resolve is returned, it is not to be
+ // trusted, but instead a new resolve must be made!
+ uint16_t mResolveAgain : 1;
enum {
INIT, STARTED, OK, FAILED
} mTrrAUsed, mTrrAAAAUsed;
Mutex mTrrLock; // lock when accessing the mTrrA[AAA] pointers
RefPtr<mozilla::net::TRR> mTrrA;
RefPtr<mozilla::net::TRR> mTrrAAAA;
// The number of times ReportUnusable() has been called in the record's
// lifetime.
uint32_t mBlacklistedCount;
- // when the results from this resolve is returned, it is not to be
- // trusted, but instead a new resolve must be made!
- bool mResolveAgain;
-
// a list of addresses associated with this record that have been reported
// as unusable. the list is kept as a set of strings to make it independent
// of gencnt.
nsTArray<nsCString> mBlacklistedItems;
~nsHostRecord();
};