OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. | 2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 { | 43 { |
44 RefPtr<ResourceLoadTiming> timing = create(); | 44 RefPtr<ResourceLoadTiming> timing = create(); |
45 timing->m_requestTime = m_requestTime; | 45 timing->m_requestTime = m_requestTime; |
46 timing->m_proxyStart = m_proxyStart; | 46 timing->m_proxyStart = m_proxyStart; |
47 timing->m_proxyEnd = m_proxyEnd; | 47 timing->m_proxyEnd = m_proxyEnd; |
48 timing->m_dnsStart = m_dnsStart; | 48 timing->m_dnsStart = m_dnsStart; |
49 timing->m_dnsEnd = m_dnsEnd; | 49 timing->m_dnsEnd = m_dnsEnd; |
50 timing->m_connectStart = m_connectStart; | 50 timing->m_connectStart = m_connectStart; |
51 timing->m_connectEnd = m_connectEnd; | 51 timing->m_connectEnd = m_connectEnd; |
52 timing->m_workerStart = m_workerStart; | 52 timing->m_workerStart = m_workerStart; |
| 53 timing->m_workerReady = m_workerReady; |
53 timing->m_sendStart = m_sendStart; | 54 timing->m_sendStart = m_sendStart; |
54 timing->m_sendEnd = m_sendEnd; | 55 timing->m_sendEnd = m_sendEnd; |
55 timing->m_receiveHeadersEnd = m_receiveHeadersEnd; | 56 timing->m_receiveHeadersEnd = m_receiveHeadersEnd; |
56 timing->m_sslStart = m_sslStart; | 57 timing->m_sslStart = m_sslStart; |
57 timing->m_sslEnd = m_sslEnd; | 58 timing->m_sslEnd = m_sslEnd; |
58 return timing.release(); | 59 return timing.release(); |
59 } | 60 } |
60 | 61 |
61 bool operator==(const ResourceLoadTiming& other) const | 62 bool operator==(const ResourceLoadTiming& other) const |
62 { | 63 { |
63 return m_requestTime == other.m_requestTime | 64 return m_requestTime == other.m_requestTime |
64 && m_proxyStart == other.m_proxyStart | 65 && m_proxyStart == other.m_proxyStart |
65 && m_proxyEnd == other.m_proxyEnd | 66 && m_proxyEnd == other.m_proxyEnd |
66 && m_dnsStart == other.m_dnsStart | 67 && m_dnsStart == other.m_dnsStart |
67 && m_dnsEnd == other.m_dnsEnd | 68 && m_dnsEnd == other.m_dnsEnd |
68 && m_connectStart == other.m_connectStart | 69 && m_connectStart == other.m_connectStart |
69 && m_connectEnd == other.m_connectEnd | 70 && m_connectEnd == other.m_connectEnd |
70 && m_workerStart == other.m_workerStart | 71 && m_workerStart == other.m_workerStart |
| 72 && m_workerReady == other.m_workerReady |
71 && m_sendStart == other.m_sendStart | 73 && m_sendStart == other.m_sendStart |
72 && m_sendEnd == other.m_sendEnd | 74 && m_sendEnd == other.m_sendEnd |
73 && m_receiveHeadersEnd == other.m_receiveHeadersEnd | 75 && m_receiveHeadersEnd == other.m_receiveHeadersEnd |
74 && m_sslStart == other.m_sslStart | 76 && m_sslStart == other.m_sslStart |
75 && m_sslEnd == other.m_sslEnd; | 77 && m_sslEnd == other.m_sslEnd; |
76 } | 78 } |
77 | 79 |
78 bool operator!=(const ResourceLoadTiming& other) const | 80 bool operator!=(const ResourceLoadTiming& other) const |
79 { | 81 { |
80 return !(*this == other); | 82 return !(*this == other); |
81 } | 83 } |
82 | 84 |
83 void setDnsStart(double dnsStart) { m_dnsStart = dnsStart; } | 85 void setDnsStart(double dnsStart) { m_dnsStart = dnsStart; } |
84 void setRequestTime(double requestTime) { m_requestTime = requestTime; } | 86 void setRequestTime(double requestTime) { m_requestTime = requestTime; } |
85 void setProxyStart(double proxyStart) { m_proxyStart = proxyStart; } | 87 void setProxyStart(double proxyStart) { m_proxyStart = proxyStart; } |
86 void setProxyEnd(double proxyEnd) { m_proxyEnd = proxyEnd; } | 88 void setProxyEnd(double proxyEnd) { m_proxyEnd = proxyEnd; } |
87 void setDnsEnd(double dnsEnd) { m_dnsEnd = dnsEnd; } | 89 void setDnsEnd(double dnsEnd) { m_dnsEnd = dnsEnd; } |
88 void setConnectStart(double connectStart) { m_connectStart = connectStart; } | 90 void setConnectStart(double connectStart) { m_connectStart = connectStart; } |
89 void setConnectEnd(double connectEnd) { m_connectEnd = connectEnd; } | 91 void setConnectEnd(double connectEnd) { m_connectEnd = connectEnd; } |
90 void setWorkerStart(double workerStart) { m_workerStart = workerStart; } | 92 void setWorkerStart(double workerStart) { m_workerStart = workerStart; } |
| 93 void setWorkerReady(double workerReady) { m_workerReady = workerReady; } |
91 void setSendStart(double sendStart) { m_sendStart = sendStart; } | 94 void setSendStart(double sendStart) { m_sendStart = sendStart; } |
92 void setSendEnd(double sendEnd) { m_sendEnd = sendEnd; } | 95 void setSendEnd(double sendEnd) { m_sendEnd = sendEnd; } |
93 void setReceiveHeadersEnd(double receiveHeadersEnd) { m_receiveHeadersEnd =
receiveHeadersEnd; } | 96 void setReceiveHeadersEnd(double receiveHeadersEnd) { m_receiveHeadersEnd =
receiveHeadersEnd; } |
94 void setSslStart(double sslStart) { m_sslStart = sslStart; } | 97 void setSslStart(double sslStart) { m_sslStart = sslStart; } |
95 void setSslEnd(double sslEnd) { m_sslEnd = sslEnd; } | 98 void setSslEnd(double sslEnd) { m_sslEnd = sslEnd; } |
96 | 99 |
97 double dnsStart() const { return m_dnsStart; } | 100 double dnsStart() const { return m_dnsStart; } |
98 double requestTime() const { return m_requestTime; } | 101 double requestTime() const { return m_requestTime; } |
99 double proxyStart() const { return m_proxyStart; } | 102 double proxyStart() const { return m_proxyStart; } |
100 double proxyEnd() const { return m_proxyEnd; } | 103 double proxyEnd() const { return m_proxyEnd; } |
101 double dnsEnd() const { return m_dnsEnd; } | 104 double dnsEnd() const { return m_dnsEnd; } |
102 double connectStart() const { return m_connectStart; } | 105 double connectStart() const { return m_connectStart; } |
103 double connectEnd() const { return m_connectEnd; } | 106 double connectEnd() const { return m_connectEnd; } |
104 double workerStart() const { return m_workerStart; } | 107 double workerStart() const { return m_workerStart; } |
| 108 double workerReady() const { return m_workerReady; } |
105 double sendStart() const { return m_sendStart; } | 109 double sendStart() const { return m_sendStart; } |
106 double sendEnd() const { return m_sendEnd; } | 110 double sendEnd() const { return m_sendEnd; } |
107 double receiveHeadersEnd() const { return m_receiveHeadersEnd; } | 111 double receiveHeadersEnd() const { return m_receiveHeadersEnd; } |
108 double sslStart() const { return m_sslStart; } | 112 double sslStart() const { return m_sslStart; } |
109 double sslEnd() const { return m_sslEnd; } | 113 double sslEnd() const { return m_sslEnd; } |
110 | 114 |
111 double calculateMillisecondDelta(double time) const { return time ? (time -
m_requestTime) * 1000 : -1; } | 115 double calculateMillisecondDelta(double time) const { return time ? (time -
m_requestTime) * 1000 : -1; } |
112 | 116 |
113 private: | 117 private: |
114 ResourceLoadTiming() | 118 ResourceLoadTiming() |
115 : m_requestTime(0) | 119 : m_requestTime(0) |
116 , m_proxyStart(0) | 120 , m_proxyStart(0) |
117 , m_proxyEnd(0) | 121 , m_proxyEnd(0) |
118 , m_dnsStart(0) | 122 , m_dnsStart(0) |
119 , m_dnsEnd(0) | 123 , m_dnsEnd(0) |
120 , m_connectStart(0) | 124 , m_connectStart(0) |
121 , m_connectEnd(0) | 125 , m_connectEnd(0) |
122 , m_workerStart(0) | 126 , m_workerStart(0) |
| 127 , m_workerReady(0) |
123 , m_sendStart(0) | 128 , m_sendStart(0) |
124 , m_sendEnd(0) | 129 , m_sendEnd(0) |
125 , m_receiveHeadersEnd(0) | 130 , m_receiveHeadersEnd(0) |
126 , m_sslStart(0) | 131 , m_sslStart(0) |
127 , m_sslEnd(0) | 132 , m_sslEnd(0) |
128 { | 133 { |
129 } | 134 } |
130 | 135 |
131 // We want to present a unified timeline to Javascript. Using walltime is pr
oblematic, because the clock may skew while resources | 136 // We want to present a unified timeline to Javascript. Using walltime is pr
oblematic, because the clock may skew while resources |
132 // load. To prevent that skew, we record a single reference walltime when ro
ot document navigation begins. All other times are | 137 // load. To prevent that skew, we record a single reference walltime when ro
ot document navigation begins. All other times are |
133 // recorded using monotonicallyIncreasingTime(). When a time needs to be pre
sented to Javascript, we build a pseudo-walltime | 138 // recorded using monotonicallyIncreasingTime(). When a time needs to be pre
sented to Javascript, we build a pseudo-walltime |
134 // using the following equation (m_requestTime as example): | 139 // using the following equation (m_requestTime as example): |
135 // pseudo time = document wall reference + (m_requestTime - document monot
onic reference). | 140 // pseudo time = document wall reference + (m_requestTime - document monot
onic reference). |
136 | 141 |
137 // All monotonicallyIncreasingTime() in seconds | 142 // All monotonicallyIncreasingTime() in seconds |
138 double m_requestTime; | 143 double m_requestTime; |
139 double m_proxyStart; | 144 double m_proxyStart; |
140 double m_proxyEnd; | 145 double m_proxyEnd; |
141 double m_dnsStart; | 146 double m_dnsStart; |
142 double m_dnsEnd; | 147 double m_dnsEnd; |
143 double m_connectStart; | 148 double m_connectStart; |
144 double m_connectEnd; | 149 double m_connectEnd; |
145 double m_workerStart; | 150 double m_workerStart; |
| 151 double m_workerReady; |
146 double m_sendStart; | 152 double m_sendStart; |
147 double m_sendEnd; | 153 double m_sendEnd; |
148 double m_receiveHeadersEnd; | 154 double m_receiveHeadersEnd; |
149 double m_sslStart; | 155 double m_sslStart; |
150 double m_sslEnd; | 156 double m_sslEnd; |
151 }; | 157 }; |
152 | 158 |
153 } | 159 } |
154 | 160 |
155 #endif | 161 #endif |
OLD | NEW |