Add toJSON to some performance idls
This CL adds toJSON to the following:
* PerformanceLongTaskTiming
* PerformanceResourceTiming
* TaskAttributionTiming
* Performance within workers
Link to Intent to Implement and Ship thread:
https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/ZnXvNe_wNyk
Bug: 740094
Change-Id: I54622b9bd213fd806a9108598ccf4798c2ceffa2
Reviewed-on: https://chromium-review.googlesource.com/802019
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Reviewed-by: Philip Jägenstedt <foolip@chromium.org>
Reviewed-by: Bo <boliu@chromium.org>
Reviewed-by: Timothy Dresser <tdresser@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#523532}
diff --git a/android_webview/tools/system_webview_shell/test/data/webexposed/global-interface-listing-expected.txt b/android_webview/tools/system_webview_shell/test/data/webexposed/global-interface-listing-expected.txt
index f30bf36..3147d8a 100644
--- a/android_webview/tools/system_webview_shell/test/data/webexposed/global-interface-listing-expected.txt
+++ b/android_webview/tools/system_webview_shell/test/data/webexposed/global-interface-listing-expected.txt
@@ -3218,6 +3218,7 @@
getter secureConnectionStart
getter workerStart
method constructor
+ method toJSON
interface PerformanceTiming
getter connectEnd
getter connectStart
diff --git a/third_party/WebKit/LayoutTests/external/wpt/hr-time/idlharness-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/hr-time/idlharness-expected.txt
deleted file mode 100644
index c26574a..0000000
--- a/third_party/WebKit/LayoutTests/external/wpt/hr-time/idlharness-expected.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-This is a testharness.js-based test.
-PASS Test driver
-PASS Window interface: attribute performance
-PASS Window interface: window must inherit property "performance" with the proper type
-PASS WorkerGlobalScope interface: existence and properties of interface object
-PASS DedicatedWorkerGlobalScope interface: existence and properties of interface object
-PASS SharedWorkerGlobalScope interface: existence and properties of interface object
-PASS WorkerNavigator interface: existence and properties of interface object
-PASS WorkerLocation interface: existence and properties of interface object
-PASS Performance interface: existence and properties of interface object
-PASS Performance interface object length
-PASS Performance interface object name
-PASS Performance interface: existence and properties of interface prototype object
-PASS Performance interface: existence and properties of interface prototype object's "constructor" property
-PASS Performance interface: operation now()
-PASS Performance interface: attribute timeOrigin
-PASS Performance interface: operation toJSON()
-PASS Performance must be primary interface of window.performance
-PASS Stringification of window.performance
-PASS Performance interface: window.performance must inherit property "now()" with the proper type
-PASS Performance interface: window.performance must inherit property "timeOrigin" with the proper type
-PASS Performance interface: window.performance must inherit property "toJSON()" with the proper type
-FAIL Test default toJSON operation of Performance assert_true: property "timeOrigin" should be present in the output of Performance.prototype.toJSON() expected true got false
-Harness: the test ran to completion.
-
diff --git a/third_party/WebKit/LayoutTests/external/wpt/resource-timing/idlharness-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/resource-timing/idlharness-expected.txt
deleted file mode 100644
index 954cfcbe..0000000
--- a/third_party/WebKit/LayoutTests/external/wpt/resource-timing/idlharness-expected.txt
+++ /dev/null
@@ -1,55 +0,0 @@
-This is a testharness.js-based test.
-Found 51 tests; 50 PASS, 1 FAIL, 0 TIMEOUT, 0 NOTRUN.
-PASS Performance interface: operation clearResourceTimings()
-PASS Performance interface: operation setResourceTimingBufferSize(unsigned long)
-PASS Performance interface: attribute onresourcetimingbufferfull
-PASS Performance interface: window.performance must inherit property "clearResourceTimings()" with the proper type
-PASS Performance interface: window.performance must inherit property "setResourceTimingBufferSize(unsigned long)" with the proper type
-PASS Performance interface: calling setResourceTimingBufferSize(unsigned long) on window.performance with too few arguments must throw TypeError
-PASS Performance interface: window.performance must inherit property "onresourcetimingbufferfull" with the proper type
-PASS PerformanceResourceTiming interface: existence and properties of interface object
-PASS PerformanceResourceTiming interface object length
-PASS PerformanceResourceTiming interface object name
-PASS PerformanceResourceTiming interface: existence and properties of interface prototype object
-PASS PerformanceResourceTiming interface: existence and properties of interface prototype object's "constructor" property
-PASS PerformanceResourceTiming interface: attribute initiatorType
-PASS PerformanceResourceTiming interface: attribute nextHopProtocol
-PASS PerformanceResourceTiming interface: attribute workerStart
-PASS PerformanceResourceTiming interface: attribute redirectStart
-PASS PerformanceResourceTiming interface: attribute redirectEnd
-PASS PerformanceResourceTiming interface: attribute fetchStart
-PASS PerformanceResourceTiming interface: attribute domainLookupStart
-PASS PerformanceResourceTiming interface: attribute domainLookupEnd
-PASS PerformanceResourceTiming interface: attribute connectStart
-PASS PerformanceResourceTiming interface: attribute connectEnd
-PASS PerformanceResourceTiming interface: attribute secureConnectionStart
-PASS PerformanceResourceTiming interface: attribute requestStart
-PASS PerformanceResourceTiming interface: attribute responseStart
-PASS PerformanceResourceTiming interface: attribute responseEnd
-PASS PerformanceResourceTiming interface: attribute transferSize
-PASS PerformanceResourceTiming interface: attribute encodedBodySize
-PASS PerformanceResourceTiming interface: attribute decodedBodySize
-FAIL PerformanceResourceTiming interface: operation toJSON() assert_own_property: interface prototype object missing non-static operation expected property "toJSON" missing
-PASS PerformanceResourceTiming must be primary interface of window.performance.getEntriesByType('resource')[0]
-PASS Stringification of window.performance.getEntriesByType('resource')[0]
-PASS PerformanceResourceTiming interface: window.performance.getEntriesByType('resource')[0] must inherit property "initiatorType" with the proper type
-PASS PerformanceResourceTiming interface: window.performance.getEntriesByType('resource')[0] must inherit property "nextHopProtocol" with the proper type
-PASS PerformanceResourceTiming interface: window.performance.getEntriesByType('resource')[0] must inherit property "workerStart" with the proper type
-PASS PerformanceResourceTiming interface: window.performance.getEntriesByType('resource')[0] must inherit property "redirectStart" with the proper type
-PASS PerformanceResourceTiming interface: window.performance.getEntriesByType('resource')[0] must inherit property "redirectEnd" with the proper type
-PASS PerformanceResourceTiming interface: window.performance.getEntriesByType('resource')[0] must inherit property "fetchStart" with the proper type
-PASS PerformanceResourceTiming interface: window.performance.getEntriesByType('resource')[0] must inherit property "domainLookupStart" with the proper type
-PASS PerformanceResourceTiming interface: window.performance.getEntriesByType('resource')[0] must inherit property "domainLookupEnd" with the proper type
-PASS PerformanceResourceTiming interface: window.performance.getEntriesByType('resource')[0] must inherit property "connectStart" with the proper type
-PASS PerformanceResourceTiming interface: window.performance.getEntriesByType('resource')[0] must inherit property "connectEnd" with the proper type
-PASS PerformanceResourceTiming interface: window.performance.getEntriesByType('resource')[0] must inherit property "secureConnectionStart" with the proper type
-PASS PerformanceResourceTiming interface: window.performance.getEntriesByType('resource')[0] must inherit property "requestStart" with the proper type
-PASS PerformanceResourceTiming interface: window.performance.getEntriesByType('resource')[0] must inherit property "responseStart" with the proper type
-PASS PerformanceResourceTiming interface: window.performance.getEntriesByType('resource')[0] must inherit property "responseEnd" with the proper type
-PASS PerformanceResourceTiming interface: window.performance.getEntriesByType('resource')[0] must inherit property "transferSize" with the proper type
-PASS PerformanceResourceTiming interface: window.performance.getEntriesByType('resource')[0] must inherit property "encodedBodySize" with the proper type
-PASS PerformanceResourceTiming interface: window.performance.getEntriesByType('resource')[0] must inherit property "decodedBodySize" with the proper type
-PASS PerformanceResourceTiming interface: window.performance.getEntriesByType('resource')[0] must inherit property "toJSON()" with the proper type
-PASS Test default toJSON operation of PerformanceResourceTiming
-Harness: the test ran to completion.
-
diff --git a/third_party/WebKit/LayoutTests/external/wpt/workers/worker-performance.worker.js b/third_party/WebKit/LayoutTests/external/wpt/workers/worker-performance.worker.js
index c4e562b..88db976 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/workers/worker-performance.worker.js
+++ b/third_party/WebKit/LayoutTests/external/wpt/workers/worker-performance.worker.js
@@ -110,9 +110,9 @@
assert_equals(typeof(performance.navigation), "undefined", "performance.navigation is undefined");
}, "performance.navigation is not available in workers");
-test(function testPerformanceHasNoToJSON () {
- assert_equals(typeof(performance.toJSON), "undefined", "performance.toJSON is undefined");
-}, "performance.toJSON is not available in workers");
+test(function testPerformanceHasToJSON () {
+ assert_equals(typeof(performance.toJSON), "function", "performance.toJSON is a function");
+}, "performance.toJSON is available in workers");
test(function testPerformanceNoNavigationEntries () {
assert_equals(performance.getEntriesByType("navigation").length, 0, "getEntriesByType(\"navigation\") returns nothing");
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Window/window-properties-performance-expected.txt b/third_party/WebKit/LayoutTests/fast/dom/Window/window-properties-performance-expected.txt
index 1d0b923..3d442d81 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/Window/window-properties-performance-expected.txt
+++ b/third_party/WebKit/LayoutTests/fast/dom/Window/window-properties-performance-expected.txt
@@ -88,6 +88,7 @@
jsonizedPerformance.navigation [object Object]
jsonizedPerformance.navigation.redirectCount [number]
jsonizedPerformance.navigation.type [number]
+jsonizedPerformance.timeOrigin [number]
jsonizedPerformance.timing [object Object]
jsonizedPerformance.timing.connectEnd [number]
jsonizedPerformance.timing.connectStart [number]
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt b/third_party/WebKit/LayoutTests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt
index ea79d00..7b15c4f 100644
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt
@@ -1003,6 +1003,7 @@
getter transferSize
getter workerStart
method constructor
+ method toJSON
interface PerformanceServerTiming
attribute @@toStringTag
getter description
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt
index d751509..63f9df1 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt
@@ -694,6 +694,7 @@
getter transferSize
getter workerStart
method constructor
+ method toJSON
interface PermissionStatus : EventTarget
attribute @@toStringTag
getter onchange
diff --git a/third_party/WebKit/LayoutTests/virtual/stable/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt b/third_party/WebKit/LayoutTests/virtual/stable/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt
index d751509..63f9df1 100644
--- a/third_party/WebKit/LayoutTests/virtual/stable/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt
+++ b/third_party/WebKit/LayoutTests/virtual/stable/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt
@@ -694,6 +694,7 @@
getter transferSize
getter workerStart
method constructor
+ method toJSON
interface PermissionStatus : EventTarget
attribute @@toStringTag
getter onchange
diff --git a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-dedicated-worker-expected.txt b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-dedicated-worker-expected.txt
index 8c81102..9c6a6bf 100644
--- a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-dedicated-worker-expected.txt
+++ b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-dedicated-worker-expected.txt
@@ -669,6 +669,7 @@
[Worker] getter transferSize
[Worker] getter workerStart
[Worker] method constructor
+[Worker] method toJSON
[Worker] interface PermissionStatus : EventTarget
[Worker] attribute @@toStringTag
[Worker] getter onchange
diff --git a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-expected.txt b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-expected.txt
index 17b8dced..5aad7c67 100644
--- a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-expected.txt
+++ b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-expected.txt
@@ -4034,6 +4034,7 @@
attribute @@toStringTag
getter attribution
method constructor
+ method toJSON
interface PerformanceMark : PerformanceEntry
attribute @@toStringTag
method constructor
@@ -4098,6 +4099,7 @@
getter transferSize
getter workerStart
method constructor
+ method toJSON
interface PerformanceTiming
attribute @@toStringTag
getter connectEnd
@@ -5891,6 +5893,7 @@
getter containerSrc
getter containerType
method constructor
+ method toJSON
interface Text : CharacterData
attribute @@toStringTag
getter assignedSlot
diff --git a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-shared-worker-expected.txt b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-shared-worker-expected.txt
index 4a11b93..cc84aca 100644
--- a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-shared-worker-expected.txt
+++ b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-shared-worker-expected.txt
@@ -664,6 +664,7 @@
[Worker] getter transferSize
[Worker] getter workerStart
[Worker] method constructor
+[Worker] method toJSON
[Worker] interface PermissionStatus : EventTarget
[Worker] attribute @@toStringTag
[Worker] getter onchange
diff --git a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-dedicated-worker-expected.txt b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-dedicated-worker-expected.txt
index 55837ba..acf72d7 100644
--- a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-dedicated-worker-expected.txt
+++ b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-dedicated-worker-expected.txt
@@ -932,6 +932,7 @@
[Worker] getter transferSize
[Worker] getter workerStart
[Worker] method constructor
+[Worker] method toJSON
[Worker] interface PerformanceServerTiming
[Worker] attribute @@toStringTag
[Worker] getter description
diff --git a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt
index 3b8a815..0cd4d94 100644
--- a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt
+++ b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt
@@ -4910,6 +4910,7 @@
attribute @@toStringTag
getter attribution
method constructor
+ method toJSON
interface PerformanceMark : PerformanceEntry
attribute @@toStringTag
method constructor
@@ -4975,6 +4976,7 @@
getter transferSize
getter workerStart
method constructor
+ method toJSON
interface PerformanceServerTiming
attribute @@toStringTag
getter description
@@ -6847,6 +6849,7 @@
getter containerSrc
getter containerType
method constructor
+ method toJSON
interface Text : CharacterData
attribute @@toStringTag
getter assignedSlot
diff --git a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-shared-worker-expected.txt b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-shared-worker-expected.txt
index 1dd2fe5..878e3d5 100644
--- a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-shared-worker-expected.txt
+++ b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-shared-worker-expected.txt
@@ -927,6 +927,7 @@
[Worker] getter transferSize
[Worker] getter workerStart
[Worker] method constructor
+[Worker] method toJSON
[Worker] interface PerformanceServerTiming
[Worker] attribute @@toStringTag
[Worker] getter description
diff --git a/third_party/WebKit/Source/core/timing/Performance.cpp b/third_party/WebKit/Source/core/timing/Performance.cpp
index 35aa79d..6831a24 100644
--- a/third_party/WebKit/Source/core/timing/Performance.cpp
+++ b/third_party/WebKit/Source/core/timing/Performance.cpp
@@ -175,11 +175,11 @@
}
}
-ScriptValue Performance::toJSONForBinding(ScriptState* script_state) const {
- V8ObjectBuilder result(script_state);
- result.Add("timing", timing()->toJSONForBinding(script_state));
- result.Add("navigation", navigation()->toJSONForBinding(script_state));
- return result.GetScriptValue();
+void Performance::BuildJSONValue(V8ObjectBuilder& builder) const {
+ PerformanceBase::BuildJSONValue(builder);
+ builder.Add("timing", timing()->toJSONForBinding(builder.GetScriptState()));
+ builder.Add("navigation",
+ navigation()->toJSONForBinding(builder.GetScriptState()));
}
void Performance::Trace(blink::Visitor* visitor) {
diff --git a/third_party/WebKit/Source/core/timing/Performance.h b/third_party/WebKit/Source/core/timing/Performance.h
index 73efe12..1ce78f4 100644
--- a/third_party/WebKit/Source/core/timing/Performance.h
+++ b/third_party/WebKit/Source/core/timing/Performance.h
@@ -42,9 +42,6 @@
namespace blink {
-class ScriptState;
-class ScriptValue;
-
class CORE_EXPORT Performance final : public PerformanceBase,
public PerformanceMonitor::Client,
public DOMWindowClient {
@@ -66,8 +63,6 @@
void UpdateLongTaskInstrumentation() override;
- ScriptValue toJSONForBinding(ScriptState*) const;
-
void Trace(blink::Visitor*) override;
using PerformanceBase::TraceWrappers;
@@ -89,6 +84,8 @@
bool has_multiple_contexts,
const SubTaskAttribution::EntriesVector& sub_task_attributions) override;
+ void BuildJSONValue(V8ObjectBuilder&) const override;
+
mutable Member<PerformanceNavigation> navigation_;
mutable Member<PerformanceTiming> timing_;
};
diff --git a/third_party/WebKit/Source/core/timing/PerformanceBase.cpp b/third_party/WebKit/Source/core/timing/PerformanceBase.cpp
index 5ed113b..15820dc 100644
--- a/third_party/WebKit/Source/core/timing/PerformanceBase.cpp
+++ b/third_party/WebKit/Source/core/timing/PerformanceBase.cpp
@@ -32,6 +32,7 @@
#include "core/timing/PerformanceBase.h"
#include <algorithm>
+#include "bindings/core/v8/V8ObjectBuilder.h"
#include "core/dom/Document.h"
#include "core/dom/DocumentTiming.h"
#include "core/dom/events/Event.h"
@@ -610,6 +611,17 @@
return MonotonicTimeToDOMHighResTimeStamp(MonotonicallyIncreasingTime());
}
+ScriptValue PerformanceBase::toJSONForBinding(ScriptState* script_state) const {
+ V8ObjectBuilder result(script_state);
+ BuildJSONValue(result);
+ return result.GetScriptValue();
+}
+
+void PerformanceBase::BuildJSONValue(V8ObjectBuilder& builder) const {
+ builder.AddNumber("timeOrigin", timeOrigin());
+ // |memory| is not part of the spec, omitted.
+}
+
void PerformanceBase::Trace(blink::Visitor* visitor) {
visitor->Trace(frame_timing_buffer_);
visitor->Trace(resource_timing_buffer_);
diff --git a/third_party/WebKit/Source/core/timing/PerformanceBase.h b/third_party/WebKit/Source/core/timing/PerformanceBase.h
index 77425a616..014081e 100644
--- a/third_party/WebKit/Source/core/timing/PerformanceBase.h
+++ b/third_party/WebKit/Source/core/timing/PerformanceBase.h
@@ -56,7 +56,10 @@
class ResourceTimingInfo;
class SecurityOrigin;
class UserTiming;
+class ScriptState;
+class ScriptValue;
class SubTaskAttribution;
+class V8ObjectBuilder;
using PerformanceEntryVector = HeapVector<Member<PerformanceEntry>>;
@@ -187,6 +190,8 @@
const SecurityOrigin&,
ExecutionContext*);
+ ScriptValue toJSONForBinding(ScriptState*) const;
+
void Trace(blink::Visitor*) override;
void TraceWrappers(const ScriptWrappableVisitor*) const override;
@@ -216,6 +221,8 @@
void DeliverObservationsTimerFired(TimerBase*);
+ virtual void BuildJSONValue(V8ObjectBuilder&) const;
+
PerformanceEntryVector frame_timing_buffer_;
unsigned frame_timing_buffer_size_;
PerformanceEntryVector resource_timing_buffer_;
diff --git a/third_party/WebKit/Source/core/timing/PerformanceEntry.cpp b/third_party/WebKit/Source/core/timing/PerformanceEntry.cpp
index 183b210..2797b47 100644
--- a/third_party/WebKit/Source/core/timing/PerformanceEntry.cpp
+++ b/third_party/WebKit/Source/core/timing/PerformanceEntry.cpp
@@ -95,12 +95,11 @@
ScriptValue PerformanceEntry::toJSONForBinding(
ScriptState* script_state) const {
V8ObjectBuilder result(script_state);
- BuildJSONValue(script_state, result);
+ BuildJSONValue(result);
return result.GetScriptValue();
}
-void PerformanceEntry::BuildJSONValue(ScriptState* script_state,
- V8ObjectBuilder& builder) const {
+void PerformanceEntry::BuildJSONValue(V8ObjectBuilder& builder) const {
builder.AddString("name", name());
builder.AddString("entryType", entryType());
builder.AddNumber("startTime", startTime());
diff --git a/third_party/WebKit/Source/core/timing/PerformanceEntry.h b/third_party/WebKit/Source/core/timing/PerformanceEntry.h
index 31218e2..eb41eb60b 100644
--- a/third_party/WebKit/Source/core/timing/PerformanceEntry.h
+++ b/third_party/WebKit/Source/core/timing/PerformanceEntry.h
@@ -99,7 +99,7 @@
const String& entry_type,
double start_time,
double finish_time);
- virtual void BuildJSONValue(ScriptState*, V8ObjectBuilder&) const;
+ virtual void BuildJSONValue(V8ObjectBuilder&) const;
private:
const String name_;
diff --git a/third_party/WebKit/Source/core/timing/PerformanceLongTaskTiming.cpp b/third_party/WebKit/Source/core/timing/PerformanceLongTaskTiming.cpp
index fae21ac..19d659e 100644
--- a/third_party/WebKit/Source/core/timing/PerformanceLongTaskTiming.cpp
+++ b/third_party/WebKit/Source/core/timing/PerformanceLongTaskTiming.cpp
@@ -3,6 +3,8 @@
// found in the LICENSE file.
#include "core/timing/PerformanceLongTaskTiming.h"
+
+#include "bindings/core/v8/V8ObjectBuilder.h"
#include "core/frame/DOMWindow.h"
#include "core/timing/SubTaskAttribution.h"
#include "core/timing/TaskAttributionTiming.h"
@@ -57,6 +59,16 @@
return attribution_;
}
+void PerformanceLongTaskTiming::BuildJSONValue(V8ObjectBuilder& builder) const {
+ PerformanceEntry::BuildJSONValue(builder);
+ Vector<ScriptValue> attribution;
+ for (unsigned i = 0; i < attribution_.size(); i++) {
+ attribution.push_back(
+ attribution_[i]->toJSONForBinding(builder.GetScriptState()));
+ }
+ builder.Add("attribution", attribution);
+}
+
void PerformanceLongTaskTiming::Trace(blink::Visitor* visitor) {
visitor->Trace(attribution_);
PerformanceEntry::Trace(visitor);
diff --git a/third_party/WebKit/Source/core/timing/PerformanceLongTaskTiming.h b/third_party/WebKit/Source/core/timing/PerformanceLongTaskTiming.h
index fad8687..440f925 100644
--- a/third_party/WebKit/Source/core/timing/PerformanceLongTaskTiming.h
+++ b/third_party/WebKit/Source/core/timing/PerformanceLongTaskTiming.h
@@ -44,6 +44,8 @@
const SubTaskAttribution::EntriesVector& sub_task_attributions);
~PerformanceLongTaskTiming() override;
+ void BuildJSONValue(V8ObjectBuilder&) const override;
+
TaskAttributionVector attribution_;
};
diff --git a/third_party/WebKit/Source/core/timing/PerformanceLongTaskTiming.idl b/third_party/WebKit/Source/core/timing/PerformanceLongTaskTiming.idl
index b36f04b..d9017f7 100644
--- a/third_party/WebKit/Source/core/timing/PerformanceLongTaskTiming.idl
+++ b/third_party/WebKit/Source/core/timing/PerformanceLongTaskTiming.idl
@@ -5,4 +5,5 @@
// https://w3c.github.io/longtasks/#sec-PerformanceLongTaskTiming
interface PerformanceLongTaskTiming : PerformanceEntry {
[SameObject, SaveSameObject] readonly attribute FrozenArray<TaskAttributionTiming> attribution;
+ serializer = {inherit, attribute};
};
diff --git a/third_party/WebKit/Source/core/timing/PerformanceNavigationTiming.cpp b/third_party/WebKit/Source/core/timing/PerformanceNavigationTiming.cpp
index 922bd2c..f53f92ad 100644
--- a/third_party/WebKit/Source/core/timing/PerformanceNavigationTiming.cpp
+++ b/third_party/WebKit/Source/core/timing/PerformanceNavigationTiming.cpp
@@ -267,9 +267,8 @@
}
void PerformanceNavigationTiming::BuildJSONValue(
- ScriptState* script_state,
V8ObjectBuilder& builder) const {
- PerformanceResourceTiming::BuildJSONValue(script_state, builder);
+ PerformanceResourceTiming::BuildJSONValue(builder);
builder.AddNumber("unloadEventStart", unloadEventStart());
builder.AddNumber("unloadEventEnd", unloadEventEnd());
builder.AddNumber("domInteractive", domInteractive());
diff --git a/third_party/WebKit/Source/core/timing/PerformanceNavigationTiming.h b/third_party/WebKit/Source/core/timing/PerformanceNavigationTiming.h
index 1c749f0..82d8eeb 100644
--- a/third_party/WebKit/Source/core/timing/PerformanceNavigationTiming.h
+++ b/third_party/WebKit/Source/core/timing/PerformanceNavigationTiming.h
@@ -61,7 +61,7 @@
virtual void Trace(blink::Visitor*);
protected:
- void BuildJSONValue(ScriptState*, V8ObjectBuilder&) const override;
+ void BuildJSONValue(V8ObjectBuilder&) const override;
private:
~PerformanceNavigationTiming() override;
diff --git a/third_party/WebKit/Source/core/timing/PerformanceResourceTiming.cpp b/third_party/WebKit/Source/core/timing/PerformanceResourceTiming.cpp
index bfc5b5d..6c65e24 100644
--- a/third_party/WebKit/Source/core/timing/PerformanceResourceTiming.cpp
+++ b/third_party/WebKit/Source/core/timing/PerformanceResourceTiming.cpp
@@ -318,9 +318,8 @@
return serverTiming_;
}
-void PerformanceResourceTiming::BuildJSONValue(ScriptState* script_state,
- V8ObjectBuilder& builder) const {
- PerformanceEntry::BuildJSONValue(script_state, builder);
+void PerformanceResourceTiming::BuildJSONValue(V8ObjectBuilder& builder) const {
+ PerformanceEntry::BuildJSONValue(builder);
builder.AddString("initiatorType", initiatorType());
builder.AddString("nextHopProtocol", nextHopProtocol());
builder.AddNumber("workerStart", workerStart());
@@ -341,7 +340,8 @@
Vector<ScriptValue> serverTiming;
for (unsigned i = 0; i < serverTiming_.size(); i++) {
- serverTiming.push_back(serverTiming_[i]->toJSONForBinding(script_state));
+ serverTiming.push_back(
+ serverTiming_[i]->toJSONForBinding(builder.GetScriptState()));
}
builder.Add("serverTiming", serverTiming);
}
diff --git a/third_party/WebKit/Source/core/timing/PerformanceResourceTiming.h b/third_party/WebKit/Source/core/timing/PerformanceResourceTiming.h
index 03e6ea0..621f789 100644
--- a/third_party/WebKit/Source/core/timing/PerformanceResourceTiming.h
+++ b/third_party/WebKit/Source/core/timing/PerformanceResourceTiming.h
@@ -95,7 +95,7 @@
virtual void Trace(blink::Visitor*);
protected:
- void BuildJSONValue(ScriptState*, V8ObjectBuilder&) const override;
+ void BuildJSONValue(V8ObjectBuilder&) const override;
// This constructor is for PerformanceNavigationTiming.
// Related doc: https://goo.gl/uNecAj.
diff --git a/third_party/WebKit/Source/core/timing/PerformanceResourceTiming.idl b/third_party/WebKit/Source/core/timing/PerformanceResourceTiming.idl
index 3005a6e..a624dc4 100644
--- a/third_party/WebKit/Source/core/timing/PerformanceResourceTiming.idl
+++ b/third_party/WebKit/Source/core/timing/PerformanceResourceTiming.idl
@@ -50,6 +50,5 @@
[MeasureAs=PerformanceResourceTimingSizes] readonly attribute unsigned long long encodedBodySize;
[MeasureAs=PerformanceResourceTimingSizes] readonly attribute unsigned long long decodedBodySize;
[RuntimeEnabled=ServerTiming] readonly attribute FrozenArray<PerformanceServerTiming> serverTiming;
- // TODO(foolip): The spec has a serializer:
- // serializer = {inherit, attribute};
+ serializer = {inherit, attribute};
};
diff --git a/third_party/WebKit/Source/core/timing/TaskAttributionTiming.cpp b/third_party/WebKit/Source/core/timing/TaskAttributionTiming.cpp
index be5b70c58..db97f6b 100644
--- a/third_party/WebKit/Source/core/timing/TaskAttributionTiming.cpp
+++ b/third_party/WebKit/Source/core/timing/TaskAttributionTiming.cpp
@@ -4,6 +4,7 @@
#include "core/timing/TaskAttributionTiming.h"
+#include "bindings/core/v8/V8ObjectBuilder.h"
#include "core/frame/DOMWindow.h"
namespace blink {
@@ -45,6 +46,14 @@
return container_name_;
}
+void TaskAttributionTiming::BuildJSONValue(V8ObjectBuilder& builder) const {
+ PerformanceEntry::BuildJSONValue(builder);
+ builder.AddString("containerType", containerType());
+ builder.AddString("containerSrc", containerSrc());
+ builder.AddString("containerId", containerId());
+ builder.AddString("containerName", containerName());
+}
+
void TaskAttributionTiming::Trace(blink::Visitor* visitor) {
PerformanceEntry::Trace(visitor);
}
diff --git a/third_party/WebKit/Source/core/timing/TaskAttributionTiming.h b/third_party/WebKit/Source/core/timing/TaskAttributionTiming.h
index 451c6ac..42f1787 100644
--- a/third_party/WebKit/Source/core/timing/TaskAttributionTiming.h
+++ b/third_party/WebKit/Source/core/timing/TaskAttributionTiming.h
@@ -59,6 +59,8 @@
double start_time,
double finish_time,
String script_url);
+ void BuildJSONValue(V8ObjectBuilder&) const override;
+
String container_type_;
String container_src_;
String container_id_;
diff --git a/third_party/WebKit/Source/core/timing/TaskAttributionTiming.idl b/third_party/WebKit/Source/core/timing/TaskAttributionTiming.idl
index 0ac8bb9..27109b6 100644
--- a/third_party/WebKit/Source/core/timing/TaskAttributionTiming.idl
+++ b/third_party/WebKit/Source/core/timing/TaskAttributionTiming.idl
@@ -9,4 +9,5 @@
readonly attribute DOMString containerSrc;
readonly attribute DOMString containerId;
readonly attribute DOMString containerName;
+ serializer = {inherit, attribute};
};
diff --git a/third_party/WebKit/Source/core/timing/WorkerPerformance.idl b/third_party/WebKit/Source/core/timing/WorkerPerformance.idl
index eed8db15..67d3fb9a 100644
--- a/third_party/WebKit/Source/core/timing/WorkerPerformance.idl
+++ b/third_party/WebKit/Source/core/timing/WorkerPerformance.idl
@@ -63,4 +63,6 @@
// TODO(foolip): There is no spec for the Memory Info API, see blink-dev:
// https://groups.google.com/a/chromium.org/d/msg/blink-dev/g5YRCGpC9vs/b4OJz71NmPwJ
[RuntimeEnabled=MemoryInfoInWorkers] readonly attribute MemoryInfo memory;
+
+ serializer = {attribute};
};