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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 PassRefPtr<ResourceLoadTiming> deepCopy() | 42 PassRefPtr<ResourceLoadTiming> deepCopy() |
43 { | 43 { |
44 RefPtr<ResourceLoadTiming> timing = create(); | 44 RefPtr<ResourceLoadTiming> timing = create(); |
45 timing->requestTime = requestTime; | 45 timing->requestTime = requestTime; |
46 timing->proxyStart = proxyStart; | 46 timing->proxyStart = proxyStart; |
47 timing->proxyEnd = proxyEnd; | 47 timing->proxyEnd = proxyEnd; |
48 timing->dnsStart = dnsStart; | 48 timing->dnsStart = dnsStart; |
49 timing->dnsEnd = dnsEnd; | 49 timing->dnsEnd = dnsEnd; |
50 timing->connectStart = connectStart; | 50 timing->connectStart = connectStart; |
51 timing->connectEnd = connectEnd; | 51 timing->connectEnd = connectEnd; |
| 52 timing->serviceWorkerFetchStart = serviceWorkerFetchStart; |
| 53 timing->serviceWorkerFetchReady = serviceWorkerFetchReady; |
| 54 timing->serviceWorkerFetchEnd = serviceWorkerFetchEnd; |
52 timing->sendStart = sendStart; | 55 timing->sendStart = sendStart; |
53 timing->sendEnd = sendEnd; | 56 timing->sendEnd = sendEnd; |
54 timing->receiveHeadersEnd = receiveHeadersEnd; | 57 timing->receiveHeadersEnd = receiveHeadersEnd; |
55 timing->sslStart = sslStart; | 58 timing->sslStart = sslStart; |
56 timing->sslEnd = sslEnd; | 59 timing->sslEnd = sslEnd; |
57 return timing.release(); | 60 return timing.release(); |
58 } | 61 } |
59 | 62 |
60 bool operator==(const ResourceLoadTiming& other) const | 63 bool operator==(const ResourceLoadTiming& other) const |
61 { | 64 { |
62 return requestTime == other.requestTime | 65 return requestTime == other.requestTime |
63 && proxyStart == other.proxyStart | 66 && proxyStart == other.proxyStart |
64 && proxyEnd == other.proxyEnd | 67 && proxyEnd == other.proxyEnd |
65 && dnsStart == other.dnsStart | 68 && dnsStart == other.dnsStart |
66 && dnsEnd == other.dnsEnd | 69 && dnsEnd == other.dnsEnd |
67 && connectStart == other.connectStart | 70 && connectStart == other.connectStart |
68 && connectEnd == other.connectEnd | 71 && connectEnd == other.connectEnd |
| 72 && serviceWorkerFetchStart == other.serviceWorkerFetchStart |
| 73 && serviceWorkerFetchReady == other.serviceWorkerFetchReady |
| 74 && serviceWorkerFetchEnd == other.serviceWorkerFetchEnd |
69 && sendStart == other.sendStart | 75 && sendStart == other.sendStart |
70 && sendEnd == other.sendEnd | 76 && sendEnd == other.sendEnd |
71 && receiveHeadersEnd == other.receiveHeadersEnd | 77 && receiveHeadersEnd == other.receiveHeadersEnd |
72 && sslStart == other.sslStart | 78 && sslStart == other.sslStart |
73 && sslEnd == other.sslEnd; | 79 && sslEnd == other.sslEnd; |
74 } | 80 } |
75 | 81 |
76 bool operator!=(const ResourceLoadTiming& other) const | 82 bool operator!=(const ResourceLoadTiming& other) const |
77 { | 83 { |
78 return !(*this == other); | 84 return !(*this == other); |
79 } | 85 } |
80 | 86 |
81 // We want to present a unified timeline to Javascript. Using walltime is pr
oblematic, because the clock may skew while resources | 87 // We want to present a unified timeline to Javascript. Using walltime is pr
oblematic, because the clock may skew while resources |
82 // load. To prevent that skew, we record a single reference walltime when ro
ot document navigation begins. All other times are | 88 // load. To prevent that skew, we record a single reference walltime when ro
ot document navigation begins. All other times are |
83 // recorded using monotonicallyIncreasingTime(). When a time needs to be pre
sented to Javascript, we build a pseudo-walltime | 89 // recorded using monotonicallyIncreasingTime(). When a time needs to be pre
sented to Javascript, we build a pseudo-walltime |
84 // using the following equation (requestTime as example): | 90 // using the following equation (requestTime as example): |
85 // pseudo time = document wall reference + (requestTime - document monoton
ic reference). | 91 // pseudo time = document wall reference + (requestTime - document monoton
ic reference). |
86 double requestTime; // All monotonicallyIncreasingTime() in seconds | 92 double requestTime; // All monotonicallyIncreasingTime() in seconds |
87 double proxyStart; | 93 double proxyStart; |
88 double proxyEnd; | 94 double proxyEnd; |
89 double dnsStart; | 95 double dnsStart; |
90 double dnsEnd; | 96 double dnsEnd; |
91 double connectStart; | 97 double connectStart; |
92 double connectEnd; | 98 double connectEnd; |
| 99 double serviceWorkerFetchStart; |
| 100 double serviceWorkerFetchReady; |
| 101 double serviceWorkerFetchEnd; |
93 double sendStart; | 102 double sendStart; |
94 double sendEnd; | 103 double sendEnd; |
95 double receiveHeadersEnd; | 104 double receiveHeadersEnd; |
96 double sslStart; | 105 double sslStart; |
97 double sslEnd; | 106 double sslEnd; |
98 | 107 |
99 double calculateMillisecondDelta(double time) const { return time ? (time -
requestTime) * 1000 : -1; } | 108 double calculateMillisecondDelta(double time) const { return time ? (time -
requestTime) * 1000 : -1; } |
100 | 109 |
101 private: | 110 private: |
102 ResourceLoadTiming() | 111 ResourceLoadTiming() |
103 : requestTime(0) | 112 : requestTime(0) |
104 , proxyStart(0) | 113 , proxyStart(0) |
105 , proxyEnd(0) | 114 , proxyEnd(0) |
106 , dnsStart(0) | 115 , dnsStart(0) |
107 , dnsEnd(0) | 116 , dnsEnd(0) |
108 , connectStart(0) | 117 , connectStart(0) |
109 , connectEnd(0) | 118 , connectEnd(0) |
| 119 , serviceWorkerFetchStart(0) |
| 120 , serviceWorkerFetchReady(0) |
| 121 , serviceWorkerFetchEnd(0) |
110 , sendStart(0) | 122 , sendStart(0) |
111 , sendEnd(0) | 123 , sendEnd(0) |
112 , receiveHeadersEnd(0) | 124 , receiveHeadersEnd(0) |
113 , sslStart(0) | 125 , sslStart(0) |
114 , sslEnd(0) | 126 , sslEnd(0) |
115 { | 127 { |
116 } | 128 } |
117 }; | 129 }; |
118 | 130 |
119 } | 131 } |
120 | 132 |
121 #endif | 133 #endif |
OLD | NEW |