Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 // TODO(majidvp): Should return DOMHighResTimeStamp type instead | 42 // TODO(majidvp): Should return DOMHighResTimeStamp type instead |
| 43 static double monotonicTimeToDOMHighResTimeStamp(double timeOrigin, | 43 static double monotonicTimeToDOMHighResTimeStamp(double timeOrigin, |
| 44 double seconds) { | 44 double seconds) { |
| 45 ASSERT(seconds >= 0.0); | 45 ASSERT(seconds >= 0.0); |
| 46 if (!seconds || !timeOrigin) | 46 if (!seconds || !timeOrigin) |
| 47 return 0.0; | 47 return 0.0; |
| 48 return PerformanceBase::clampTimeResolution(seconds - timeOrigin) * 1000.0; | 48 return PerformanceBase::clampTimeResolution(seconds - timeOrigin) * 1000.0; |
| 49 } | 49 } |
| 50 | 50 |
| 51 PerformanceResourceTiming::PerformanceResourceTiming( | 51 PerformanceResourceTiming::PerformanceResourceTiming( |
| 52 const AtomicString& initiatorType, | |
| 53 double timeOrigin, | |
| 54 ResourceLoadTiming* timing, | |
| 55 double lastRedirectEndTime, | |
| 56 double finishTime, | |
| 57 unsigned long long transferSize, | |
| 58 unsigned long long encodedBodyLength, | |
| 59 unsigned long long decodedBodyLength, | |
| 60 bool didReuseConnection, | |
| 61 bool allowTimingDetails, | |
| 62 bool allowRedirectDetails, | |
| 63 const String& name, | |
| 64 const String& entryType, | |
| 65 double startTime) | |
|
kinuko
2016/11/06 15:16:43
Could we use delegated constructors to reduce dupl
sunjian
2016/11/08 02:10:19
Done.
| |
| 66 : PerformanceEntry( | |
| 67 name, | |
| 68 entryType, | |
| 69 monotonicTimeToDOMHighResTimeStamp(timeOrigin, startTime), | |
| 70 monotonicTimeToDOMHighResTimeStamp(timeOrigin, finishTime)), | |
| 71 m_initiatorType(initiatorType), | |
| 72 m_timeOrigin(timeOrigin), | |
| 73 m_timing(timing), | |
| 74 m_lastRedirectEndTime(lastRedirectEndTime), | |
| 75 m_finishTime(finishTime), | |
| 76 m_transferSize(transferSize), | |
| 77 m_encodedBodySize(encodedBodyLength), | |
| 78 m_decodedBodySize(decodedBodyLength), | |
| 79 m_didReuseConnection(didReuseConnection), | |
| 80 m_allowTimingDetails(allowTimingDetails), | |
| 81 m_allowRedirectDetails(allowRedirectDetails) {} | |
| 82 | |
| 83 PerformanceResourceTiming::PerformanceResourceTiming( | |
| 52 const ResourceTimingInfo& info, | 84 const ResourceTimingInfo& info, |
| 53 double timeOrigin, | 85 double timeOrigin, |
| 54 double startTime, | 86 double startTime, |
| 55 double lastRedirectEndTime, | 87 double lastRedirectEndTime, |
| 56 bool allowTimingDetails, | 88 bool allowTimingDetails, |
| 57 bool allowRedirectDetails) | 89 bool allowRedirectDetails) |
| 58 : PerformanceEntry( | 90 : PerformanceEntry( |
| 59 info.initialURL().getString(), | 91 info.initialURL().getString(), |
| 60 "resource", | 92 "resource", |
| 61 monotonicTimeToDOMHighResTimeStamp(timeOrigin, startTime), | 93 monotonicTimeToDOMHighResTimeStamp(timeOrigin, startTime), |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 253 builder.addNumber("secureConnectionStart", secureConnectionStart()); | 285 builder.addNumber("secureConnectionStart", secureConnectionStart()); |
| 254 builder.addNumber("requestStart", requestStart()); | 286 builder.addNumber("requestStart", requestStart()); |
| 255 builder.addNumber("responseStart", responseStart()); | 287 builder.addNumber("responseStart", responseStart()); |
| 256 builder.addNumber("responseEnd", responseEnd()); | 288 builder.addNumber("responseEnd", responseEnd()); |
| 257 builder.addNumber("transferSize", transferSize()); | 289 builder.addNumber("transferSize", transferSize()); |
| 258 builder.addNumber("encodedBodySize", encodedBodySize()); | 290 builder.addNumber("encodedBodySize", encodedBodySize()); |
| 259 builder.addNumber("decodedBodySize", decodedBodySize()); | 291 builder.addNumber("decodedBodySize", decodedBodySize()); |
| 260 } | 292 } |
| 261 | 293 |
| 262 } // namespace blink | 294 } // namespace blink |
| OLD | NEW |