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

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

Issue 1780523005: Fix JSON serialization of PerformanceEntry subclasses (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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) 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
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/PerformanceRenderTiming.h" 32 #include "core/timing/PerformanceRenderTiming.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 PerformanceRenderTiming::PerformanceRenderTiming(Document* requestingDocument, u nsigned sourceFrame, double startTime, double finishTime) 46 PerformanceRenderTiming::PerformanceRenderTiming(Document* requestingDocument, u nsigned sourceFrame, double startTime, double finishTime)
46 : PerformanceEntry(requestingDocument->url().getString(), "render", monotoni cTimeToDocumentMilliseconds(requestingDocument, startTime), monotonicTimeToDocum entMilliseconds(requestingDocument, finishTime)) 47 : PerformanceEntry(requestingDocument->url().getString(), "render", monotoni cTimeToDocumentMilliseconds(requestingDocument, startTime), monotonicTimeToDocum entMilliseconds(requestingDocument, finishTime))
47 , m_sourceFrame(sourceFrame) 48 , m_sourceFrame(sourceFrame)
48 , m_requestingDocument(requestingDocument) 49 , m_requestingDocument(requestingDocument)
49 { 50 {
50 } 51 }
51 52
52 PerformanceRenderTiming::~PerformanceRenderTiming() 53 PerformanceRenderTiming::~PerformanceRenderTiming()
53 { 54 {
54 } 55 }
55 56
56 unsigned PerformanceRenderTiming::sourceFrame() const 57 unsigned PerformanceRenderTiming::sourceFrame() const
57 { 58 {
58 return m_sourceFrame; 59 return m_sourceFrame;
59 } 60 }
60 61
62 void PerformanceRenderTiming::buildJSONValue(V8ObjectBuilder& builder) const
63 {
64 PerformanceEntry::buildJSONValue(builder);
65 builder.addNumber("sourceFrame", sourceFrame());
66 }
67
61 DEFINE_TRACE(PerformanceRenderTiming) 68 DEFINE_TRACE(PerformanceRenderTiming)
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698