| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 } | 76 } |
| 77 | 77 |
| 78 bool operator!=(const ResourceLoadTiming& other) const | 78 bool operator!=(const ResourceLoadTiming& other) const |
| 79 { | 79 { |
| 80 return !(*this == other); | 80 return !(*this == other); |
| 81 } | 81 } |
| 82 | 82 |
| 83 // We want to present a unified timeline to Javascript. Using walltime is pr
oblematic, because the clock may skew while resources | 83 // 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 | 84 // 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 | 85 // recorded using monotonicallyIncreasingTime(). When a time needs to be pre
sented to Javascript, we build a pseudo-walltime |
| 86 #ifdef ENABLE_DOUBLE_RESOURCE_LOAD_TIMING |
| 87 // using the following equation (requestTime as example): |
| 88 // pseudo time = document wall reference + (requestTime - document monoton
ic reference). |
| 89 double requestTime; // All monotonicallyIncreasingTime() in seconds |
| 90 double proxyStart; |
| 91 double proxyEnd; |
| 92 double dnsStart; |
| 93 double dnsEnd; |
| 94 double connectStart; |
| 95 double connectEnd; |
| 96 double sendStart; |
| 97 double sendEnd; |
| 98 double receiveHeadersEnd; |
| 99 double sslStart; |
| 100 double sslEnd; |
| 101 |
| 102 double calculateMillisecondDelta(double time) const { return (time - request
Time) * 1000; } |
| 103 #else |
| 86 // using the following equation: | 104 // using the following equation: |
| 87 // pseudo time = document wall reference + (resource request time - docume
nt monotonic reference) + deltaMilliseconds / 1000.0. | 105 // pseudo time = document wall reference + (resource request time - docume
nt monotonic reference) + deltaMilliseconds / 1000.0. |
| 88 double convertResourceLoadTimeToMonotonicTime(int deltaMilliseconds) const; | 106 double convertResourceLoadTimeToMonotonicTime(int deltaMilliseconds) const; |
| 89 | 107 |
| 90 double requestTime; // monotonicallyIncreasingTime() when the port started h
andling this request. | 108 double requestTime; // monotonicallyIncreasingTime() when the port started h
andling this request. |
| 91 int proxyStart; // The rest of these are millisecond deltas, using monotonic
allyIncreasingTime(), from requestTime. | 109 int proxyStart; // The rest of these are millisecond deltas, using monotonic
allyIncreasingTime(), from requestTime. |
| 92 int proxyEnd; | 110 int proxyEnd; |
| 93 int dnsStart; | 111 int dnsStart; |
| 94 int dnsEnd; | 112 int dnsEnd; |
| 95 int connectStart; | 113 int connectStart; |
| 96 int connectEnd; | 114 int connectEnd; |
| 97 int sendStart; | 115 int sendStart; |
| 98 int sendEnd; | 116 int sendEnd; |
| 99 int receiveHeadersEnd; | 117 int receiveHeadersEnd; |
| 100 int sslStart; | 118 int sslStart; |
| 101 int sslEnd; | 119 int sslEnd; |
| 120 #endif |
| 102 | 121 |
| 103 private: | 122 private: |
| 104 ResourceLoadTiming() | 123 ResourceLoadTiming() |
| 124 #ifdef ENABLE_DOUBLE_RESOURCE_LOAD_TIMING |
| 105 : requestTime(0) | 125 : requestTime(0) |
| 106 , proxyStart(-1) | 126 , proxyStart(0) |
| 107 , proxyEnd(-1) | 127 , proxyEnd(0) |
| 108 , dnsStart(-1) | 128 , dnsStart(0) |
| 109 , dnsEnd(-1) | 129 , dnsEnd(0) |
| 110 , connectStart(-1) | 130 , connectStart(0) |
| 111 , connectEnd(-1) | 131 , connectEnd(0) |
| 112 , sendStart(0) | 132 , sendStart(0) |
| 113 , sendEnd(0) | 133 , sendEnd(0) |
| 114 , receiveHeadersEnd(0) | 134 , receiveHeadersEnd(0) |
| 115 , sslStart(-1) | 135 , sslStart(0) |
| 116 , sslEnd(-1) | 136 , sslEnd(0) |
| 137 #else |
| 138 : requestTime(0) |
| 139 , proxyStart(-1) |
| 140 , proxyEnd(-1) |
| 141 , dnsStart(-1) |
| 142 , dnsEnd(-1) |
| 143 , connectStart(-1) |
| 144 , connectEnd(-1) |
| 145 , sendStart(0) |
| 146 , sendEnd(0) |
| 147 , receiveHeadersEnd(0) |
| 148 , sslStart(-1) |
| 149 , sslEnd(-1) |
| 150 #endif |
| 117 { | 151 { |
| 118 } | 152 } |
| 119 }; | 153 }; |
| 120 | 154 |
| 121 } | 155 } |
| 122 | 156 |
| 123 #endif | 157 #endif |
| OLD | NEW |