Backed out changeset 72d92155fb64 (bug 1481251) for bc assertion failures in /obj-firefox/dist/include/mozilla/TimeStamp.h. CLOSED TREE

This commit is contained in:
Brindusan Cristian 2018-09-27 05:58:31 +03:00
Родитель 2d89f4170e
Коммит de21f30c98
5 изменённых файлов: 514 добавлений и 863 удалений

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

@ -432,7 +432,6 @@ TRR::ReceivePush(nsIHttpChannel *pushed, nsHostRecord *pushedRec)
RefPtr<nsHostRecord> hostRecord;
nsresult rv;
rv = mHostResolver->GetHostRecord(mHost,
pushedRec->type,
pushedRec->flags, pushedRec->af,
pushedRec->pb,
pushedRec->originSuffix,

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

@ -67,22 +67,20 @@ public:
NS_DECL_NSIDNSRECORD
explicit nsDNSRecord(nsHostRecord *hostRecord)
: mIter(nullptr)
: mHostRecord(hostRecord)
, mIter(nullptr)
, mIterGenCnt(-1)
, mDone(false)
{
mHostRecord = do_QueryInterface(hostRecord);
}
, mDone(false) {}
private:
virtual ~nsDNSRecord() = default;
nsCOMPtr<AddrHostRecord> mHostRecord;
NetAddrElement *mIter;
int mIterGenCnt; // the generation count of
// mHostRecord->addr_info when we
// start iterating
bool mDone;
RefPtr<nsHostRecord> mHostRecord;
NetAddrElement *mIter;
int mIterGenCnt; // the generation count of
// mHostRecord->addr_info when we
// start iterating
bool mDone;
};
NS_IMPL_ISUPPORTS(nsDNSRecord, nsIDNSRecord)
@ -316,13 +314,12 @@ public:
NS_DECL_NSIDNSBYTYPERECORD
explicit nsDNSByTypeRecord(nsHostRecord *hostRecord)
{
mHostRecord = do_QueryInterface(hostRecord);
}
: mHostRecord(hostRecord)
{}
private:
virtual ~nsDNSByTypeRecord() = default;
nsCOMPtr<TypeHostRecord> mHostRecord;
RefPtr<nsHostRecord> mHostRecord;
};
NS_IMPL_ISUPPORTS(nsDNSByTypeRecord, nsIDNSByTypeRecord)
@ -331,7 +328,8 @@ NS_IMETHODIMP
nsDNSByTypeRecord::GetRecords(nsTArray<nsCString> &aRecords)
{
// deep copy
mHostRecord->GetRecords(aRecords);
MutexAutoLock lock(mHostRecord->mRequestByTypeResultLock);
aRecords = mHostRecord->mRequestByTypeResult;
return NS_OK;
}
@ -339,7 +337,11 @@ NS_IMETHODIMP
nsDNSByTypeRecord::GetRecordsAsOneString(nsACString &aRecords)
{
// deep copy
mHostRecord->GetRecordsAsOneString(aRecords);
MutexAutoLock lock(mHostRecord->mRequestByTypeResultLock);
for (uint32_t i = 0; i < mHostRecord->mRequestByTypeResult.Length(); i++) {
aRecords.Append(mHostRecord->mRequestByTypeResult[i]);
}
return NS_OK;
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -65,103 +65,17 @@ struct nsHostKey
PLDHashNumber Hash() const;
};
// 9c29024a-e7ea-48b0-945e-058a8687247b
#define NS_HOSTRECORD_IID \
{ 0x9c29024a, 0xe7ea, 0x48b0, {0x94, 0x5e, 0x05, 0x8a, 0x86, 0x87, 0x24, 0x7b }}
/**
* nsHostRecord - ref counted object type stored in host resolver cache.
*/
class nsHostRecord :
public mozilla::LinkedListElement<RefPtr<nsHostRecord>>,
public nsHostKey,
public nsISupports
{
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_HOSTRECORD_IID)
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const = 0;
protected:
friend class nsHostResolver;
explicit nsHostRecord(const nsHostKey& key);
virtual ~nsHostRecord();
// Mark hostrecord as not usable
void Invalidate();
enum ExpirationStatus {
EXP_VALID,
EXP_GRACE,
EXP_EXPIRED,
};
ExpirationStatus CheckExpiration(const mozilla::TimeStamp& now) const;
// Convenience function for setting the timestamps above (mValidStart,
// mValidEnd, and mGraceStart). valid and grace are durations in seconds.
void SetExpiration(const mozilla::TimeStamp& now, unsigned int valid,
unsigned int grace);
void CopyExpirationTimesAndFlagsFrom(const nsHostRecord *aFromHostRecord);
// Checks if the record is usable (not expired and has a value)
bool HasUsableResult(const mozilla::TimeStamp& now, uint16_t queryFlags = 0) const;
enum DnsPriority {
DNS_PRIORITY_LOW,
DNS_PRIORITY_MEDIUM,
DNS_PRIORITY_HIGH,
};
static DnsPriority GetPriority(uint16_t aFlags);
virtual void Cancel() = 0;
virtual bool HasUsableResultInternal() const = 0;
mozilla::LinkedList<RefPtr<nsResolveHostCallback>> mCallbacks;
bool IsAddrRecord() const {
return type == nsIDNSService::RESOLVE_TYPE_DEFAULT;
}
// When the record began being valid. Used mainly for bookkeeping.
mozilla::TimeStamp mValidStart;
// When the record is no longer valid (it's time of expiration)
mozilla::TimeStamp mValidEnd;
// When the record enters its grace period. This must be before mValidEnd.
// If a record is in its grace period (and not expired), it will be used
// but a request to refresh it will be made.
mozilla::TimeStamp mGraceStart;
const nsCString mOriginSuffix;
mozilla::net::ResolverMode mResolverMode;
uint16_t mResolving; // counter of outstanding resolving calls
uint8_t negative : 1; /* True if this record is a cache of a failed lookup.
Negative cache entries are valid just like any other
(though never for more than 60 seconds), but a use
of that negative entry forces an asynchronous refresh. */
uint8_t mDoomed : 1; // explicitly expired
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsHostRecord, NS_HOSTRECORD_IID)
// b020e996-f6ab-45e5-9bf5-1da71dd0053a
#define ADDRHOSTRECORD_IID \
{ 0xb020e996, 0xf6ab, 0x45e5, {0x9b, 0xf5, 0x1d, 0xa7, 0x1d, 0xd0, 0x05, 0x3a }}
class AddrHostRecord final : public nsHostRecord
public nsHostKey
{
typedef mozilla::Mutex Mutex;
public:
NS_DECLARE_STATIC_IID_ACCESSOR(ADDRHOSTRECORD_IID)
NS_DECL_THREADSAFE_ISUPPORTS
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(nsHostRecord)
/* a fully resolved host record has either a non-null |addr_info| or |addr|
* field. if |addr_info| is null, it implies that the |host| is an IP
@ -184,32 +98,54 @@ public:
int addr_info_gencnt; /* generation count of |addr_info| */
mozilla::net::AddrInfo *addr_info;
mozilla::UniquePtr<mozilla::net::NetAddr> addr;
bool negative; /* True if this record is a cache of a failed lookup.
Negative cache entries are valid just like any other
(though never for more than 60 seconds), but a use
of that negative entry forces an asynchronous refresh. */
enum ExpirationStatus {
EXP_VALID,
EXP_GRACE,
EXP_EXPIRED,
};
ExpirationStatus CheckExpiration(const mozilla::TimeStamp& now) const;
// When the record began being valid. Used mainly for bookkeeping.
mozilla::TimeStamp mValidStart;
// When the record is no longer valid (it's time of expiration)
mozilla::TimeStamp mValidEnd;
// When the record enters its grace period. This must be before mValidEnd.
// If a record is in its grace period (and not expired), it will be used
// but a request to refresh it will be made.
mozilla::TimeStamp mGraceStart;
// When the lookups of this record started and their durations
mozilla::TimeStamp mTrrStart;
mozilla::TimeStamp mNativeStart;
mozilla::TimeDuration mTrrDuration;
mozilla::TimeDuration mNativeDuration;
// Convenience function for setting the timestamps above (mValidStart,
// mValidEnd, and mGraceStart). valid and grace are durations in seconds.
void SetExpiration(const mozilla::TimeStamp& now, unsigned int valid,
unsigned int grace);
void CopyExpirationTimesAndFlagsFrom(const nsHostRecord *aFromHostRecord);
// Checks if the record is usable (not expired and has a value)
bool HasUsableResult(const mozilla::TimeStamp& now, uint16_t queryFlags = 0) const;
// Mark hostrecord as not usable
void Invalidate();
// hold addr_info_lock when calling the blacklist functions
bool Blacklisted(mozilla::net::NetAddr *query);
void ResetBlacklist();
void ReportUnusable(mozilla::net::NetAddr *addr);
size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const override;
bool IsTRR() { return mTRRUsed; }
private:
friend class nsHostResolver;
explicit AddrHostRecord(const nsHostKey& key);
~AddrHostRecord();
// Checks if the record is usable (not expired and has a value)
bool HasUsableResultInternal() const override;
void Cancel() override;
bool RemoveOrRefresh(); // Mark records currently being resolved as needed
// to resolve again.
void ResolveComplete();
size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
enum DnsPriority {
DNS_PRIORITY_LOW,
@ -218,15 +154,26 @@ private:
};
static DnsPriority GetPriority(uint16_t aFlags);
// When the lookups of this record started and their durations
mozilla::TimeStamp mTrrStart;
mozilla::TimeStamp mNativeStart;
mozilla::TimeDuration mTrrDuration;
mozilla::TimeDuration mNativeDuration;
bool RemoveOrRefresh(); // Mark records currently being resolved as needed
// to resolve again.
bool IsTRR() { return mTRRUsed; }
void ResolveComplete();
void Cancel();
mozilla::net::ResolverMode mResolverMode;
nsTArray<nsCString> mRequestByTypeResult;
Mutex mRequestByTypeResultLock;
private:
friend class nsHostResolver;
explicit nsHostRecord(const nsHostKey& key);
mozilla::LinkedList<RefPtr<nsResolveHostCallback>> mCallbacks;
nsAutoPtr<mozilla::net::AddrInfo> mFirstTRR; // partial TRR storage
nsresult mFirstTRRresult;
uint16_t mResolving; // counter of outstanding resolving calls
uint8_t mTRRSuccess; // number of successful TRR responses
uint8_t mNativeSuccess; // number of native lookup responses
@ -237,6 +184,7 @@ private:
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;
@ -251,6 +199,7 @@ private:
Mutex mTrrLock; // lock when accessing the mTrrA[AAA] pointers
RefPtr<mozilla::net::TRR> mTrrA;
RefPtr<mozilla::net::TRR> mTrrAAAA;
RefPtr<mozilla::net::TRR> mTrrTxt;
// The number of times ReportUnusable() has been called in the record's
// lifetime.
@ -261,51 +210,9 @@ private:
// of gencnt.
nsTArray<nsCString> mBlacklistedItems;
~nsHostRecord();
};
NS_DEFINE_STATIC_IID_ACCESSOR(AddrHostRecord, ADDRHOSTRECORD_IID)
// 77b786a7-04be-44f2-987c-ab8aa96676e0
#define TYPEHOSTRECORD_IID \
{ 0x77b786a7, 0x04be, 0x44f2, {0x98, 0x7c, 0xab, 0x8a, 0xa9, 0x66, 0x76, 0xe0 }}
class TypeHostRecord final : public nsHostRecord
{
public:
NS_DECLARE_STATIC_IID_ACCESSOR(TYPEHOSTRECORD_IID)
NS_DECL_THREADSAFE_ISUPPORTS
void GetRecords(nsTArray<nsCString> &aRecords);
void GetRecordsAsOneString(nsACString &aRecords);
size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const override;
private:
friend class nsHostResolver;
explicit TypeHostRecord(const nsHostKey& key);
~TypeHostRecord();
// Checks if the record is usable (not expired and has a value)
bool HasUsableResultInternal() const override;
void Cancel() override;
bool HasUsableResult();
mozilla::Mutex mTrrLock; // lock when accessing the mTrr pointer
RefPtr<mozilla::net::TRR> mTrr;
nsTArray<nsCString> mResults;
mozilla::Mutex mResultsLock;
// When the lookups of this record started (for telemetry).
mozilla::TimeStamp mStart;
};
NS_DEFINE_STATIC_IID_ACCESSOR(TypeHostRecord, TYPEHOSTRECORD_IID)
/**
* This class is used to notify listeners when a ResolveHost operation is
* complete. Classes that derive it must implement threadsafe nsISupports
@ -372,7 +279,7 @@ public:
virtual LookupStatus CompleteLookupByType(nsHostRecord *, nsresult,
const nsTArray<nsCString> *aResult,
uint32_t aTtl, bool pb) = 0;
virtual nsresult GetHostRecord(const nsACString &host, uint16_t type,
virtual nsresult GetHostRecord(const nsACString &host,
uint16_t flags, uint16_t af, bool pb,
const nsCString &originSuffix,
nsHostRecord **result)
@ -491,7 +398,7 @@ public:
LookupStatus CompleteLookupByType(nsHostRecord *, nsresult,
const nsTArray<nsCString> *aResult,
uint32_t aTtl, bool pb) override;
nsresult GetHostRecord(const nsACString &host, uint16_t type,
nsresult GetHostRecord(const nsACString &host,
uint16_t flags, uint16_t af, bool pb,
const nsCString &originSuffix,
nsHostRecord **result) override;
@ -512,11 +419,11 @@ private:
// Kick-off a name resolve operation, using native resolver and/or TRR
nsresult NameLookup(nsHostRecord *);
bool GetHostToLookup(AddrHostRecord **m);
bool GetHostToLookup(nsHostRecord **m);
// Removes the first element from the list and returns it AddRef-ed in aResult
// Should not be called for an empty linked list.
void DeQueue(mozilla::LinkedList<RefPtr<nsHostRecord>>& aQ, AddrHostRecord **aResult);
void DeQueue(mozilla::LinkedList<RefPtr<nsHostRecord>>& aQ, nsHostRecord **aResult);
// Cancels host records in the pending queue and also
// calls CompleteLookup with the NS_ERROR_ABORT result code.
void ClearPendingQueue(mozilla::LinkedList<RefPtr<nsHostRecord>>& aPendingQ);
@ -566,7 +473,7 @@ private:
mozilla::Atomic<uint32_t> mPendingCount;
// Set the expiration time stamps appropriately.
void PrepareRecordExpirationAddrRecord(AddrHostRecord* rec) const;
void PrepareRecordExpiration(nsHostRecord* rec) const;
public:
/*

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

@ -3260,17 +3260,6 @@
"n_buckets": 50,
"description": "DNS Cache Entry Age at Removal Time (minutes)"
},
"DNS_BY_TYPE_CLEANUP_AGE": {
"record_in_processes": ["main"],
"expires_in_version": "never",
"kind": "exponential",
"high": 1440,
"alert_emails": ["necko@mozilla.com", "ddamjanovic@mozilla.com"],
"bug_numbers": [1481251],
"releaseChannelCollection": "opt-out",
"n_buckets": 50,
"description": "DNS Cache Entry Age for by-type queries at Removal Time (minutes)"
},
"DNS_PREMATURE_EVICTION": {
"record_in_processes": ["main"],
"expires_in_version": "never",
@ -3282,17 +3271,6 @@
"n_buckets": 50,
"description": "DNS Cache Entry Age at Removal Time of non-expired entries (minutes)"
},
"DNS_BY_TYPE_PREMATURE_EVICTION": {
"record_in_processes": ["main"],
"expires_in_version": "never",
"kind": "exponential",
"high": 1440,
"releaseChannelCollection": "opt-out",
"alert_emails": ["necko@mozilla.com", "ddamjanovic@mozilla.com"],
"bug_numbers": [1481251],
"n_buckets": 50,
"description": "DNS Cache Entry Age for by-type queries at Removal Time of non-expired entries (minutes)"
},
"DNS_LOOKUP_TIME": {
"record_in_processes": ["main"],
"expires_in_version": "never",
@ -3325,28 +3303,6 @@
"n_buckets": 50,
"description": "Time for a completed native name resolution (msec)"
},
"DNS_BY_TYPE_FAILED_LOOKUP_TIME": {
"record_in_processes": ["main"],
"expires_in_version": "never",
"kind": "exponential",
"high": 60000,
"releaseChannelCollection": "opt-out",
"alert_emails": ["necko@mozilla.com", "ddamjanovic@mozilla.com"],
"bug_numbers": [1481251],
"n_buckets": 50,
"description": "Time for a completed by-type resolution that has a negative answer (msec)."
},
"DNS_BY_TYPE_SUCCEEDED_LOOKUP_TIME": {
"record_in_processes": ["main"],
"expires_in_version": "never",
"kind": "exponential",
"high": 60000,
"releaseChannelCollection": "opt-out",
"alert_emails": ["necko@mozilla.com", "ddamjanovic@mozilla.com"],
"bug_numbers": [1481251],
"n_buckets": 50,
"description": "Time for a completed by-type resolution that succeeded (msec)."
},
"DNS_NATIVE_QUEUING": {
"record_in_processes": ["main"],
"expires_in_version": "never",