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