gecko-dev/dom/base/PerformanceResourceTiming.h
Nathan Froyd 01583602a9 Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat
The bulk of this commit was generated with a script, executed at the top
level of a typical source code checkout.  The only non-machine-generated
part was modifying MFBT's moz.build to reflect the new naming.

CLOSED TREE makes big refactorings like this a piece of cake.

 # The main substitution.
find . -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \
    xargs perl -p -i -e '
 s/nsRefPtr\.h/RefPtr\.h/g; # handle includes
 s/nsRefPtr ?</RefPtr</g;   # handle declarations and variables
'

 # Handle a special friend declaration in gfx/layers/AtomicRefCountedWithFinalize.h.
perl -p -i -e 's/::nsRefPtr;/::RefPtr;/' gfx/layers/AtomicRefCountedWithFinalize.h

 # Handle nsRefPtr.h itself, a couple places that define constructors
 # from nsRefPtr, and code generators specially.  We do this here, rather
 # than indiscriminantly s/nsRefPtr/RefPtr/, because that would rename
 # things like nsRefPtrHashtable.
perl -p -i -e 's/nsRefPtr/RefPtr/g' \
     mfbt/nsRefPtr.h \
     xpcom/glue/nsCOMPtr.h \
     xpcom/base/OwningNonNull.h \
     ipc/ipdl/ipdl/lower.py \
     ipc/ipdl/ipdl/builtin.py \
     dom/bindings/Codegen.py \
     python/lldbutils/lldbutils/utils.py

 # In our indiscriminate substitution above, we renamed
 # nsRefPtrGetterAddRefs, the class behind getter_AddRefs.  Fix that up.
find . -name '*.cpp' -o -name '*.h' -o -name '*.idl' | \
    xargs perl -p -i -e 's/nsRefPtrGetterAddRefs/RefPtrGetterAddRefs/g'

if [ -d .git ]; then
    git mv mfbt/nsRefPtr.h mfbt/RefPtr.h
else
    hg mv mfbt/nsRefPtr.h mfbt/RefPtr.h
fi

--HG--
rename : mfbt/nsRefPtr.h => mfbt/RefPtr.h
2015-10-18 01:24:48 -04:00

186 lines
4.7 KiB
C++

/* -*- 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_PerformanceResourceTiming_h___
#define mozilla_dom_PerformanceResourceTiming_h___
#include "nsCOMPtr.h"
#include "nsPerformance.h"
#include "nsIChannel.h"
#include "nsITimedChannel.h"
#include "nsDOMNavigationTiming.h"
#include "PerformanceEntry.h"
namespace mozilla {
namespace dom {
// http://www.w3.org/TR/resource-timing/#performanceresourcetiming
class PerformanceResourceTiming final : public PerformanceEntry
{
public:
typedef mozilla::TimeStamp TimeStamp;
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(
PerformanceResourceTiming,
PerformanceEntry)
PerformanceResourceTiming(nsPerformanceTiming* aPerformanceTiming,
nsPerformance* aPerformance,
const nsAString& aName);
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
virtual DOMHighResTimeStamp StartTime() const override;
virtual DOMHighResTimeStamp Duration() const override
{
return ResponseEnd() - StartTime();
}
void GetInitiatorType(nsAString& aInitiatorType) const
{
aInitiatorType = mInitiatorType;
}
void SetInitiatorType(const nsAString& aInitiatorType)
{
mInitiatorType = aInitiatorType;
}
void GetNextHopProtocol(nsAString& aNextHopProtocol) const
{
aNextHopProtocol = mNextHopProtocol;
}
void SetNextHopProtocol(const nsAString& aNextHopProtocol)
{
mNextHopProtocol = aNextHopProtocol;
}
DOMHighResTimeStamp FetchStart() const {
return mTiming
? mTiming->FetchStartHighRes()
: 0;
}
DOMHighResTimeStamp RedirectStart() const {
// We have to check if all the redirect URIs had the same origin (since
// there is no check in RedirectEndHighRes())
return mTiming && mTiming->ShouldReportCrossOriginRedirect()
? mTiming->RedirectStartHighRes()
: 0;
}
DOMHighResTimeStamp RedirectEnd() const {
// We have to check if all the redirect URIs had the same origin (since
// there is no check in RedirectEndHighRes())
return mTiming && mTiming->ShouldReportCrossOriginRedirect()
? mTiming->RedirectEndHighRes()
: 0;
}
DOMHighResTimeStamp DomainLookupStart() const {
return mTiming && mTiming->TimingAllowed()
? mTiming->DomainLookupStartHighRes()
: 0;
}
DOMHighResTimeStamp DomainLookupEnd() const {
return mTiming && mTiming->TimingAllowed()
? mTiming->DomainLookupEndHighRes()
: 0;
}
DOMHighResTimeStamp ConnectStart() const {
return mTiming && mTiming->TimingAllowed()
? mTiming->ConnectStartHighRes()
: 0;
}
DOMHighResTimeStamp ConnectEnd() const {
return mTiming && mTiming->TimingAllowed()
? mTiming->ConnectEndHighRes()
: 0;
}
DOMHighResTimeStamp RequestStart() const {
return mTiming && mTiming->TimingAllowed()
? mTiming->RequestStartHighRes()
: 0;
}
DOMHighResTimeStamp ResponseStart() const {
return mTiming && mTiming->TimingAllowed()
? mTiming->ResponseStartHighRes()
: 0;
}
DOMHighResTimeStamp ResponseEnd() const {
return mTiming
? mTiming->ResponseEndHighRes()
: 0;
}
DOMHighResTimeStamp SecureConnectionStart() const
{
// This measurement is not available for Navigation Timing either.
// There is a different bug submitted for it.
return 0;
}
virtual const PerformanceResourceTiming* ToResourceTiming() const override
{
return this;
}
uint64_t TransferSize() const
{
return mTiming && mTiming->TimingAllowed() ? mTransferSize : 0;
}
uint64_t EncodedBodySize() const
{
return mTiming && mTiming->TimingAllowed() ? mEncodedBodySize : 0;
}
uint64_t DecodedBodySize() const
{
return mTiming && mTiming->TimingAllowed() ? mDecodedBodySize : 0;
}
void SetEncodedBodySize(uint64_t aEncodedBodySize)
{
mEncodedBodySize = aEncodedBodySize;
}
void SetTransferSize(uint64_t aTransferSize)
{
mTransferSize = aTransferSize;
}
void SetDecodedBodySize(uint64_t aDecodedBodySize)
{
mDecodedBodySize = aDecodedBodySize;
}
protected:
virtual ~PerformanceResourceTiming();
nsString mInitiatorType;
nsString mNextHopProtocol;
RefPtr<nsPerformanceTiming> mTiming;
uint64_t mEncodedBodySize;
uint64_t mTransferSize;
uint64_t mDecodedBodySize;
};
} // namespace dom
} // namespace mozilla
#endif /* mozilla_dom_PerformanceResourceTiming_h___ */