mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1278845 - Move PerformanceNavigation to separate files, r=smaug
This commit is contained in:
parent
d84e87b425
commit
1264ad2da5
@ -211,8 +211,8 @@
|
||||
#include "nsIWebBrowserFind.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
#include "mozilla/dom/PerformanceNavigation.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "nsPerformance.h"
|
||||
|
||||
#ifdef MOZ_TOOLKIT_SEARCH
|
||||
#include "nsIBrowserSearchService.h"
|
||||
|
@ -5,12 +5,12 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsDOMNavigationTiming.h"
|
||||
#include "nsPerformance.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "prtime.h"
|
||||
#include "nsIURI.h"
|
||||
#include "mozilla/dom/PerformanceNavigation.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
|
||||
nsDOMNavigationTiming::nsDOMNavigationTiming()
|
||||
|
@ -894,10 +894,6 @@ DOMInterfaces = {
|
||||
'workers': True,
|
||||
}],
|
||||
|
||||
'PerformanceNavigation': {
|
||||
'headerFile': 'nsPerformance.h'
|
||||
},
|
||||
|
||||
'Plugin': {
|
||||
'headerFile' : 'nsPluginArray.h',
|
||||
'nativeType': 'nsPluginElement',
|
||||
|
43
dom/performance/PerformanceNavigation.cpp
Normal file
43
dom/performance/PerformanceNavigation.cpp
Normal file
@ -0,0 +1,43 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "PerformanceNavigation.h"
|
||||
#include "PerformanceTiming.h"
|
||||
#include "mozilla/dom/PerformanceNavigationBinding.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(PerformanceNavigation, mPerformance)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(PerformanceNavigation, AddRef)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(PerformanceNavigation, Release)
|
||||
|
||||
PerformanceNavigation::PerformanceNavigation(nsPerformance* aPerformance)
|
||||
: mPerformance(aPerformance)
|
||||
{
|
||||
MOZ_ASSERT(aPerformance, "Parent performance object should be provided");
|
||||
}
|
||||
|
||||
PerformanceNavigation::~PerformanceNavigation()
|
||||
{
|
||||
}
|
||||
|
||||
JSObject*
|
||||
PerformanceNavigation::WrapObject(JSContext *cx,
|
||||
JS::Handle<JSObject*> aGivenProto)
|
||||
{
|
||||
return PerformanceNavigationBinding::Wrap(cx, this, aGivenProto);
|
||||
}
|
||||
|
||||
uint16_t
|
||||
PerformanceNavigation::RedirectCount() const
|
||||
{
|
||||
return GetPerformanceTiming()->GetRedirectCount();
|
||||
}
|
||||
|
||||
} // dom namespace
|
||||
} // mozilla namespace
|
68
dom/performance/PerformanceNavigation.h
Normal file
68
dom/performance/PerformanceNavigation.h
Normal file
@ -0,0 +1,68 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_dom_PerformanceNavigation_h
|
||||
#define mozilla_dom_PerformanceNavigation_h
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsDOMNavigationTiming.h"
|
||||
#include "nsPerformance.h"
|
||||
#include "nsWrapperCache.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
// Script "performance.navigation" object
|
||||
class PerformanceNavigation final : public nsWrapperCache
|
||||
{
|
||||
public:
|
||||
enum PerformanceNavigationType {
|
||||
TYPE_NAVIGATE = 0,
|
||||
TYPE_RELOAD = 1,
|
||||
TYPE_BACK_FORWARD = 2,
|
||||
TYPE_RESERVED = 255,
|
||||
};
|
||||
|
||||
explicit PerformanceNavigation(nsPerformance* aPerformance);
|
||||
|
||||
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(PerformanceNavigation)
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(PerformanceNavigation)
|
||||
|
||||
nsDOMNavigationTiming* GetDOMTiming() const
|
||||
{
|
||||
return mPerformance->GetDOMTiming();
|
||||
}
|
||||
|
||||
PerformanceTiming* GetPerformanceTiming() const
|
||||
{
|
||||
return mPerformance->Timing();
|
||||
}
|
||||
|
||||
nsPerformance* GetParentObject() const
|
||||
{
|
||||
return mPerformance;
|
||||
}
|
||||
|
||||
virtual JSObject* WrapObject(JSContext *cx,
|
||||
JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
// PerformanceNavigation WebIDL methods
|
||||
uint16_t Type() const
|
||||
{
|
||||
return GetDOMTiming()->GetType();
|
||||
}
|
||||
|
||||
uint16_t RedirectCount() const;
|
||||
|
||||
private:
|
||||
~PerformanceNavigation();
|
||||
RefPtr<nsPerformance> mPerformance;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_PerformanceNavigation_h
|
@ -12,6 +12,7 @@ EXPORTS.mozilla.dom += [
|
||||
'PerformanceEntry.h',
|
||||
'PerformanceMark.h',
|
||||
'PerformanceMeasure.h',
|
||||
'PerformanceNavigation.h',
|
||||
'PerformanceObserver.h',
|
||||
'PerformanceObserverEntryList.h',
|
||||
'PerformanceResourceTiming.h',
|
||||
@ -23,6 +24,7 @@ UNIFIED_SOURCES += [
|
||||
'PerformanceEntry.cpp',
|
||||
'PerformanceMark.cpp',
|
||||
'PerformanceMeasure.cpp',
|
||||
'PerformanceNavigation.cpp',
|
||||
'PerformanceObserver.cpp',
|
||||
'PerformanceObserverEntryList.cpp',
|
||||
'PerformanceResourceTiming.cpp',
|
||||
|
@ -43,33 +43,6 @@ using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::dom::workers;
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(PerformanceNavigation, mPerformance)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(PerformanceNavigation, AddRef)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(PerformanceNavigation, Release)
|
||||
|
||||
PerformanceNavigation::PerformanceNavigation(nsPerformance* aPerformance)
|
||||
: mPerformance(aPerformance)
|
||||
{
|
||||
MOZ_ASSERT(aPerformance, "Parent performance object should be provided");
|
||||
}
|
||||
|
||||
PerformanceNavigation::~PerformanceNavigation()
|
||||
{
|
||||
}
|
||||
|
||||
JSObject*
|
||||
PerformanceNavigation::WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto)
|
||||
{
|
||||
return PerformanceNavigationBinding::Wrap(cx, this, aGivenProto);
|
||||
}
|
||||
|
||||
uint16_t
|
||||
PerformanceNavigation::RedirectCount() const
|
||||
{
|
||||
return GetPerformanceTiming()->GetRedirectCount();
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(nsPerformance)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsPerformance, PerformanceBase)
|
||||
|
@ -29,47 +29,10 @@ class ErrorResult;
|
||||
namespace dom {
|
||||
|
||||
class PerformanceEntry;
|
||||
class PerformanceNavigation;
|
||||
class PerformanceObserver;
|
||||
class PerformanceTiming;
|
||||
|
||||
// Script "performance.navigation" object
|
||||
class PerformanceNavigation final : public nsWrapperCache
|
||||
{
|
||||
public:
|
||||
enum PerformanceNavigationType {
|
||||
TYPE_NAVIGATE = 0,
|
||||
TYPE_RELOAD = 1,
|
||||
TYPE_BACK_FORWARD = 2,
|
||||
TYPE_RESERVED = 255,
|
||||
};
|
||||
|
||||
explicit PerformanceNavigation(nsPerformance* aPerformance);
|
||||
|
||||
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(PerformanceNavigation)
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(PerformanceNavigation)
|
||||
|
||||
nsDOMNavigationTiming* GetDOMTiming() const;
|
||||
PerformanceTiming* GetPerformanceTiming() const;
|
||||
|
||||
nsPerformance* GetParentObject() const
|
||||
{
|
||||
return mPerformance;
|
||||
}
|
||||
|
||||
virtual JSObject* WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
// PerformanceNavigation WebIDL methods
|
||||
uint16_t Type() const {
|
||||
return GetDOMTiming()->GetType();
|
||||
}
|
||||
|
||||
uint16_t RedirectCount() const;
|
||||
|
||||
private:
|
||||
~PerformanceNavigation();
|
||||
RefPtr<nsPerformance> mPerformance;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
@ -249,16 +212,4 @@ protected:
|
||||
JS::Heap<JSObject*> mMozMemory;
|
||||
};
|
||||
|
||||
inline nsDOMNavigationTiming*
|
||||
mozilla::dom::PerformanceNavigation::GetDOMTiming() const
|
||||
{
|
||||
return mPerformance->GetDOMTiming();
|
||||
}
|
||||
|
||||
inline mozilla::dom::PerformanceTiming*
|
||||
mozilla::dom::PerformanceNavigation::GetPerformanceTiming() const
|
||||
{
|
||||
return mPerformance->Timing();
|
||||
}
|
||||
|
||||
#endif /* nsPerformance_h___ */
|
||||
|
@ -15,7 +15,7 @@ function isnot(a, b, msg) {
|
||||
port.postMessage({type: 'status', status: a != b, msg: a + " != " + b + ": " + msg });
|
||||
}
|
||||
|
||||
importScripts('../../../dom/performance/test/test_performance_user_timing.js');
|
||||
importScripts('../../../dom/performance/tests/test_performance_user_timing.js');
|
||||
|
||||
onconnect = function(evt) {
|
||||
port = evt.ports[0];
|
||||
|
@ -1,4 +1,4 @@
|
||||
importScripts(['/resources/testharness.js']);
|
||||
importScripts(['../../../dom/base/test/test_performance_observer.js']);
|
||||
importScripts(['../../../dom/performance/tests/test_performance_observer.js']);
|
||||
|
||||
done();
|
||||
|
@ -13,7 +13,7 @@ function isnot(a, b, msg) {
|
||||
postMessage({type: 'status', status: a != b, msg: a + " != " + b + ": " + msg });
|
||||
}
|
||||
|
||||
importScripts(['../../../dom/performance/test/test_performance_user_timing.js']);
|
||||
importScripts(['../../../dom/performance/tests/test_performance_user_timing.js']);
|
||||
|
||||
for (var i = 0; i < steps.length; ++i) {
|
||||
performance.clearMarks();
|
||||
|
Loading…
Reference in New Issue
Block a user