| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "platform/network/ResourceLoadTiming.h" | |
| 6 | |
| 7 #include "platform/instrumentation/tracing/TraceEvent.h" | |
| 8 | |
| 9 namespace blink { | |
| 10 | |
| 11 ResourceLoadTiming::ResourceLoadTiming() | |
| 12 : m_requestTime(0), | |
| 13 m_proxyStart(0), | |
| 14 m_proxyEnd(0), | |
| 15 m_dnsStart(0), | |
| 16 m_dnsEnd(0), | |
| 17 m_connectStart(0), | |
| 18 m_connectEnd(0), | |
| 19 m_workerStart(0), | |
| 20 m_workerReady(0), | |
| 21 m_sendStart(0), | |
| 22 m_sendEnd(0), | |
| 23 m_receiveHeadersEnd(0), | |
| 24 m_sslStart(0), | |
| 25 m_sslEnd(0), | |
| 26 m_pushStart(0), | |
| 27 m_pushEnd(0) {} | |
| 28 | |
| 29 PassRefPtr<ResourceLoadTiming> ResourceLoadTiming::create() { | |
| 30 return adoptRef(new ResourceLoadTiming); | |
| 31 } | |
| 32 | |
| 33 PassRefPtr<ResourceLoadTiming> ResourceLoadTiming::deepCopy() { | |
| 34 RefPtr<ResourceLoadTiming> timing = create(); | |
| 35 timing->m_requestTime = m_requestTime; | |
| 36 timing->m_proxyStart = m_proxyStart; | |
| 37 timing->m_proxyEnd = m_proxyEnd; | |
| 38 timing->m_dnsStart = m_dnsStart; | |
| 39 timing->m_dnsEnd = m_dnsEnd; | |
| 40 timing->m_connectStart = m_connectStart; | |
| 41 timing->m_connectEnd = m_connectEnd; | |
| 42 timing->m_workerStart = m_workerStart; | |
| 43 timing->m_workerReady = m_workerReady; | |
| 44 timing->m_sendStart = m_sendStart; | |
| 45 timing->m_sendEnd = m_sendEnd; | |
| 46 timing->m_receiveHeadersEnd = m_receiveHeadersEnd; | |
| 47 timing->m_sslStart = m_sslStart; | |
| 48 timing->m_sslEnd = m_sslEnd; | |
| 49 timing->m_pushStart = m_pushStart; | |
| 50 timing->m_pushEnd = m_pushEnd; | |
| 51 return timing.release(); | |
| 52 } | |
| 53 | |
| 54 bool ResourceLoadTiming::operator==(const ResourceLoadTiming& other) const { | |
| 55 return m_requestTime == other.m_requestTime && | |
| 56 m_proxyStart == other.m_proxyStart && m_proxyEnd == other.m_proxyEnd && | |
| 57 m_dnsStart == other.m_dnsStart && m_dnsEnd == other.m_dnsEnd && | |
| 58 m_connectStart == other.m_connectStart && | |
| 59 m_connectEnd == other.m_connectEnd && | |
| 60 m_workerStart == other.m_workerStart && | |
| 61 m_workerReady == other.m_workerReady && | |
| 62 m_sendStart == other.m_sendStart && m_sendEnd == other.m_sendEnd && | |
| 63 m_receiveHeadersEnd == other.m_receiveHeadersEnd && | |
| 64 m_sslStart == other.m_sslStart && m_sslEnd == other.m_sslEnd && | |
| 65 m_pushStart == other.m_pushStart && m_pushEnd == other.m_pushEnd; | |
| 66 } | |
| 67 | |
| 68 bool ResourceLoadTiming::operator!=(const ResourceLoadTiming& other) const { | |
| 69 return !(*this == other); | |
| 70 } | |
| 71 | |
| 72 void ResourceLoadTiming::setDnsStart(double dnsStart) { | |
| 73 m_dnsStart = dnsStart; | |
| 74 } | |
| 75 | |
| 76 void ResourceLoadTiming::setRequestTime(double requestTime) { | |
| 77 m_requestTime = requestTime; | |
| 78 } | |
| 79 | |
| 80 void ResourceLoadTiming::setProxyStart(double proxyStart) { | |
| 81 m_proxyStart = proxyStart; | |
| 82 } | |
| 83 | |
| 84 void ResourceLoadTiming::setProxyEnd(double proxyEnd) { | |
| 85 m_proxyEnd = proxyEnd; | |
| 86 } | |
| 87 | |
| 88 void ResourceLoadTiming::setDnsEnd(double dnsEnd) { | |
| 89 m_dnsEnd = dnsEnd; | |
| 90 } | |
| 91 | |
| 92 void ResourceLoadTiming::setConnectStart(double connectStart) { | |
| 93 m_connectStart = connectStart; | |
| 94 } | |
| 95 | |
| 96 void ResourceLoadTiming::setConnectEnd(double connectEnd) { | |
| 97 m_connectEnd = connectEnd; | |
| 98 } | |
| 99 | |
| 100 void ResourceLoadTiming::setWorkerStart(double workerStart) { | |
| 101 m_workerStart = workerStart; | |
| 102 } | |
| 103 | |
| 104 void ResourceLoadTiming::setWorkerReady(double workerReady) { | |
| 105 m_workerReady = workerReady; | |
| 106 } | |
| 107 | |
| 108 void ResourceLoadTiming::setSendStart(double sendStart) { | |
| 109 TRACE_EVENT_MARK_WITH_TIMESTAMP0("blink.user_timing", "requestStart", | |
| 110 TraceEvent::toTraceTimestamp(sendStart)); | |
| 111 m_sendStart = sendStart; | |
| 112 } | |
| 113 | |
| 114 void ResourceLoadTiming::setSendEnd(double sendEnd) { | |
| 115 m_sendEnd = sendEnd; | |
| 116 } | |
| 117 | |
| 118 void ResourceLoadTiming::setReceiveHeadersEnd(double receiveHeadersEnd) { | |
| 119 m_receiveHeadersEnd = receiveHeadersEnd; | |
| 120 } | |
| 121 | |
| 122 void ResourceLoadTiming::setSslStart(double sslStart) { | |
| 123 m_sslStart = sslStart; | |
| 124 } | |
| 125 | |
| 126 void ResourceLoadTiming::setSslEnd(double sslEnd) { | |
| 127 m_sslEnd = sslEnd; | |
| 128 } | |
| 129 | |
| 130 void ResourceLoadTiming::setPushStart(double pushStart) { | |
| 131 m_pushStart = pushStart; | |
| 132 } | |
| 133 | |
| 134 void ResourceLoadTiming::setPushEnd(double pushEnd) { | |
| 135 m_pushEnd = pushEnd; | |
| 136 } | |
| 137 | |
| 138 double ResourceLoadTiming::calculateMillisecondDelta(double time) const { | |
| 139 return time ? (time - m_requestTime) * 1000 : -1; | |
| 140 } | |
| 141 | |
| 142 } // namespace blink | |
| OLD | NEW |