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

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

Issue 2105713002: Render process changes for ResourceTiming sizes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@resource_timing_sizes_browser_process
Patch Set: Fixes from kinuko initial comments Created 4 years, 5 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Intel Inc. All rights reserved. 3 * Copyright (C) 2012 Intel Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 return PerformanceBase::clampTimeResolution(seconds - timeOrigin) * 1000.0; 48 return PerformanceBase::clampTimeResolution(seconds - timeOrigin) * 1000.0;
49 } 49 }
50 50
51 PerformanceResourceTiming::PerformanceResourceTiming(const ResourceTimingInfo& i nfo, double timeOrigin, double startTime, double lastRedirectEndTime, bool allow TimingDetails, bool allowRedirectDetails) 51 PerformanceResourceTiming::PerformanceResourceTiming(const ResourceTimingInfo& i nfo, double timeOrigin, double startTime, double lastRedirectEndTime, bool allow TimingDetails, bool allowRedirectDetails)
52 : PerformanceEntry(info.initialRequest().url().getString(), "resource", mono tonicTimeToDOMHighResTimeStamp(timeOrigin, startTime), monotonicTimeToDOMHighRes TimeStamp(timeOrigin, info.loadFinishTime())) 52 : PerformanceEntry(info.initialRequest().url().getString(), "resource", mono tonicTimeToDOMHighResTimeStamp(timeOrigin, startTime), monotonicTimeToDOMHighRes TimeStamp(timeOrigin, info.loadFinishTime()))
53 , m_initiatorType(info.initiatorType()) 53 , m_initiatorType(info.initiatorType())
54 , m_timeOrigin(timeOrigin) 54 , m_timeOrigin(timeOrigin)
55 , m_timing(info.finalResponse().resourceLoadTiming()) 55 , m_timing(info.finalResponse().resourceLoadTiming())
56 , m_lastRedirectEndTime(lastRedirectEndTime) 56 , m_lastRedirectEndTime(lastRedirectEndTime)
57 , m_finishTime(info.loadFinishTime()) 57 , m_finishTime(info.loadFinishTime())
58 , m_transferSize(info.transferSize())
59 , m_encodedBodySize(info.finalResponse().encodedBodyLength())
60 , m_decodedBodySize(info.finalResponse().decodedBodyLength())
58 , m_didReuseConnection(info.finalResponse().connectionReused()) 61 , m_didReuseConnection(info.finalResponse().connectionReused())
59 , m_allowTimingDetails(allowTimingDetails) 62 , m_allowTimingDetails(allowTimingDetails)
60 , m_allowRedirectDetails(allowRedirectDetails) 63 , m_allowRedirectDetails(allowRedirectDetails)
61 { 64 {
62 } 65 }
63 66
64 PerformanceResourceTiming::~PerformanceResourceTiming() 67 PerformanceResourceTiming::~PerformanceResourceTiming()
65 { 68 {
66 } 69 }
67 70
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 } 209 }
207 210
208 double PerformanceResourceTiming::responseEnd() const 211 double PerformanceResourceTiming::responseEnd() const
209 { 212 {
210 if (!m_finishTime) 213 if (!m_finishTime)
211 return responseStart(); 214 return responseStart();
212 215
213 return monotonicTimeToDOMHighResTimeStamp(m_timeOrigin, m_finishTime); 216 return monotonicTimeToDOMHighResTimeStamp(m_timeOrigin, m_finishTime);
214 } 217 }
215 218
219 unsigned long long PerformanceResourceTiming::transferSize() const
220 {
221 if (!m_allowTimingDetails)
222 return 0;
223
224 return m_transferSize;
225 }
226
227 unsigned long long PerformanceResourceTiming::encodedBodySize() const
228 {
229 if (!m_allowTimingDetails)
230 return 0;
231
232 return m_encodedBodySize;
233 }
234
235 unsigned long long PerformanceResourceTiming::decodedBodySize() const
236 {
237 if (!m_allowTimingDetails)
238 return 0;
239
240 return m_decodedBodySize;
241 }
242
216 void PerformanceResourceTiming::buildJSONValue(V8ObjectBuilder& builder) const 243 void PerformanceResourceTiming::buildJSONValue(V8ObjectBuilder& builder) const
217 { 244 {
218 PerformanceEntry::buildJSONValue(builder); 245 PerformanceEntry::buildJSONValue(builder);
219 builder.addString("initiatorType", initiatorType()); 246 builder.addString("initiatorType", initiatorType());
220 builder.addNumber("workerStart", workerStart()); 247 builder.addNumber("workerStart", workerStart());
221 builder.addNumber("redirectStart", redirectStart()); 248 builder.addNumber("redirectStart", redirectStart());
222 builder.addNumber("redirectEnd", redirectEnd()); 249 builder.addNumber("redirectEnd", redirectEnd());
223 builder.addNumber("fetchStart", fetchStart()); 250 builder.addNumber("fetchStart", fetchStart());
224 builder.addNumber("domainLookupStart", domainLookupStart()); 251 builder.addNumber("domainLookupStart", domainLookupStart());
225 builder.addNumber("domainLookupEnd", domainLookupEnd()); 252 builder.addNumber("domainLookupEnd", domainLookupEnd());
226 builder.addNumber("connectStart", connectStart()); 253 builder.addNumber("connectStart", connectStart());
227 builder.addNumber("connectEnd", connectEnd()); 254 builder.addNumber("connectEnd", connectEnd());
228 builder.addNumber("secureConnectionStart", secureConnectionStart()); 255 builder.addNumber("secureConnectionStart", secureConnectionStart());
229 builder.addNumber("requestStart", requestStart()); 256 builder.addNumber("requestStart", requestStart());
230 builder.addNumber("responseStart", responseStart()); 257 builder.addNumber("responseStart", responseStart());
231 builder.addNumber("responseEnd", responseEnd()); 258 builder.addNumber("responseEnd", responseEnd());
259 builder.addNumber("transferSize", transferSize());
260 builder.addNumber("encodedBodySize", encodedBodySize());
261 builder.addNumber("decodedBodySize", decodedBodySize());
232 } 262 }
233 263
234 } // namespace blink 264 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698