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

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

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

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

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

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

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