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

Side by Side Diff: third_party/WebKit/Source/core/timing/PerformanceNavigationTiming.cpp

Issue 2509143002: Add Prerender type to NavigationType for nav timing 2 (Closed)
Patch Set: synced client Created 4 years 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/timing/PerformanceNavigationTiming.h" 5 #include "core/timing/PerformanceNavigationTiming.h"
6 6
7 #include "bindings/core/v8/V8ObjectBuilder.h" 7 #include "bindings/core/v8/V8ObjectBuilder.h"
8 #include "core/timing/PerformanceBase.h" 8 #include "core/timing/PerformanceBase.h"
9 9
10 namespace blink { 10 namespace blink {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 114
115 double PerformanceNavigationTiming::loadEventStart() const { 115 double PerformanceNavigationTiming::loadEventStart() const {
116 return monotonicTimeToDOMHighResTimeStamp(m_timeOrigin, m_loadEventStart); 116 return monotonicTimeToDOMHighResTimeStamp(m_timeOrigin, m_loadEventStart);
117 } 117 }
118 118
119 double PerformanceNavigationTiming::loadEventEnd() const { 119 double PerformanceNavigationTiming::loadEventEnd() const {
120 return monotonicTimeToDOMHighResTimeStamp(m_timeOrigin, m_loadEventEnd); 120 return monotonicTimeToDOMHighResTimeStamp(m_timeOrigin, m_loadEventEnd);
121 } 121 }
122 122
123 AtomicString PerformanceNavigationTiming::type() const { 123 AtomicString PerformanceNavigationTiming::type() const {
124 // TODO(sunjian) Right now NavigationType doesn't seem to have a Prerender
125 // type yet, need to look into this crbug/663217
126 switch (m_type) { 124 switch (m_type) {
127 case NavigationTypeReload: 125 case NavigationType::Reload:
128 return "reload"; 126 return "reload";
129 case NavigationTypeBackForward: 127 case NavigationType::BackForward:
130 return "back_forward"; 128 return "back_forward";
131 default: 129 case NavigationType::Prerender:
130 return "prerender";
131 case NavigationType::Navigate:
132 return "navigate"; 132 return "navigate";
133 } 133 }
134 NOTREACHED();
135 return "navigate";
134 } 136 }
135 137
136 unsigned short PerformanceNavigationTiming::redirectCount() const { 138 unsigned short PerformanceNavigationTiming::redirectCount() const {
137 // TODO(sunjian): Also check response headers to allow opt-in crbugs/665160 139 // TODO(sunjian): Also check response headers to allow opt-in crbugs/665160
138 if (m_hasCrossOriginRedirect) 140 if (m_hasCrossOriginRedirect)
139 return 0; 141 return 0;
140 return m_redirectCount; 142 return m_redirectCount;
141 } 143 }
142 144
143 double PerformanceNavigationTiming::fetchStart() const { 145 double PerformanceNavigationTiming::fetchStart() const {
(...skipping 24 matching lines...) Expand all
168 builder.addNumber("domInteractive", domInteractive()); 170 builder.addNumber("domInteractive", domInteractive());
169 builder.addNumber("domContentLoadedEventStart", domContentLoadedEventStart()); 171 builder.addNumber("domContentLoadedEventStart", domContentLoadedEventStart());
170 builder.addNumber("domContentLoadedEventEnd", domContentLoadedEventEnd()); 172 builder.addNumber("domContentLoadedEventEnd", domContentLoadedEventEnd());
171 builder.addNumber("domComplete", domComplete()); 173 builder.addNumber("domComplete", domComplete());
172 builder.addNumber("loadEventStart", loadEventStart()); 174 builder.addNumber("loadEventStart", loadEventStart());
173 builder.addNumber("loadEventEnd", loadEventEnd()); 175 builder.addNumber("loadEventEnd", loadEventEnd());
174 builder.addString("type", type()); 176 builder.addString("type", type());
175 builder.addNumber("redirectCount", redirectCount()); 177 builder.addNumber("redirectCount", redirectCount());
176 } 178 }
177 } 179 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698