| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2015 Google Inc. All rights reserved. | 2 * Copyright (C) 2015 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2015 Intel Inc. All rights reserved. | 3 * Copyright (C) 2015 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 13 matching lines...) Expand all Loading... |
| 24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 */ | 30 */ |
| 31 | 31 |
| 32 #include "core/timing/PerformanceCompositeTiming.h" | 32 #include "core/timing/PerformanceCompositeTiming.h" |
| 33 | 33 |
| 34 #include "bindings/core/v8/V8ObjectBuilder.h" |
| 34 #include "core/dom/Document.h" | 35 #include "core/dom/Document.h" |
| 35 #include "core/loader/DocumentLoader.h" | 36 #include "core/loader/DocumentLoader.h" |
| 36 | 37 |
| 37 namespace blink { | 38 namespace blink { |
| 38 | 39 |
| 39 static double monotonicTimeToDocumentMilliseconds(Document* document, double sec
onds) | 40 static double monotonicTimeToDocumentMilliseconds(Document* document, double sec
onds) |
| 40 { | 41 { |
| 41 ASSERT(seconds >= 0.0); | 42 ASSERT(seconds >= 0.0); |
| 42 return document->loader()->timing().monotonicTimeToZeroBasedDocumentTime(sec
onds) * 1000.0; | 43 return document->loader()->timing().monotonicTimeToZeroBasedDocumentTime(sec
onds) * 1000.0; |
| 43 } | 44 } |
| 44 | 45 |
| 45 PerformanceCompositeTiming::PerformanceCompositeTiming(Document* requestingDocum
ent, unsigned sourceFrame, double startTime) | 46 PerformanceCompositeTiming::PerformanceCompositeTiming(Document* requestingDocum
ent, unsigned sourceFrame, double startTime) |
| 46 : PerformanceEntry(requestingDocument->url().getString(), "composite", monot
onicTimeToDocumentMilliseconds(requestingDocument, startTime), monotonicTimeToDo
cumentMilliseconds(requestingDocument, startTime)) | 47 : PerformanceEntry(requestingDocument->url().getString(), "composite", monot
onicTimeToDocumentMilliseconds(requestingDocument, startTime), monotonicTimeToDo
cumentMilliseconds(requestingDocument, startTime)) |
| 47 , m_sourceFrame(sourceFrame) | 48 , m_sourceFrame(sourceFrame) |
| 48 , m_requestingDocument(requestingDocument) | 49 , m_requestingDocument(requestingDocument) |
| 49 { | 50 { |
| 50 } | 51 } |
| 51 | 52 |
| 52 PerformanceCompositeTiming::~PerformanceCompositeTiming() | 53 PerformanceCompositeTiming::~PerformanceCompositeTiming() |
| 53 { | 54 { |
| 54 } | 55 } |
| 55 | 56 |
| 56 unsigned PerformanceCompositeTiming::sourceFrame() const | 57 unsigned PerformanceCompositeTiming::sourceFrame() const |
| 57 { | 58 { |
| 58 return m_sourceFrame; | 59 return m_sourceFrame; |
| 59 } | 60 } |
| 60 | 61 |
| 62 void PerformanceCompositeTiming::buildJSONValue(V8ObjectBuilder& builder) const |
| 63 { |
| 64 PerformanceEntry::buildJSONValue(builder); |
| 65 builder.addNumber("sourceFrame", sourceFrame()); |
| 66 } |
| 67 |
| 61 DEFINE_TRACE(PerformanceCompositeTiming) | 68 DEFINE_TRACE(PerformanceCompositeTiming) |
| 62 { | 69 { |
| 63 visitor->trace(m_requestingDocument); | 70 visitor->trace(m_requestingDocument); |
| 64 PerformanceEntry::trace(visitor); | 71 PerformanceEntry::trace(visitor); |
| 65 } | 72 } |
| 66 | 73 |
| 67 } // namespace blink | 74 } // namespace blink |
| OLD | NEW |