Bug 1279194 - Get rid of nsDOMPerformanceNavigationType, r=smaug

This commit is contained in:
Andrea Marchesini 2016-06-10 16:29:46 +02:00
Родитель 745e332e1b
Коммит dd368c9569
4 изменённых файлов: 44 добавлений и 31 удалений

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

@ -665,7 +665,7 @@ DispatchPings(nsIDocShell* aDocShell,
ForEachPing(aContent, SendPing, &info);
}
static nsDOMPerformanceNavigationType
static nsDOMNavigationTiming::Type
ConvertLoadTypeToNavigationType(uint32_t aLoadType)
{
// Not initialized, assume it's normal load.
@ -673,7 +673,7 @@ ConvertLoadTypeToNavigationType(uint32_t aLoadType)
aLoadType = LOAD_NORMAL;
}
auto result = dom::PerformanceNavigation::TYPE_RESERVED;
auto result = nsDOMNavigationTiming::TYPE_RESERVED;
switch (aLoadType) {
case LOAD_NORMAL:
case LOAD_NORMAL_EXTERNAL:
@ -685,10 +685,10 @@ ConvertLoadTypeToNavigationType(uint32_t aLoadType)
case LOAD_LINK:
case LOAD_STOP_CONTENT:
case LOAD_REPLACE_BYPASS_CACHE:
result = dom::PerformanceNavigation::TYPE_NAVIGATE;
result = nsDOMNavigationTiming::TYPE_NAVIGATE;
break;
case LOAD_HISTORY:
result = dom::PerformanceNavigation::TYPE_BACK_FORWARD;
result = nsDOMNavigationTiming::TYPE_BACK_FORWARD;
break;
case LOAD_RELOAD_NORMAL:
case LOAD_RELOAD_CHARSET_CHANGE:
@ -696,18 +696,18 @@ ConvertLoadTypeToNavigationType(uint32_t aLoadType)
case LOAD_RELOAD_BYPASS_PROXY:
case LOAD_RELOAD_BYPASS_PROXY_AND_CACHE:
case LOAD_RELOAD_ALLOW_MIXED_CONTENT:
result = dom::PerformanceNavigation::TYPE_RELOAD;
result = nsDOMNavigationTiming::TYPE_RELOAD;
break;
case LOAD_STOP_CONTENT_AND_REPLACE:
case LOAD_REFRESH:
case LOAD_BYPASS_HISTORY:
case LOAD_ERROR_PAGE:
case LOAD_PUSHSTATE:
result = dom::PerformanceNavigation::TYPE_RESERVED;
result = nsDOMNavigationTiming::TYPE_RESERVED;
break;
default:
// NS_NOTREACHED("Unexpected load type value");
result = dom::PerformanceNavigation::TYPE_RESERVED;
result = nsDOMNavigationTiming::TYPE_RESERVED;
break;
}

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

@ -25,7 +25,7 @@ nsDOMNavigationTiming::~nsDOMNavigationTiming()
void
nsDOMNavigationTiming::Clear()
{
mNavigationType = mozilla::dom::PerformanceNavigation::TYPE_RESERVED;
mNavigationType = TYPE_RESERVED;
mNavigationStartHighRes = 0;
mBeforeUnloadStart = 0;
mUnloadStart = 0;
@ -70,7 +70,7 @@ nsDOMNavigationTiming::NotifyNavigationStart()
}
void
nsDOMNavigationTiming::NotifyFetchStart(nsIURI* aURI, nsDOMPerformanceNavigationType aNavigationType)
nsDOMNavigationTiming::NotifyFetchStart(nsIURI* aURI, Type aNavigationType)
{
mNavigationType = aNavigationType;
// At the unload event time we don't really know the loading uri.
@ -202,4 +202,3 @@ nsDOMNavigationTiming::GetUnloadEventEnd()
}
return 0;
}

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

@ -15,53 +15,74 @@ class nsIURI;
typedef unsigned long long DOMTimeMilliSec;
typedef double DOMHighResTimeStamp;
typedef unsigned short nsDOMPerformanceNavigationType;
class nsDOMNavigationTiming final
{
public:
enum Type {
TYPE_NAVIGATE = 0,
TYPE_RELOAD = 1,
TYPE_BACK_FORWARD = 2,
TYPE_RESERVED = 255,
};
nsDOMNavigationTiming();
NS_INLINE_DECL_REFCOUNTING(nsDOMNavigationTiming)
nsDOMPerformanceNavigationType GetType() const {
Type GetType() const
{
return mNavigationType;
}
inline DOMHighResTimeStamp GetNavigationStartHighRes() const {
inline DOMHighResTimeStamp GetNavigationStartHighRes() const
{
return mNavigationStartHighRes;
}
DOMTimeMilliSec GetNavigationStart() const {
DOMTimeMilliSec GetNavigationStart() const
{
return static_cast<int64_t>(GetNavigationStartHighRes());
}
mozilla::TimeStamp GetNavigationStartTimeStamp() const {
mozilla::TimeStamp GetNavigationStartTimeStamp() const
{
return mNavigationStartTimeStamp;
}
DOMTimeMilliSec GetUnloadEventStart();
DOMTimeMilliSec GetUnloadEventEnd();
DOMTimeMilliSec GetDomLoading() const {
DOMTimeMilliSec GetDomLoading() const
{
return mDOMLoading;
}
DOMTimeMilliSec GetDomInteractive() const {
DOMTimeMilliSec GetDomInteractive() const
{
return mDOMInteractive;
}
DOMTimeMilliSec GetDomContentLoadedEventStart() const {
DOMTimeMilliSec GetDomContentLoadedEventStart() const
{
return mDOMContentLoadedEventStart;
}
DOMTimeMilliSec GetDomContentLoadedEventEnd() const {
DOMTimeMilliSec GetDomContentLoadedEventEnd() const
{
return mDOMContentLoadedEventEnd;
}
DOMTimeMilliSec GetDomComplete() const {
DOMTimeMilliSec GetDomComplete() const
{
return mDOMComplete;
}
DOMTimeMilliSec GetLoadEventStart() const {
DOMTimeMilliSec GetLoadEventStart() const
{
return mLoadEventStart;
}
DOMTimeMilliSec GetLoadEventEnd() const {
DOMTimeMilliSec GetLoadEventEnd() const
{
return mLoadEventEnd;
}
void NotifyNavigationStart();
void NotifyFetchStart(nsIURI* aURI, nsDOMPerformanceNavigationType aNavigationType);
void NotifyFetchStart(nsIURI* aURI, Type aNavigationType);
void NotifyBeforeUnload();
void NotifyUnloadAccepted(nsIURI* aOldURI);
void NotifyUnloadEventStart();
@ -93,7 +114,7 @@ private:
nsCOMPtr<nsIURI> mUnloadedURI;
nsCOMPtr<nsIURI> mLoadedURI;
nsDOMPerformanceNavigationType mNavigationType;
Type mNavigationType;
DOMHighResTimeStamp mNavigationStartHighRes;
mozilla::TimeStamp mNavigationStartTimeStamp;
DOMTimeMilliSec DurationFromStart();

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

@ -19,13 +19,6 @@ namespace dom {
class PerformanceNavigation final : public nsWrapperCache
{
public:
enum PerformanceNavigationType {
TYPE_NAVIGATE = 0,
TYPE_RELOAD = 1,
TYPE_BACK_FORWARD = 2,
TYPE_RESERVED = 255,
};
explicit PerformanceNavigation(Performance* aPerformance);
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(PerformanceNavigation)