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): | 86 // using the following equation (requestTime as example): |
88 // pseudo time = document wall reference + (requestTime - document monoton
ic reference). | 87 // pseudo time = document wall reference + (requestTime - document monoton
ic reference). |
89 double requestTime; // All monotonicallyIncreasingTime() in seconds | 88 double requestTime; // All monotonicallyIncreasingTime() in seconds |
90 double proxyStart; | 89 double proxyStart; |
91 double proxyEnd; | 90 double proxyEnd; |
92 double dnsStart; | 91 double dnsStart; |
93 double dnsEnd; | 92 double dnsEnd; |
94 double connectStart; | 93 double connectStart; |
95 double connectEnd; | 94 double connectEnd; |
96 double sendStart; | 95 double sendStart; |
97 double sendEnd; | 96 double sendEnd; |
98 double receiveHeadersEnd; | 97 double receiveHeadersEnd; |
99 double sslStart; | 98 double sslStart; |
100 double sslEnd; | 99 double sslEnd; |
101 | 100 |
102 double calculateMillisecondDelta(double time) const { return (time - request
Time) * 1000; } | 101 double calculateMillisecondDelta(double time) const { return (time - request
Time) * 1000; } |
103 #else | |
104 // using the following equation: | |
105 // pseudo time = document wall reference + (resource request time - docume
nt monotonic reference) + deltaMilliseconds / 1000.0. | |
106 double convertResourceLoadTimeToMonotonicTime(int deltaMilliseconds) const; | |
107 | |
108 double requestTime; // monotonicallyIncreasingTime() when the port started h
andling this request. | |
109 int proxyStart; // The rest of these are millisecond deltas, using monotonic
allyIncreasingTime(), from requestTime. | |
110 int proxyEnd; | |
111 int dnsStart; | |
112 int dnsEnd; | |
113 int connectStart; | |
114 int connectEnd; | |
115 int sendStart; | |
116 int sendEnd; | |
117 int receiveHeadersEnd; | |
118 int sslStart; | |
119 int sslEnd; | |
120 #endif | |
121 | 102 |
122 private: | 103 private: |
123 ResourceLoadTiming() | 104 ResourceLoadTiming() |
124 #ifdef ENABLE_DOUBLE_RESOURCE_LOAD_TIMING | |
125 : requestTime(0) | 105 : requestTime(0) |
126 , proxyStart(0) | 106 , proxyStart(0) |
127 , proxyEnd(0) | 107 , proxyEnd(0) |
128 , dnsStart(0) | 108 , dnsStart(0) |
129 , dnsEnd(0) | 109 , dnsEnd(0) |
130 , connectStart(0) | 110 , connectStart(0) |
131 , connectEnd(0) | 111 , connectEnd(0) |
132 , sendStart(0) | 112 , sendStart(0) |
133 , sendEnd(0) | 113 , sendEnd(0) |
134 , receiveHeadersEnd(0) | 114 , receiveHeadersEnd(0) |
135 , sslStart(0) | 115 , sslStart(0) |
136 , sslEnd(0) | 116 , 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 | |
151 { | 117 { |
152 } | 118 } |
153 }; | 119 }; |
154 | 120 |
155 } | 121 } |
156 | 122 |
157 #endif | 123 #endif |
OLD | NEW |