Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(750)

Side by Side Diff: Source/platform/network/ResourceLoadTiming.h

Issue 1159663002: Refactoring timing info for ServiceWorker controlled requests [1/3] (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/platform/exported/WebURLLoadTiming.cpp ('k') | public/platform/WebURLLoadTiming.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
42 PassRefPtr<ResourceLoadTiming> deepCopy() 42 PassRefPtr<ResourceLoadTiming> deepCopy()
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_serviceWorkerFetchStart = m_serviceWorkerFetchStart; 52 timing->m_workerStart = m_workerStart;
53 timing->m_serviceWorkerFetchReady = m_serviceWorkerFetchReady;
54 timing->m_serviceWorkerFetchEnd = m_serviceWorkerFetchEnd;
55 timing->m_sendStart = m_sendStart; 53 timing->m_sendStart = m_sendStart;
56 timing->m_sendEnd = m_sendEnd; 54 timing->m_sendEnd = m_sendEnd;
57 timing->m_receiveHeadersEnd = m_receiveHeadersEnd; 55 timing->m_receiveHeadersEnd = m_receiveHeadersEnd;
58 timing->m_sslStart = m_sslStart; 56 timing->m_sslStart = m_sslStart;
59 timing->m_sslEnd = m_sslEnd; 57 timing->m_sslEnd = m_sslEnd;
60 return timing.release(); 58 return timing.release();
61 } 59 }
62 60
63 bool operator==(const ResourceLoadTiming& other) const 61 bool operator==(const ResourceLoadTiming& other) const
64 { 62 {
65 return m_requestTime == other.m_requestTime 63 return m_requestTime == other.m_requestTime
66 && m_proxyStart == other.m_proxyStart 64 && m_proxyStart == other.m_proxyStart
67 && m_proxyEnd == other.m_proxyEnd 65 && m_proxyEnd == other.m_proxyEnd
68 && m_dnsStart == other.m_dnsStart 66 && m_dnsStart == other.m_dnsStart
69 && m_dnsEnd == other.m_dnsEnd 67 && m_dnsEnd == other.m_dnsEnd
70 && m_connectStart == other.m_connectStart 68 && m_connectStart == other.m_connectStart
71 && m_connectEnd == other.m_connectEnd 69 && m_connectEnd == other.m_connectEnd
72 && m_serviceWorkerFetchStart == other.m_serviceWorkerFetchStart 70 && m_workerStart == other.m_workerStart
73 && m_serviceWorkerFetchReady == other.m_serviceWorkerFetchReady
74 && m_serviceWorkerFetchEnd == other.m_serviceWorkerFetchEnd
75 && m_sendStart == other.m_sendStart 71 && m_sendStart == other.m_sendStart
76 && m_sendEnd == other.m_sendEnd 72 && m_sendEnd == other.m_sendEnd
77 && m_receiveHeadersEnd == other.m_receiveHeadersEnd 73 && m_receiveHeadersEnd == other.m_receiveHeadersEnd
78 && m_sslStart == other.m_sslStart 74 && m_sslStart == other.m_sslStart
79 && m_sslEnd == other.m_sslEnd; 75 && m_sslEnd == other.m_sslEnd;
80 } 76 }
81 77
82 bool operator!=(const ResourceLoadTiming& other) const 78 bool operator!=(const ResourceLoadTiming& other) const
83 { 79 {
84 return !(*this == other); 80 return !(*this == other);
85 } 81 }
86 82
87 void setDnsStart(double dnsStart) { m_dnsStart = dnsStart; } 83 void setDnsStart(double dnsStart) { m_dnsStart = dnsStart; }
88 void setRequestTime(double requestTime) { m_requestTime = requestTime; } 84 void setRequestTime(double requestTime) { m_requestTime = requestTime; }
89 void setProxyStart(double proxyStart) { m_proxyStart = proxyStart; } 85 void setProxyStart(double proxyStart) { m_proxyStart = proxyStart; }
90 void setProxyEnd(double proxyEnd) { m_proxyEnd = proxyEnd; } 86 void setProxyEnd(double proxyEnd) { m_proxyEnd = proxyEnd; }
91 void setDnsEnd(double dnsEnd) { m_dnsEnd = dnsEnd; } 87 void setDnsEnd(double dnsEnd) { m_dnsEnd = dnsEnd; }
92 void setConnectStart(double connectStart) { m_connectStart = connectStart; } 88 void setConnectStart(double connectStart) { m_connectStart = connectStart; }
93 void setConnectEnd(double connectEnd) { m_connectEnd = connectEnd; } 89 void setConnectEnd(double connectEnd) { m_connectEnd = connectEnd; }
94 void setServiceWorkerFetchStart(double serviceWorkerFetchStart) { m_serviceW orkerFetchStart = serviceWorkerFetchStart; } 90 void setWorkerStart(double workerStart) { m_workerStart = workerStart; }
95 void setServiceWorkerFetchReady(double serviceWorkerFetchReady) { m_serviceW orkerFetchReady = serviceWorkerFetchReady; }
96 void setServiceWorkerFetchEnd(double serviceWorkerFetchEnd) { m_serviceWorke rFetchEnd = serviceWorkerFetchEnd; }
97 void setSendStart(double sendStart) { m_sendStart = sendStart; } 91 void setSendStart(double sendStart) { m_sendStart = sendStart; }
98 void setSendEnd(double sendEnd) { m_sendEnd = sendEnd; } 92 void setSendEnd(double sendEnd) { m_sendEnd = sendEnd; }
99 void setReceiveHeadersEnd(double receiveHeadersEnd) { m_receiveHeadersEnd = receiveHeadersEnd; } 93 void setReceiveHeadersEnd(double receiveHeadersEnd) { m_receiveHeadersEnd = receiveHeadersEnd; }
100 void setSslStart(double sslStart) { m_sslStart = sslStart; } 94 void setSslStart(double sslStart) { m_sslStart = sslStart; }
101 void setSslEnd(double sslEnd) { m_sslEnd = sslEnd; } 95 void setSslEnd(double sslEnd) { m_sslEnd = sslEnd; }
102 96
103 double dnsStart() const { return m_dnsStart; } 97 double dnsStart() const { return m_dnsStart; }
104 double requestTime() const { return m_requestTime; } 98 double requestTime() const { return m_requestTime; }
105 double proxyStart() const { return m_proxyStart; } 99 double proxyStart() const { return m_proxyStart; }
106 double proxyEnd() const { return m_proxyEnd; } 100 double proxyEnd() const { return m_proxyEnd; }
107 double dnsEnd() const { return m_dnsEnd; } 101 double dnsEnd() const { return m_dnsEnd; }
108 double connectStart() const { return m_connectStart; } 102 double connectStart() const { return m_connectStart; }
109 double connectEnd() const { return m_connectEnd; } 103 double connectEnd() const { return m_connectEnd; }
110 double serviceWorkerFetchStart() const { return m_serviceWorkerFetchStart; } 104 double workerStart() const { return m_workerStart; }
111 double serviceWorkerFetchReady() const { return m_serviceWorkerFetchReady; }
112 double serviceWorkerFetchEnd() const { return m_serviceWorkerFetchEnd; }
113 double sendStart() const { return m_sendStart; } 105 double sendStart() const { return m_sendStart; }
114 double sendEnd() const { return m_sendEnd; } 106 double sendEnd() const { return m_sendEnd; }
115 double receiveHeadersEnd() const { return m_receiveHeadersEnd; } 107 double receiveHeadersEnd() const { return m_receiveHeadersEnd; }
116 double sslStart() const { return m_sslStart; } 108 double sslStart() const { return m_sslStart; }
117 double sslEnd() const { return m_sslEnd; } 109 double sslEnd() const { return m_sslEnd; }
118 110
119 double calculateMillisecondDelta(double time) const { return time ? (time - m_requestTime) * 1000 : -1; } 111 double calculateMillisecondDelta(double time) const { return time ? (time - m_requestTime) * 1000 : -1; }
120 112
121 private: 113 private:
122 ResourceLoadTiming() 114 ResourceLoadTiming()
123 : m_requestTime(0) 115 : m_requestTime(0)
124 , m_proxyStart(0) 116 , m_proxyStart(0)
125 , m_proxyEnd(0) 117 , m_proxyEnd(0)
126 , m_dnsStart(0) 118 , m_dnsStart(0)
127 , m_dnsEnd(0) 119 , m_dnsEnd(0)
128 , m_connectStart(0) 120 , m_connectStart(0)
129 , m_connectEnd(0) 121 , m_connectEnd(0)
130 , m_serviceWorkerFetchStart(0) 122 , m_workerStart(0)
131 , m_serviceWorkerFetchReady(0)
132 , m_serviceWorkerFetchEnd(0)
133 , m_sendStart(0) 123 , m_sendStart(0)
134 , m_sendEnd(0) 124 , m_sendEnd(0)
135 , m_receiveHeadersEnd(0) 125 , m_receiveHeadersEnd(0)
136 , m_sslStart(0) 126 , m_sslStart(0)
137 , m_sslEnd(0) 127 , m_sslEnd(0)
138 { 128 {
139 } 129 }
140 130
141 // We want to present a unified timeline to Javascript. Using walltime is pr oblematic, because the clock may skew while resources 131 // We want to present a unified timeline to Javascript. Using walltime is pr oblematic, because the clock may skew while resources
142 // load. To prevent that skew, we record a single reference walltime when ro ot document navigation begins. All other times are 132 // load. To prevent that skew, we record a single reference walltime when ro ot document navigation begins. All other times are
143 // recorded using monotonicallyIncreasingTime(). When a time needs to be pre sented to Javascript, we build a pseudo-walltime 133 // recorded using monotonicallyIncreasingTime(). When a time needs to be pre sented to Javascript, we build a pseudo-walltime
144 // using the following equation (m_requestTime as example): 134 // using the following equation (m_requestTime as example):
145 // pseudo time = document wall reference + (m_requestTime - document monot onic reference). 135 // pseudo time = document wall reference + (m_requestTime - document monot onic reference).
146 136
147 // All monotonicallyIncreasingTime() in seconds 137 // All monotonicallyIncreasingTime() in seconds
148 double m_requestTime; 138 double m_requestTime;
149 double m_proxyStart; 139 double m_proxyStart;
150 double m_proxyEnd; 140 double m_proxyEnd;
151 double m_dnsStart; 141 double m_dnsStart;
152 double m_dnsEnd; 142 double m_dnsEnd;
153 double m_connectStart; 143 double m_connectStart;
154 double m_connectEnd; 144 double m_connectEnd;
155 double m_serviceWorkerFetchStart; 145 double m_workerStart;
156 double m_serviceWorkerFetchReady;
157 double m_serviceWorkerFetchEnd;
158 double m_sendStart; 146 double m_sendStart;
159 double m_sendEnd; 147 double m_sendEnd;
160 double m_receiveHeadersEnd; 148 double m_receiveHeadersEnd;
161 double m_sslStart; 149 double m_sslStart;
162 double m_sslEnd; 150 double m_sslEnd;
163 }; 151 };
164 152
165 } 153 }
166 154
167 #endif 155 #endif
OLDNEW
« no previous file with comments | « Source/platform/exported/WebURLLoadTiming.cpp ('k') | public/platform/WebURLLoadTiming.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698