#ifndef ResourceLoadTiming_h
#define ResourceLoadTiming_h
#include "wtf/PassRefPtr.h"
#include "wtf/RefCounted.h"
#include "wtf/RefPtr.h"
namespace WebCore {
class DocumentLoadTiming;
class ResourceLoadTiming : public RefCounted<ResourceLoadTiming> {
public:
static PassRefPtr<ResourceLoadTiming> create()
{
return adoptRef(new ResourceLoadTiming);
}
PassRefPtr<ResourceLoadTiming> deepCopy()
{
RefPtr<ResourceLoadTiming> timing = create();
timing->requestTime = requestTime;
timing->proxyStart = proxyStart;
timing->proxyEnd = proxyEnd;
timing->dnsStart = dnsStart;
timing->dnsEnd = dnsEnd;
timing->connectStart = connectStart;
timing->connectEnd = connectEnd;
timing->sendStart = sendStart;
timing->sendEnd = sendEnd;
timing->receiveHeadersEnd = receiveHeadersEnd;
timing->sslStart = sslStart;
timing->sslEnd = sslEnd;
return timing.release();
}
bool operator==(const ResourceLoadTiming& other) const
{
return requestTime == other.requestTime
&& proxyStart == other.proxyStart
&& proxyEnd == other.proxyEnd
&& dnsStart == other.dnsStart
&& dnsEnd == other.dnsEnd
&& connectStart == other.connectStart
&& connectEnd == other.connectEnd
&& sendStart == other.sendStart
&& sendEnd == other.sendEnd
&& receiveHeadersEnd == other.receiveHeadersEnd
&& sslStart == other.sslStart
&& sslEnd == other.sslEnd;
}
bool operator!=(const ResourceLoadTiming& other) const
{
return !(*this == other);
}
double requestTime;
double proxyStart;
double proxyEnd;
double dnsStart;
double dnsEnd;
double connectStart;
double connectEnd;
double sendStart;
double sendEnd;
double receiveHeadersEnd;
double sslStart;
double sslEnd;
double calculateMillisecondDelta(double time) const { return time ? (time - requestTime) * 1000 : -1; }
private:
ResourceLoadTiming()
: requestTime(0)
, proxyStart(0)
, proxyEnd(0)
, dnsStart(0)
, dnsEnd(0)
, connectStart(0)
, connectEnd(0)
, sendStart(0)
, sendEnd(0)
, receiveHeadersEnd(0)
, sslStart(0)
, sslEnd(0)
{
}
};
}
#endif