@paulirish/trace_engine 0.0.51 → 0.0.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.tmp/tsbuildinfo/tsconfig.tsbuildinfo +1 -1
- package/core/platform/DOMUtilities.d.ts +8 -0
- package/core/platform/DOMUtilities.js +14 -0
- package/core/platform/DOMUtilities.js.map +1 -1
- package/core/platform/StringUtilities.d.ts +1 -5
- package/core/platform/StringUtilities.js +4 -1
- package/core/platform/StringUtilities.js.map +1 -1
- package/core/platform/devtools_entrypoint-bundle-typescript-tsconfig.json +1 -1
- package/core/platform/platform-tsconfig.json +1 -1
- package/generated/protocol.d.ts +345 -44
- package/locales/af.json +11 -5
- package/locales/am.json +7 -1
- package/locales/ar.json +7 -1
- package/locales/as.json +7 -1
- package/locales/az.json +7 -1
- package/locales/be.json +7 -1
- package/locales/bg.json +7 -1
- package/locales/bn.json +7 -1
- package/locales/bs.json +7 -1
- package/locales/ca.json +7 -1
- package/locales/cs.json +7 -1
- package/locales/cy.json +7 -1
- package/locales/da.json +7 -1
- package/locales/de.json +7 -1
- package/locales/el.json +7 -1
- package/locales/en-GB.json +7 -1
- package/locales/en-US.json +52 -7
- package/locales/en-XL.json +52 -7
- package/locales/es-419.json +7 -1
- package/locales/es.json +7 -1
- package/locales/et.json +7 -1
- package/locales/eu.json +7 -1
- package/locales/fa.json +7 -1
- package/locales/fi.json +7 -1
- package/locales/fil.json +7 -1
- package/locales/fr-CA.json +7 -1
- package/locales/fr.json +7 -1
- package/locales/gl.json +7 -1
- package/locales/gu.json +7 -1
- package/locales/he.json +7 -1
- package/locales/hi.json +7 -1
- package/locales/hr.json +7 -1
- package/locales/hu.json +7 -1
- package/locales/hy.json +7 -1
- package/locales/id.json +7 -1
- package/locales/is.json +7 -1
- package/locales/it.json +7 -1
- package/locales/ja.json +7 -1
- package/locales/ka.json +7 -1
- package/locales/kk.json +7 -1
- package/locales/km.json +7 -1
- package/locales/kn.json +7 -1
- package/locales/ko.json +7 -1
- package/locales/ky.json +7 -1
- package/locales/lo.json +7 -1
- package/locales/lt.json +7 -1
- package/locales/lv.json +7 -1
- package/locales/mk.json +7 -1
- package/locales/ml.json +7 -1
- package/locales/mn.json +7 -1
- package/locales/mr.json +7 -1
- package/locales/ms.json +7 -1
- package/locales/my.json +7 -1
- package/locales/ne.json +7 -1
- package/locales/nl.json +7 -1
- package/locales/no.json +7 -1
- package/locales/or.json +7 -1
- package/locales/pa.json +7 -1
- package/locales/pl.json +7 -1
- package/locales/pt-PT.json +7 -1
- package/locales/pt.json +7 -1
- package/locales/ro.json +7 -1
- package/locales/ru.json +7 -1
- package/locales/si.json +7 -1
- package/locales/sk.json +7 -1
- package/locales/sl.json +7 -1
- package/locales/sq.json +7 -1
- package/locales/sr-Latn.json +7 -1
- package/locales/sr.json +7 -1
- package/locales/sv.json +7 -1
- package/locales/sw.json +7 -1
- package/locales/ta.json +7 -1
- package/locales/te.json +7 -1
- package/locales/th.json +7 -1
- package/locales/tr.json +7 -1
- package/locales/uk.json +7 -1
- package/locales/ur.json +7 -1
- package/locales/uz.json +7 -1
- package/locales/vi.json +7 -1
- package/locales/zh-HK.json +7 -1
- package/locales/zh-TW.json +7 -1
- package/locales/zh.json +7 -1
- package/locales/zu.json +7 -1
- package/models/cpu_profile/cpu_profile-tsconfig.json +1 -1
- package/models/cpu_profile/devtools_entrypoint-bundle-typescript-tsconfig.json +1 -1
- package/models/trace/LanternComputationData.js +3 -3
- package/models/trace/LanternComputationData.js.map +1 -1
- package/models/trace/Processor.d.ts +1 -3
- package/models/trace/Processor.js +1 -1
- package/models/trace/Processor.js.map +1 -1
- package/models/trace/TracingManager.js.map +1 -1
- package/models/trace/devtools_entrypoint-bundle-typescript-tsconfig.json +1 -1
- package/models/trace/extras/ScriptDuplication.d.ts +5 -2
- package/models/trace/extras/ScriptDuplication.js +4 -2
- package/models/trace/extras/ScriptDuplication.js.map +1 -1
- package/models/trace/extras/StackTraceForEvent.js +88 -47
- package/models/trace/extras/StackTraceForEvent.js.map +1 -1
- package/models/trace/extras/ThirdParties.d.ts +13 -12
- package/models/trace/extras/ThirdParties.js +50 -19
- package/models/trace/extras/ThirdParties.js.map +1 -1
- package/models/trace/extras/devtools_entrypoint-bundle-typescript-tsconfig.json +1 -1
- package/models/trace/extras/extras-tsconfig.json +1 -1
- package/models/trace/extras/extras.d.ts +98 -6
- package/models/trace/extras/extras.js +98 -6
- package/models/trace/handlers/AsyncJSCallsHandler.d.ts +5 -0
- package/models/trace/handlers/AsyncJSCallsHandler.js +12 -9
- package/models/trace/handlers/AsyncJSCallsHandler.js.map +1 -1
- package/models/trace/handlers/FramesHandler.js.map +1 -1
- package/models/trace/handlers/NetworkRequestsHandler.d.ts +1 -0
- package/models/trace/handlers/NetworkRequestsHandler.js +37 -23
- package/models/trace/handlers/NetworkRequestsHandler.js.map +1 -1
- package/models/trace/handlers/ScriptsHandler.d.ts +5 -1
- package/models/trace/handlers/ScriptsHandler.js +59 -22
- package/models/trace/handlers/ScriptsHandler.js.map +1 -1
- package/models/trace/handlers/WarningsHandler.js +14 -2
- package/models/trace/handlers/WarningsHandler.js.map +1 -1
- package/models/trace/handlers/devtools_entrypoint-bundle-typescript-tsconfig.json +1 -1
- package/models/trace/handlers/handlers-tsconfig.json +1 -1
- package/models/trace/handlers/helpers.js +12 -0
- package/models/trace/handlers/helpers.js.map +1 -1
- package/models/trace/handlers/types.d.ts +2 -6
- package/models/trace/handlers/types.js.map +1 -1
- package/models/trace/helpers/devtools_entrypoint-bundle-typescript-tsconfig.json +1 -1
- package/models/trace/helpers/helpers-tsconfig.json +1 -1
- package/models/trace/insights/CLSCulprits.d.ts +6 -1
- package/models/trace/insights/CLSCulprits.js +11 -2
- package/models/trace/insights/CLSCulprits.js.map +1 -1
- package/models/trace/insights/Cache.d.ts +0 -1
- package/models/trace/insights/Cache.js +8 -7
- package/models/trace/insights/Cache.js.map +1 -1
- package/models/trace/insights/Common.js +6 -0
- package/models/trace/insights/Common.js.map +1 -1
- package/models/trace/insights/DocumentLatency.d.ts +7 -3
- package/models/trace/insights/DocumentLatency.js +25 -8
- package/models/trace/insights/DocumentLatency.js.map +1 -1
- package/models/trace/insights/DuplicatedJavaScript.js +9 -3
- package/models/trace/insights/DuplicatedJavaScript.js.map +1 -1
- package/models/trace/insights/ImageDelivery.d.ts +0 -1
- package/models/trace/insights/ImageDelivery.js +1 -1
- package/models/trace/insights/ImageDelivery.js.map +1 -1
- package/models/trace/insights/LCPPhases.d.ts +1 -1
- package/models/trace/insights/LCPPhases.js +1 -1
- package/models/trace/insights/LCPPhases.js.map +1 -1
- package/models/trace/insights/LegacyJavaScript.d.ts +1 -1
- package/models/trace/insights/LegacyJavaScript.js +6 -3
- package/models/trace/insights/LegacyJavaScript.js.map +1 -1
- package/models/trace/insights/NetworkDependencyTree.d.ts +151 -3
- package/models/trace/insights/NetworkDependencyTree.js +648 -10
- package/models/trace/insights/NetworkDependencyTree.js.map +1 -1
- package/models/trace/insights/RenderBlocking.js +1 -1
- package/models/trace/insights/RenderBlocking.js.map +1 -1
- package/models/trace/insights/ThirdParties.d.ts +1 -1
- package/models/trace/insights/ThirdParties.js +7 -7
- package/models/trace/insights/ThirdParties.js.map +1 -1
- package/models/trace/insights/devtools_entrypoint-bundle-typescript-tsconfig.json +1 -1
- package/models/trace/insights/insights-tsconfig.json +1 -1
- package/models/trace/insights/types.d.ts +11 -0
- package/models/trace/insights/types.js.map +1 -1
- package/models/trace/lantern/core/core-tsconfig.json +1 -1
- package/models/trace/lantern/core/devtools_entrypoint-bundle-typescript-tsconfig.json +1 -1
- package/models/trace/lantern/devtools_entrypoint-bundle-typescript-tsconfig.json +1 -1
- package/models/trace/lantern/graph/devtools_entrypoint-bundle-typescript-tsconfig.json +1 -1
- package/models/trace/lantern/graph/graph-tsconfig.json +1 -1
- package/models/trace/lantern/lantern-tsconfig.json +1 -1
- package/models/trace/lantern/metrics/devtools_entrypoint-bundle-typescript-tsconfig.json +1 -1
- package/models/trace/lantern/metrics/metrics-tsconfig.json +1 -1
- package/models/trace/lantern/simulation/devtools_entrypoint-bundle-typescript-tsconfig.json +1 -1
- package/models/trace/lantern/simulation/simulation-tsconfig.json +1 -1
- package/models/trace/lantern/types/Lantern.d.ts +4 -7
- package/models/trace/lantern/types/Lantern.js +1 -0
- package/models/trace/lantern/types/Lantern.js.map +1 -1
- package/models/trace/lantern/types/devtools_entrypoint-bundle-typescript-tsconfig.json +1 -1
- package/models/trace/lantern/types/types-tsconfig.json +1 -1
- package/models/trace/trace-tsconfig.json +1 -1
- package/models/trace/types/Configuration.d.ts +2 -0
- package/models/trace/types/Configuration.js.map +1 -1
- package/models/trace/types/Extensions.d.ts +1 -3
- package/models/trace/types/Extensions.js.map +1 -1
- package/models/trace/types/File.d.ts +2 -1
- package/models/trace/types/File.js.map +1 -1
- package/models/trace/types/TraceEvents.d.ts +51 -26
- package/models/trace/types/TraceEvents.js +6 -0
- package/models/trace/types/TraceEvents.js.map +1 -1
- package/models/trace/types/devtools_entrypoint-bundle-typescript-tsconfig.json +1 -1
- package/models/trace/types/types-tsconfig.json +1 -1
- package/package.json +1 -1
- package/test/test-trace-engine.mjs +2 -2
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"noImplicitOverride": true,
|
|
19
19
|
"noImplicitReturns": true,
|
|
20
20
|
"noUnusedLocals": false,
|
|
21
|
-
"noUnusedParameters":
|
|
21
|
+
"noUnusedParameters": false,
|
|
22
22
|
"outDir": ".",
|
|
23
23
|
"rootDir": "../../../../../../../front_end/models/trace/extras",
|
|
24
24
|
"skipLibCheck": true,
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"noImplicitOverride": true,
|
|
19
19
|
"noImplicitReturns": true,
|
|
20
20
|
"noUnusedLocals": false,
|
|
21
|
-
"noUnusedParameters":
|
|
21
|
+
"noUnusedParameters": false,
|
|
22
22
|
"outDir": ".",
|
|
23
23
|
"rootDir": "../../../../../../../front_end/models/trace/extras",
|
|
24
24
|
"skipLibCheck": true,
|
|
@@ -20,6 +20,7 @@ export * as StackTraceForEvent from './StackTraceForEvent.js';
|
|
|
20
20
|
// import 'es-iterator-helpers/Iterator.prototype.find/auto';
|
|
21
21
|
// import 'es-iterator-helpers/Iterator.prototype.flatMap/auto';
|
|
22
22
|
// import 'es-iterator-helpers/Iterator.prototype.map/auto';
|
|
23
|
+
// import 'es-iterator-helpers/Iterator.prototype.reduce/auto';
|
|
23
24
|
// import 'es-iterator-helpers/Iterator.prototype.toArray/auto';
|
|
24
25
|
|
|
25
26
|
"use strict";
|
|
@@ -3821,8 +3822,96 @@ export * as StackTraceForEvent from './StackTraceForEvent.js';
|
|
|
3821
3822
|
}
|
|
3822
3823
|
});
|
|
3823
3824
|
|
|
3824
|
-
// node_modules/es-iterator-helpers/Iterator.prototype.
|
|
3825
|
+
// node_modules/es-iterator-helpers/Iterator.prototype.reduce/implementation.js
|
|
3825
3826
|
var require_implementation7 = __commonJS({
|
|
3827
|
+
"node_modules/es-iterator-helpers/Iterator.prototype.reduce/implementation.js"(exports, module) {
|
|
3828
|
+
"use strict";
|
|
3829
|
+
var $TypeError = require_type();
|
|
3830
|
+
var Call = require_Call();
|
|
3831
|
+
var GetIteratorDirect = require_GetIteratorDirect();
|
|
3832
|
+
var IsCallable = require_IsCallable();
|
|
3833
|
+
var IteratorClose = require_IteratorClose();
|
|
3834
|
+
var IteratorStepValue = require_IteratorStepValue();
|
|
3835
|
+
var ThrowCompletion = require_ThrowCompletion();
|
|
3836
|
+
var Type = require_Type2();
|
|
3837
|
+
module.exports = function reduce(reducer) {
|
|
3838
|
+
if (this instanceof reduce) {
|
|
3839
|
+
throw new $TypeError("`reduce` is not a constructor");
|
|
3840
|
+
}
|
|
3841
|
+
var O = this;
|
|
3842
|
+
if (Type(O) !== "Object") {
|
|
3843
|
+
throw new $TypeError("`this` value must be an Object");
|
|
3844
|
+
}
|
|
3845
|
+
if (!IsCallable(reducer)) {
|
|
3846
|
+
throw new $TypeError("`reducer` must be a function");
|
|
3847
|
+
}
|
|
3848
|
+
var iterated = GetIteratorDirect(O);
|
|
3849
|
+
var accumulator;
|
|
3850
|
+
var counter;
|
|
3851
|
+
if (arguments.length < 2) {
|
|
3852
|
+
accumulator = IteratorStepValue(iterated);
|
|
3853
|
+
if (iterated["[[Done]]"]) {
|
|
3854
|
+
throw new $TypeError("Reduce of empty iterator with no initial value");
|
|
3855
|
+
}
|
|
3856
|
+
counter = 1;
|
|
3857
|
+
} else {
|
|
3858
|
+
accumulator = arguments[1];
|
|
3859
|
+
counter = 0;
|
|
3860
|
+
}
|
|
3861
|
+
while (true) {
|
|
3862
|
+
var value = IteratorStepValue(iterated);
|
|
3863
|
+
if (iterated["[[Done]]"]) {
|
|
3864
|
+
return accumulator;
|
|
3865
|
+
}
|
|
3866
|
+
try {
|
|
3867
|
+
var result = Call(reducer, void 0, [accumulator, value, counter]);
|
|
3868
|
+
accumulator = result;
|
|
3869
|
+
} catch (e) {
|
|
3870
|
+
IteratorClose(
|
|
3871
|
+
iterated,
|
|
3872
|
+
ThrowCompletion(e)
|
|
3873
|
+
);
|
|
3874
|
+
}
|
|
3875
|
+
counter += 1;
|
|
3876
|
+
}
|
|
3877
|
+
};
|
|
3878
|
+
}
|
|
3879
|
+
});
|
|
3880
|
+
|
|
3881
|
+
// node_modules/es-iterator-helpers/Iterator.prototype.reduce/polyfill.js
|
|
3882
|
+
var require_polyfill4 = __commonJS({
|
|
3883
|
+
"node_modules/es-iterator-helpers/Iterator.prototype.reduce/polyfill.js"(exports, module) {
|
|
3884
|
+
"use strict";
|
|
3885
|
+
var implementation = require_implementation7();
|
|
3886
|
+
module.exports = function getPolyfill() {
|
|
3887
|
+
return typeof Iterator === "function" && typeof Iterator.prototype.reduce === "function" ? Iterator.prototype.reduce : implementation;
|
|
3888
|
+
};
|
|
3889
|
+
}
|
|
3890
|
+
});
|
|
3891
|
+
|
|
3892
|
+
// node_modules/es-iterator-helpers/Iterator.prototype.reduce/shim.js
|
|
3893
|
+
var require_shim4 = __commonJS({
|
|
3894
|
+
"node_modules/es-iterator-helpers/Iterator.prototype.reduce/shim.js"(exports, module) {
|
|
3895
|
+
"use strict";
|
|
3896
|
+
var define = require_define_properties();
|
|
3897
|
+
var getPolyfill = require_polyfill4();
|
|
3898
|
+
var $IteratorPrototype = require_implementation4();
|
|
3899
|
+
module.exports = function shimIteratorPrototypeReduce() {
|
|
3900
|
+
var polyfill = getPolyfill();
|
|
3901
|
+
define(
|
|
3902
|
+
$IteratorPrototype,
|
|
3903
|
+
{ reduce: polyfill },
|
|
3904
|
+
{ reduce: function() {
|
|
3905
|
+
return $IteratorPrototype.reduce !== polyfill;
|
|
3906
|
+
} }
|
|
3907
|
+
);
|
|
3908
|
+
return polyfill;
|
|
3909
|
+
};
|
|
3910
|
+
}
|
|
3911
|
+
});
|
|
3912
|
+
|
|
3913
|
+
// node_modules/es-iterator-helpers/Iterator.prototype.toArray/implementation.js
|
|
3914
|
+
var require_implementation8 = __commonJS({
|
|
3826
3915
|
"node_modules/es-iterator-helpers/Iterator.prototype.toArray/implementation.js"(exports, module) {
|
|
3827
3916
|
"use strict";
|
|
3828
3917
|
var $TypeError = require_type();
|
|
@@ -3851,10 +3940,10 @@ export * as StackTraceForEvent from './StackTraceForEvent.js';
|
|
|
3851
3940
|
});
|
|
3852
3941
|
|
|
3853
3942
|
// node_modules/es-iterator-helpers/Iterator.prototype.toArray/polyfill.js
|
|
3854
|
-
var
|
|
3943
|
+
var require_polyfill5 = __commonJS({
|
|
3855
3944
|
"node_modules/es-iterator-helpers/Iterator.prototype.toArray/polyfill.js"(exports, module) {
|
|
3856
3945
|
"use strict";
|
|
3857
|
-
var implementation =
|
|
3946
|
+
var implementation = require_implementation8();
|
|
3858
3947
|
module.exports = function getPolyfill() {
|
|
3859
3948
|
return typeof Iterator === "function" && typeof Iterator.prototype.toArray === "function" ? Iterator.prototype.toArray : implementation;
|
|
3860
3949
|
};
|
|
@@ -3862,11 +3951,11 @@ export * as StackTraceForEvent from './StackTraceForEvent.js';
|
|
|
3862
3951
|
});
|
|
3863
3952
|
|
|
3864
3953
|
// node_modules/es-iterator-helpers/Iterator.prototype.toArray/shim.js
|
|
3865
|
-
var
|
|
3954
|
+
var require_shim5 = __commonJS({
|
|
3866
3955
|
"node_modules/es-iterator-helpers/Iterator.prototype.toArray/shim.js"(exports, module) {
|
|
3867
3956
|
"use strict";
|
|
3868
3957
|
var define = require_define_properties();
|
|
3869
|
-
var getPolyfill =
|
|
3958
|
+
var getPolyfill = require_polyfill5();
|
|
3870
3959
|
var $IteratorPrototype = require_implementation4();
|
|
3871
3960
|
module.exports = function shimIteratorPrototypeToArray() {
|
|
3872
3961
|
var polyfill = getPolyfill();
|
|
@@ -3891,6 +3980,9 @@ export * as StackTraceForEvent from './StackTraceForEvent.js';
|
|
|
3891
3980
|
// node_modules/es-iterator-helpers/Iterator.prototype.map/auto.js
|
|
3892
3981
|
require_shim3()();
|
|
3893
3982
|
|
|
3894
|
-
// node_modules/es-iterator-helpers/Iterator.prototype.
|
|
3983
|
+
// node_modules/es-iterator-helpers/Iterator.prototype.reduce/auto.js
|
|
3895
3984
|
require_shim4()();
|
|
3985
|
+
|
|
3986
|
+
// node_modules/es-iterator-helpers/Iterator.prototype.toArray/auto.js
|
|
3987
|
+
require_shim5()();
|
|
3896
3988
|
})();
|
|
@@ -20,6 +20,7 @@ export * as StackTraceForEvent from './StackTraceForEvent.js';
|
|
|
20
20
|
// import 'es-iterator-helpers/Iterator.prototype.find/auto';
|
|
21
21
|
// import 'es-iterator-helpers/Iterator.prototype.flatMap/auto';
|
|
22
22
|
// import 'es-iterator-helpers/Iterator.prototype.map/auto';
|
|
23
|
+
// import 'es-iterator-helpers/Iterator.prototype.reduce/auto';
|
|
23
24
|
// import 'es-iterator-helpers/Iterator.prototype.toArray/auto';
|
|
24
25
|
|
|
25
26
|
"use strict";
|
|
@@ -3821,8 +3822,96 @@ export * as StackTraceForEvent from './StackTraceForEvent.js';
|
|
|
3821
3822
|
}
|
|
3822
3823
|
});
|
|
3823
3824
|
|
|
3824
|
-
// node_modules/es-iterator-helpers/Iterator.prototype.
|
|
3825
|
+
// node_modules/es-iterator-helpers/Iterator.prototype.reduce/implementation.js
|
|
3825
3826
|
var require_implementation7 = __commonJS({
|
|
3827
|
+
"node_modules/es-iterator-helpers/Iterator.prototype.reduce/implementation.js"(exports, module) {
|
|
3828
|
+
"use strict";
|
|
3829
|
+
var $TypeError = require_type();
|
|
3830
|
+
var Call = require_Call();
|
|
3831
|
+
var GetIteratorDirect = require_GetIteratorDirect();
|
|
3832
|
+
var IsCallable = require_IsCallable();
|
|
3833
|
+
var IteratorClose = require_IteratorClose();
|
|
3834
|
+
var IteratorStepValue = require_IteratorStepValue();
|
|
3835
|
+
var ThrowCompletion = require_ThrowCompletion();
|
|
3836
|
+
var Type = require_Type2();
|
|
3837
|
+
module.exports = function reduce(reducer) {
|
|
3838
|
+
if (this instanceof reduce) {
|
|
3839
|
+
throw new $TypeError("`reduce` is not a constructor");
|
|
3840
|
+
}
|
|
3841
|
+
var O = this;
|
|
3842
|
+
if (Type(O) !== "Object") {
|
|
3843
|
+
throw new $TypeError("`this` value must be an Object");
|
|
3844
|
+
}
|
|
3845
|
+
if (!IsCallable(reducer)) {
|
|
3846
|
+
throw new $TypeError("`reducer` must be a function");
|
|
3847
|
+
}
|
|
3848
|
+
var iterated = GetIteratorDirect(O);
|
|
3849
|
+
var accumulator;
|
|
3850
|
+
var counter;
|
|
3851
|
+
if (arguments.length < 2) {
|
|
3852
|
+
accumulator = IteratorStepValue(iterated);
|
|
3853
|
+
if (iterated["[[Done]]"]) {
|
|
3854
|
+
throw new $TypeError("Reduce of empty iterator with no initial value");
|
|
3855
|
+
}
|
|
3856
|
+
counter = 1;
|
|
3857
|
+
} else {
|
|
3858
|
+
accumulator = arguments[1];
|
|
3859
|
+
counter = 0;
|
|
3860
|
+
}
|
|
3861
|
+
while (true) {
|
|
3862
|
+
var value = IteratorStepValue(iterated);
|
|
3863
|
+
if (iterated["[[Done]]"]) {
|
|
3864
|
+
return accumulator;
|
|
3865
|
+
}
|
|
3866
|
+
try {
|
|
3867
|
+
var result = Call(reducer, void 0, [accumulator, value, counter]);
|
|
3868
|
+
accumulator = result;
|
|
3869
|
+
} catch (e) {
|
|
3870
|
+
IteratorClose(
|
|
3871
|
+
iterated,
|
|
3872
|
+
ThrowCompletion(e)
|
|
3873
|
+
);
|
|
3874
|
+
}
|
|
3875
|
+
counter += 1;
|
|
3876
|
+
}
|
|
3877
|
+
};
|
|
3878
|
+
}
|
|
3879
|
+
});
|
|
3880
|
+
|
|
3881
|
+
// node_modules/es-iterator-helpers/Iterator.prototype.reduce/polyfill.js
|
|
3882
|
+
var require_polyfill4 = __commonJS({
|
|
3883
|
+
"node_modules/es-iterator-helpers/Iterator.prototype.reduce/polyfill.js"(exports, module) {
|
|
3884
|
+
"use strict";
|
|
3885
|
+
var implementation = require_implementation7();
|
|
3886
|
+
module.exports = function getPolyfill() {
|
|
3887
|
+
return typeof Iterator === "function" && typeof Iterator.prototype.reduce === "function" ? Iterator.prototype.reduce : implementation;
|
|
3888
|
+
};
|
|
3889
|
+
}
|
|
3890
|
+
});
|
|
3891
|
+
|
|
3892
|
+
// node_modules/es-iterator-helpers/Iterator.prototype.reduce/shim.js
|
|
3893
|
+
var require_shim4 = __commonJS({
|
|
3894
|
+
"node_modules/es-iterator-helpers/Iterator.prototype.reduce/shim.js"(exports, module) {
|
|
3895
|
+
"use strict";
|
|
3896
|
+
var define = require_define_properties();
|
|
3897
|
+
var getPolyfill = require_polyfill4();
|
|
3898
|
+
var $IteratorPrototype = require_implementation4();
|
|
3899
|
+
module.exports = function shimIteratorPrototypeReduce() {
|
|
3900
|
+
var polyfill = getPolyfill();
|
|
3901
|
+
define(
|
|
3902
|
+
$IteratorPrototype,
|
|
3903
|
+
{ reduce: polyfill },
|
|
3904
|
+
{ reduce: function() {
|
|
3905
|
+
return $IteratorPrototype.reduce !== polyfill;
|
|
3906
|
+
} }
|
|
3907
|
+
);
|
|
3908
|
+
return polyfill;
|
|
3909
|
+
};
|
|
3910
|
+
}
|
|
3911
|
+
});
|
|
3912
|
+
|
|
3913
|
+
// node_modules/es-iterator-helpers/Iterator.prototype.toArray/implementation.js
|
|
3914
|
+
var require_implementation8 = __commonJS({
|
|
3826
3915
|
"node_modules/es-iterator-helpers/Iterator.prototype.toArray/implementation.js"(exports, module) {
|
|
3827
3916
|
"use strict";
|
|
3828
3917
|
var $TypeError = require_type();
|
|
@@ -3851,10 +3940,10 @@ export * as StackTraceForEvent from './StackTraceForEvent.js';
|
|
|
3851
3940
|
});
|
|
3852
3941
|
|
|
3853
3942
|
// node_modules/es-iterator-helpers/Iterator.prototype.toArray/polyfill.js
|
|
3854
|
-
var
|
|
3943
|
+
var require_polyfill5 = __commonJS({
|
|
3855
3944
|
"node_modules/es-iterator-helpers/Iterator.prototype.toArray/polyfill.js"(exports, module) {
|
|
3856
3945
|
"use strict";
|
|
3857
|
-
var implementation =
|
|
3946
|
+
var implementation = require_implementation8();
|
|
3858
3947
|
module.exports = function getPolyfill() {
|
|
3859
3948
|
return typeof Iterator === "function" && typeof Iterator.prototype.toArray === "function" ? Iterator.prototype.toArray : implementation;
|
|
3860
3949
|
};
|
|
@@ -3862,11 +3951,11 @@ export * as StackTraceForEvent from './StackTraceForEvent.js';
|
|
|
3862
3951
|
});
|
|
3863
3952
|
|
|
3864
3953
|
// node_modules/es-iterator-helpers/Iterator.prototype.toArray/shim.js
|
|
3865
|
-
var
|
|
3954
|
+
var require_shim5 = __commonJS({
|
|
3866
3955
|
"node_modules/es-iterator-helpers/Iterator.prototype.toArray/shim.js"(exports, module) {
|
|
3867
3956
|
"use strict";
|
|
3868
3957
|
var define = require_define_properties();
|
|
3869
|
-
var getPolyfill =
|
|
3958
|
+
var getPolyfill = require_polyfill5();
|
|
3870
3959
|
var $IteratorPrototype = require_implementation4();
|
|
3871
3960
|
module.exports = function shimIteratorPrototypeToArray() {
|
|
3872
3961
|
var polyfill = getPolyfill();
|
|
@@ -3891,6 +3980,9 @@ export * as StackTraceForEvent from './StackTraceForEvent.js';
|
|
|
3891
3980
|
// node_modules/es-iterator-helpers/Iterator.prototype.map/auto.js
|
|
3892
3981
|
require_shim3()();
|
|
3893
3982
|
|
|
3894
|
-
// node_modules/es-iterator-helpers/Iterator.prototype.
|
|
3983
|
+
// node_modules/es-iterator-helpers/Iterator.prototype.reduce/auto.js
|
|
3895
3984
|
require_shim4()();
|
|
3985
|
+
|
|
3986
|
+
// node_modules/es-iterator-helpers/Iterator.prototype.toArray/auto.js
|
|
3987
|
+
require_shim5()();
|
|
3896
3988
|
})();
|
|
@@ -4,12 +4,17 @@ declare const asyncCallToScheduler: Map<Types.Events.SyntheticProfileCall, {
|
|
|
4
4
|
taskName: string;
|
|
5
5
|
scheduler: Types.Events.Event;
|
|
6
6
|
}>;
|
|
7
|
+
declare const runEntryPointToScheduler: Map<Types.Events.Event, {
|
|
8
|
+
taskName: string;
|
|
9
|
+
scheduler: Types.Events.Event;
|
|
10
|
+
}>;
|
|
7
11
|
export declare function reset(): void;
|
|
8
12
|
export declare function handleEvent(_: Types.Events.Event): void;
|
|
9
13
|
export declare function finalize(): Promise<void>;
|
|
10
14
|
export declare function data(): {
|
|
11
15
|
schedulerToRunEntryPoints: typeof schedulerToRunEntryPoints;
|
|
12
16
|
asyncCallToScheduler: typeof asyncCallToScheduler;
|
|
17
|
+
runEntryPointToScheduler: typeof runEntryPointToScheduler;
|
|
13
18
|
};
|
|
14
19
|
export declare function deps(): ['Renderer', 'Flows'];
|
|
15
20
|
export {};
|
|
@@ -8,10 +8,12 @@ import { data as rendererHandlerData } from './RendererHandler.js';
|
|
|
8
8
|
const schedulerToRunEntryPoints = new Map();
|
|
9
9
|
const taskScheduleForTaskRunEvent = new Map();
|
|
10
10
|
const asyncCallToScheduler = new Map();
|
|
11
|
+
const runEntryPointToScheduler = new Map();
|
|
11
12
|
export function reset() {
|
|
12
13
|
schedulerToRunEntryPoints.clear();
|
|
13
14
|
asyncCallToScheduler.clear();
|
|
14
15
|
taskScheduleForTaskRunEvent.clear();
|
|
16
|
+
runEntryPointToScheduler.clear();
|
|
15
17
|
}
|
|
16
18
|
export function handleEvent(_) {
|
|
17
19
|
}
|
|
@@ -61,21 +63,21 @@ export async function finalize() {
|
|
|
61
63
|
taskScheduleForTaskRunEvent.set(asyncTaskRun, maybeAsyncTaskScheduled);
|
|
62
64
|
// Get the JS call scheduled the task.
|
|
63
65
|
const asyncCaller = findNearestJSAncestor(maybeAsyncTaskScheduled, entryToNode);
|
|
64
|
-
|
|
65
|
-
// Unexpected async call trace data shape, ignore.
|
|
66
|
-
continue;
|
|
67
|
-
}
|
|
66
|
+
// Get the trace entrypoint for the scheduled task (e.g. FunctionCall, etc.).
|
|
68
67
|
const asyncEntryPoint = findFirstJsInvocationForAsyncTaskRun(asyncTaskRun, entryToNode);
|
|
69
|
-
|
|
68
|
+
// Store the async relationship between traces to be shown with initiator arrows.
|
|
69
|
+
// Default to the AsyncTask events in case the JS entrypoints aren't found.
|
|
70
|
+
runEntryPointToScheduler.set(asyncEntryPoint || asyncTaskRun, { taskName, scheduler: asyncCaller || maybeAsyncTaskScheduled });
|
|
71
|
+
if (!asyncCaller || !asyncEntryPoint) {
|
|
70
72
|
// Unexpected async call trace data shape, ignore.
|
|
71
73
|
continue;
|
|
72
74
|
}
|
|
73
|
-
// Set scheduler ->
|
|
74
|
-
// The
|
|
75
|
+
// Set scheduler -> scheduled mapping.
|
|
76
|
+
// The scheduled being the JS entrypoint
|
|
75
77
|
const entryPoints = Platform.MapUtilities.getWithDefault(schedulerToRunEntryPoints, asyncCaller, () => []);
|
|
76
78
|
entryPoints.push(asyncEntryPoint);
|
|
77
|
-
// Set
|
|
78
|
-
// The
|
|
79
|
+
// Set scheduled -> scheduler mapping.
|
|
80
|
+
// The scheduled being the JS calls (instead of the entrypoints as
|
|
79
81
|
// above, for usage ergonomics).
|
|
80
82
|
const scheduledProfileCalls = findFirstJSCallsForAsyncTaskRun(asyncTaskRun, entryToNode);
|
|
81
83
|
for (const call of scheduledProfileCalls) {
|
|
@@ -177,6 +179,7 @@ export function data() {
|
|
|
177
179
|
return {
|
|
178
180
|
schedulerToRunEntryPoints,
|
|
179
181
|
asyncCallToScheduler,
|
|
182
|
+
runEntryPointToScheduler,
|
|
180
183
|
};
|
|
181
184
|
}
|
|
182
185
|
export function deps() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AsyncJSCallsHandler.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/handlers/AsyncJSCallsHandler.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAC7B,OAAO,KAAK,QAAQ,MAAM,oCAAoC,CAAC;AAE/D,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAC,IAAI,IAAI,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAC,IAAI,IAAI,mBAAmB,EAAC,MAAM,sBAAsB,CAAC;AAEjE,MAAM,yBAAyB,GAAG,IAAI,GAAG,EAA4C,CAAC;AAEtF,MAAM,2BAA2B,GAC7B,IAAI,GAAG,EAA8E,CAAC;AAC1F,MAAM,oBAAoB,GACtB,IAAI,GAAG,EAAwF,CAAC;AAEpG,MAAM,UAAU,KAAK;IACnB,yBAAyB,CAAC,KAAK,EAAE,CAAC;IAClC,oBAAoB,CAAC,KAAK,EAAE,CAAC;IAC7B,2BAA2B,CAAC,KAAK,EAAE,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,CAAqB;AACjD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,QAAQ;IAC5B,MAAM,EAAC,KAAK,EAAC,GAAG,gBAAgB,EAAE,CAAC;IACnC,MAAM,EAAC,WAAW,EAAC,GAAG,mBAAmB,EAAE,CAAC;IAC5C,2BAA2B;IAC3B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,uBAAuB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AC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACzC,MAAM,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;YACzB,IAAI,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;gBAChC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACpC,CAAC;iBAAM,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;gBACxC,cAAc,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;YAC1C,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,IAAI;IAWlB,OAAO;QACL,yBAAyB;QACzB,oBAAoB;KACrB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,IAAI;IAClB,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AAC/B,CAAC","sourcesContent":["// Copyright 2024 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\nimport * as Platform from '../../../core/platform/platform.js';\nimport type * as Helpers from '../helpers/helpers.js';\nimport * as Types from '../types/types.js';\n\nimport {data as flowsHandlerData} from './FlowsHandler.js';\nimport {data as rendererHandlerData} from './RendererHandler.js';\n\nconst schedulerToRunEntryPoints = new Map<Types.Events.Event, Types.Events.Event[]>();\n\nconst taskScheduleForTaskRunEvent =\n new Map<Types.Events.DebuggerAsyncTaskRun, Types.Events.DebuggerAsyncTaskScheduled>();\nconst asyncCallToScheduler =\n new Map<Types.Events.SyntheticProfileCall, {taskName: string, scheduler: Types.Events.Event}>();\n\nexport function reset(): void {\n schedulerToRunEntryPoints.clear();\n asyncCallToScheduler.clear();\n taskScheduleForTaskRunEvent.clear();\n}\n\nexport function handleEvent(_: Types.Events.Event): void {\n}\n\nexport async function finalize(): Promise<void> {\n const {flows} = flowsHandlerData();\n const {entryToNode} = rendererHandlerData();\n // Process async task flows\n for (const flow of flows) {\n let maybeAsyncTaskScheduled = flow.at(0);\n if (!maybeAsyncTaskScheduled) {\n continue;\n }\n if (Types.Events.isDebuggerAsyncTaskRun(maybeAsyncTaskScheduled)) {\n // Sometimes a AsyncTaskRun event run can incorrectly appear as\n // initiated by another AsyncTaskRun from Perfetto's flows\n // perspective.\n // For example, in this snippet:\n //\n // const myTask = console.createTask('hola'); // creates an AsyncTaskSchedule\n // myTask.run(something); // creates an AsyncTaskRun\n // myTask.run(somethingElse); // creates an AsyncTaskRun\n //\n // or also in this one\n //\n // setInterval(something); // creates multiple connected AsyncTaskRun.\n //\n // Because the flow id is created based on the task's memory address,\n // the three events will end up belonging to the same flow (even if\n // in the frontend we receive it as pairs), and elements in a flow\n // are connected to their immediately consecutive neighbor.\n //\n // To ensure we use the right Schedule event, if the \"initiating\"\n // portion of the flow is a Run event, we look for any corresponding\n // Schedule event that we might have found before.\n maybeAsyncTaskScheduled = taskScheduleForTaskRunEvent.get(maybeAsyncTaskScheduled);\n }\n if (!maybeAsyncTaskScheduled || !Types.Events.isDebuggerAsyncTaskScheduled(maybeAsyncTaskScheduled)) {\n continue;\n }\n const taskName = maybeAsyncTaskScheduled.args.taskName;\n const asyncTaskRun = flow.at(1);\n if (!asyncTaskRun || !Types.Events.isDebuggerAsyncTaskRun(asyncTaskRun)) {\n // Unexpected flow shape, ignore.\n continue;\n }\n // Cache the Schedule event for this Run for future reference.\n taskScheduleForTaskRunEvent.set(asyncTaskRun, maybeAsyncTaskScheduled);\n\n // Get the JS call scheduled the task.\n const asyncCaller = findNearestJSAncestor(maybeAsyncTaskScheduled, entryToNode);\n if (!asyncCaller) {\n // Unexpected async call trace data shape, ignore.\n continue;\n }\n const asyncEntryPoint = findFirstJsInvocationForAsyncTaskRun(asyncTaskRun, entryToNode);\n if (!asyncEntryPoint) {\n // Unexpected async call trace data shape, ignore.\n continue;\n }\n // Set scheduler -> schedulee mapping.\n // The schedulee being the JS entrypoint\n const entryPoints = Platform.MapUtilities.getWithDefault(schedulerToRunEntryPoints, asyncCaller, () => []);\n entryPoints.push(asyncEntryPoint);\n\n // Set schedulee -> scheduler mapping.\n // The schedulees being the JS calls (instead of the entrypoints as\n // above, for usage ergonomics).\n const scheduledProfileCalls = findFirstJSCallsForAsyncTaskRun(asyncTaskRun, entryToNode);\n for (const call of scheduledProfileCalls) {\n asyncCallToScheduler.set(call, {taskName, scheduler: asyncCaller});\n }\n }\n}\n/**\n * Given a DebuggerAsyncTaskScheduled event, returns its closest\n * ProfileCall or JS invocation ancestor, which represents the JS call\n * that scheduled the async task.\n */\nfunction findNearestJSAncestor(\n asyncTaskScheduled: Types.Events.DebuggerAsyncTaskScheduled,\n entryToNode: Map<Types.Events.Event, Helpers.TreeHelpers.TraceEntryNode>): Types.Events.Event|null {\n let node = entryToNode.get(asyncTaskScheduled)?.parent;\n while (node) {\n if (Types.Events.isProfileCall(node.entry) || acceptJSInvocationsPredicate(node.entry)) {\n return node.entry;\n }\n node = node.parent;\n }\n return null;\n}\n/**\n * Entrypoints to JS execution in the timeline. We ignore those starting\n * with 'v8' because they aren't shown in the timeline, and ultimately\n * this function's output results in \"initiated\" events, so ideally this\n * returns events that end up in the flame chart.\n */\nfunction acceptJSInvocationsPredicate(event: Types.Events.Event): event is Types.Events.Event {\n const eventIsConsoleRunTask = Types.Events.isConsoleRunTask(event);\n const eventIsV8EntryPoint = event.name.startsWith('v8') || event.name.startsWith('V8');\n return Types.Events.isJSInvocationEvent(event) && (eventIsConsoleRunTask || !eventIsV8EntryPoint);\n}\n\n/**\n * Given a DebuggerAsyncTaskRun event, returns its closest JS entry\n * point descendant, which contains the task being scheduled.\n */\nfunction findFirstJsInvocationForAsyncTaskRun(\n asyncTaskRun: Types.Events.DebuggerAsyncTaskRun,\n entryToNode: Map<Types.Events.Event, Helpers.TreeHelpers.TraceEntryNode>): Types.Events.Event|undefined {\n // Ignore descendants of other DebuggerAsyncTaskRuns since they\n // are part of another async task and have to be handled separately\n return findFirstDescendantsOfType(\n asyncTaskRun, entryToNode, acceptJSInvocationsPredicate, Types.Events.isDebuggerAsyncTaskRun)\n .at(0);\n}\n\n/**\n * Given an async task run event, returns the top level call frames\n * (profile calls) directly called by the async task. This implies that\n * any profile calls under another async task run event are ignored.\n * These profile calls represent the JS task being scheduled, AKA\n * the other part of the async stack.\n *\n * For example, here the profile calls \"js 1\", \"js 2\" and \"js 4\" would\n * be returned:\n *\n * |------------------Async Task Run------------------|\n * |--FunctionCall--| |--FunctionCall--|\n * |-js 1-||-js 2-| |-js 4-|\n * |-js 3-|\n *\n * But here, only \"js 1\" and \"js 2\" would be returned:\n *\n * |------------------Async Task Run------------------|\n * |--FunctionCall--| |------------------------|\n * |-js 1-||-js 2-| |---Async Task Run--|\n * |-js 3-| |--FunctionCall--|\n * |-js 4-|\n */\nfunction findFirstJSCallsForAsyncTaskRun(\n asyncTaskRun: Types.Events.DebuggerAsyncTaskRun,\n entryToNode: Map<Types.Events.Event, Helpers.TreeHelpers.TraceEntryNode>): Types.Events.SyntheticProfileCall[] {\n // Ignore descendants of other DebuggerAsyncTaskRuns since they\n // are part of another async task and have to be handled separately\n return findFirstDescendantsOfType(\n asyncTaskRun, entryToNode, Types.Events.isProfileCall, Types.Events.isDebuggerAsyncTaskRun);\n}\n\n/**\n * Given a root event returns all the first descendants that meet a\n * predicate condition (predicateAccept) while ignoring subtrees whose\n * top event meets an ignore condition (predicateIgnore).\n */\nfunction findFirstDescendantsOfType<T extends Types.Events.Event>(\n root: Types.Events.Event, entryToNode: Map<Types.Events.Event, Helpers.TreeHelpers.TraceEntryNode>,\n predicateAccept: (event: Types.Events.Event) => event is T,\n predicateIgnore: (event: Types.Events.Event) => boolean): T[] {\n const node = entryToNode.get(root);\n if (!node) {\n return [];\n }\n const childrenGroups = [[...node.children]];\n const firstDescendants = [];\n for (let i = 0; i < childrenGroups.length; i++) {\n const siblings = childrenGroups[i];\n for (let j = 0; j < siblings.length; j++) {\n const node = siblings[j];\n if (predicateAccept(node.entry)) {\n firstDescendants.push(node.entry);\n } else if (!predicateIgnore(node.entry)) {\n childrenGroups.push([...node.children]);\n }\n }\n }\n return firstDescendants;\n}\n\nexport function data(): {\n // Given a profile call, returns the JS entrypoint it scheduled (if any).\n // For example, given a setTimeout call, returns the JS entry point\n // trace event for the timeout callback run event (usually a\n // FunctionCall event).\n schedulerToRunEntryPoints: typeof schedulerToRunEntryPoints,\n // Given a profile call, returns the profile call that scheduled it.\n // For example given a timeout callback run event, returns its\n // setTimeout call event.\n asyncCallToScheduler: typeof asyncCallToScheduler,\n} {\n return {\n schedulerToRunEntryPoints,\n asyncCallToScheduler,\n };\n}\n\nexport function deps(): ['Renderer', 'Flows'] {\n return ['Renderer', 'Flows'];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"AsyncJSCallsHandler.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/handlers/AsyncJSCallsHandler.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAC7B,OAAO,KAAK,QAAQ,MAAM,oCAAoC,CAAC;AAE/D,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAC,IAAI,IAAI,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAC,IAAI,IAAI,mBAAmB,EAAC,MAAM,sBAAsB,CAAC;AAEjE,MAAM,yBAAyB,GAAG,IAAI,GAAG,EAA4C,CAAC;AAEtF,MAAM,2BAA2B,GAC7B,IAAI,GAAG,EAA8E,CAAC;AAC1F,MAAM,oBAAoB,GACtB,IAAI,GAAG,EAAwF,CAAC;AAEpG,MAAM,wBAAwB,GAAG,IAAI,GAAG,EAAyE,CAAC;AAElH,MAAM,UAAU,KAAK;IACnB,yBAAyB,CAAC,KAAK,EAAE,CAAC;IAClC,oBAAoB,CAAC,KAAK,EAAE,CAAC;IAC7B,2BAA2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wE,EAClG,eAA0D,EAC1D,eAAuD;IACzD,MAAM,IAAI,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACnC,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,cAAc,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC5C,MAAM,gBAAgB,GAAG,EAAE,CAAC;IAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC/C,MAAM,QAAQ,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;QACnC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACzC,MAAM,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;YACzB,IAAI,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;gBAChC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACpC,CAAC;iBAAM,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;gBACxC,cAAc,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;YAC1C,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,IAAI;IAwBlB,OAAO;QACL,yBAAyB;QACzB,oBAAoB;QACpB,wBAAwB;KACzB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,IAAI;IAClB,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AAC/B,CAAC","sourcesContent":["// Copyright 2024 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\nimport * as Platform from '../../../core/platform/platform.js';\nimport type * as Helpers from '../helpers/helpers.js';\nimport * as Types from '../types/types.js';\n\nimport {data as flowsHandlerData} from './FlowsHandler.js';\nimport {data as rendererHandlerData} from './RendererHandler.js';\n\nconst schedulerToRunEntryPoints = new Map<Types.Events.Event, Types.Events.Event[]>();\n\nconst taskScheduleForTaskRunEvent =\n new Map<Types.Events.DebuggerAsyncTaskRun, Types.Events.DebuggerAsyncTaskScheduled>();\nconst asyncCallToScheduler =\n new Map<Types.Events.SyntheticProfileCall, {taskName: string, scheduler: Types.Events.Event}>();\n\nconst runEntryPointToScheduler = new Map<Types.Events.Event, {taskName: string, scheduler: Types.Events.Event}>();\n\nexport function reset(): void {\n schedulerToRunEntryPoints.clear();\n asyncCallToScheduler.clear();\n taskScheduleForTaskRunEvent.clear();\n runEntryPointToScheduler.clear();\n}\n\nexport function handleEvent(_: Types.Events.Event): void {\n}\n\nexport async function finalize(): Promise<void> {\n const {flows} = flowsHandlerData();\n const {entryToNode} = rendererHandlerData();\n // Process async task flows\n for (const flow of flows) {\n let maybeAsyncTaskScheduled = flow.at(0);\n if (!maybeAsyncTaskScheduled) {\n continue;\n }\n if (Types.Events.isDebuggerAsyncTaskRun(maybeAsyncTaskScheduled)) {\n // Sometimes a AsyncTaskRun event run can incorrectly appear as\n // initiated by another AsyncTaskRun from Perfetto's flows\n // perspective.\n // For example, in this snippet:\n //\n // const myTask = console.createTask('hola'); // creates an AsyncTaskSchedule\n // myTask.run(something); // creates an AsyncTaskRun\n // myTask.run(somethingElse); // creates an AsyncTaskRun\n //\n // or also in this one\n //\n // setInterval(something); // creates multiple connected AsyncTaskRun.\n //\n // Because the flow id is created based on the task's memory address,\n // the three events will end up belonging to the same flow (even if\n // in the frontend we receive it as pairs), and elements in a flow\n // are connected to their immediately consecutive neighbor.\n //\n // To ensure we use the right Schedule event, if the \"initiating\"\n // portion of the flow is a Run event, we look for any corresponding\n // Schedule event that we might have found before.\n maybeAsyncTaskScheduled = taskScheduleForTaskRunEvent.get(maybeAsyncTaskScheduled);\n }\n if (!maybeAsyncTaskScheduled || !Types.Events.isDebuggerAsyncTaskScheduled(maybeAsyncTaskScheduled)) {\n continue;\n }\n const taskName = maybeAsyncTaskScheduled.args.taskName;\n const asyncTaskRun = flow.at(1);\n if (!asyncTaskRun || !Types.Events.isDebuggerAsyncTaskRun(asyncTaskRun)) {\n // Unexpected flow shape, ignore.\n continue;\n }\n // Cache the Schedule event for this Run for future reference.\n taskScheduleForTaskRunEvent.set(asyncTaskRun, maybeAsyncTaskScheduled);\n\n // Get the JS call scheduled the task.\n const asyncCaller = findNearestJSAncestor(maybeAsyncTaskScheduled, entryToNode);\n\n // Get the trace entrypoint for the scheduled task (e.g. FunctionCall, etc.).\n const asyncEntryPoint = findFirstJsInvocationForAsyncTaskRun(asyncTaskRun, entryToNode);\n\n // Store the async relationship between traces to be shown with initiator arrows.\n // Default to the AsyncTask events in case the JS entrypoints aren't found.\n runEntryPointToScheduler.set(\n asyncEntryPoint || asyncTaskRun, {taskName, scheduler: asyncCaller || maybeAsyncTaskScheduled});\n if (!asyncCaller || !asyncEntryPoint) {\n // Unexpected async call trace data shape, ignore.\n continue;\n }\n // Set scheduler -> scheduled mapping.\n // The scheduled being the JS entrypoint\n const entryPoints = Platform.MapUtilities.getWithDefault(schedulerToRunEntryPoints, asyncCaller, () => []);\n entryPoints.push(asyncEntryPoint);\n\n // Set scheduled -> scheduler mapping.\n // The scheduled being the JS calls (instead of the entrypoints as\n // above, for usage ergonomics).\n const scheduledProfileCalls = findFirstJSCallsForAsyncTaskRun(asyncTaskRun, entryToNode);\n for (const call of scheduledProfileCalls) {\n asyncCallToScheduler.set(call, {taskName, scheduler: asyncCaller});\n }\n }\n}\n/**\n * Given a DebuggerAsyncTaskScheduled event, returns its closest\n * ProfileCall or JS invocation ancestor, which represents the JS call\n * that scheduled the async task.\n */\nfunction findNearestJSAncestor(\n asyncTaskScheduled: Types.Events.DebuggerAsyncTaskScheduled,\n entryToNode: Map<Types.Events.Event, Helpers.TreeHelpers.TraceEntryNode>): Types.Events.Event|null {\n let node = entryToNode.get(asyncTaskScheduled)?.parent;\n while (node) {\n if (Types.Events.isProfileCall(node.entry) || acceptJSInvocationsPredicate(node.entry)) {\n return node.entry;\n }\n node = node.parent;\n }\n return null;\n}\n/**\n * Entrypoints to JS execution in the timeline. We ignore those starting\n * with 'v8' because they aren't shown in the timeline, and ultimately\n * this function's output results in \"initiated\" events, so ideally this\n * returns events that end up in the flame chart.\n */\nfunction acceptJSInvocationsPredicate(event: Types.Events.Event): event is Types.Events.Event {\n const eventIsConsoleRunTask = Types.Events.isConsoleRunTask(event);\n const eventIsV8EntryPoint = event.name.startsWith('v8') || event.name.startsWith('V8');\n return Types.Events.isJSInvocationEvent(event) && (eventIsConsoleRunTask || !eventIsV8EntryPoint);\n}\n\n/**\n * Given a DebuggerAsyncTaskRun event, returns its closest JS entry\n * point descendant, which contains the task being scheduled.\n */\nfunction findFirstJsInvocationForAsyncTaskRun(\n asyncTaskRun: Types.Events.DebuggerAsyncTaskRun,\n entryToNode: Map<Types.Events.Event, Helpers.TreeHelpers.TraceEntryNode>): Types.Events.Event|undefined {\n // Ignore descendants of other DebuggerAsyncTaskRuns since they\n // are part of another async task and have to be handled separately\n return findFirstDescendantsOfType(\n asyncTaskRun, entryToNode, acceptJSInvocationsPredicate, Types.Events.isDebuggerAsyncTaskRun)\n .at(0);\n}\n\n/**\n * Given an async task run event, returns the top level call frames\n * (profile calls) directly called by the async task. This implies that\n * any profile calls under another async task run event are ignored.\n * These profile calls represent the JS task being scheduled, AKA\n * the other part of the async stack.\n *\n * For example, here the profile calls \"js 1\", \"js 2\" and \"js 4\" would\n * be returned:\n *\n * |------------------Async Task Run------------------|\n * |--FunctionCall--| |--FunctionCall--|\n * |-js 1-||-js 2-| |-js 4-|\n * |-js 3-|\n *\n * But here, only \"js 1\" and \"js 2\" would be returned:\n *\n * |------------------Async Task Run------------------|\n * |--FunctionCall--| |------------------------|\n * |-js 1-||-js 2-| |---Async Task Run--|\n * |-js 3-| |--FunctionCall--|\n * |-js 4-|\n */\nfunction findFirstJSCallsForAsyncTaskRun(\n asyncTaskRun: Types.Events.DebuggerAsyncTaskRun,\n entryToNode: Map<Types.Events.Event, Helpers.TreeHelpers.TraceEntryNode>): Types.Events.SyntheticProfileCall[] {\n // Ignore descendants of other DebuggerAsyncTaskRuns since they\n // are part of another async task and have to be handled separately\n return findFirstDescendantsOfType(\n asyncTaskRun, entryToNode, Types.Events.isProfileCall, Types.Events.isDebuggerAsyncTaskRun);\n}\n\n/**\n * Given a root event returns all the first descendants that meet a\n * predicate condition (predicateAccept) while ignoring subtrees whose\n * top event meets an ignore condition (predicateIgnore).\n */\nfunction findFirstDescendantsOfType<T extends Types.Events.Event>(\n root: Types.Events.Event, entryToNode: Map<Types.Events.Event, Helpers.TreeHelpers.TraceEntryNode>,\n predicateAccept: (event: Types.Events.Event) => event is T,\n predicateIgnore: (event: Types.Events.Event) => boolean): T[] {\n const node = entryToNode.get(root);\n if (!node) {\n return [];\n }\n const childrenGroups = [[...node.children]];\n const firstDescendants = [];\n for (let i = 0; i < childrenGroups.length; i++) {\n const siblings = childrenGroups[i];\n for (let j = 0; j < siblings.length; j++) {\n const node = siblings[j];\n if (predicateAccept(node.entry)) {\n firstDescendants.push(node.entry);\n } else if (!predicateIgnore(node.entry)) {\n childrenGroups.push([...node.children]);\n }\n }\n }\n return firstDescendants;\n}\n\nexport function data(): {\n // Given a profile call, returns the JS entrypoint it scheduled (if any).\n // For example, given a setTimeout call, returns the JS entry point\n // trace event for the timeout callback run event (usually a\n // FunctionCall event).\n schedulerToRunEntryPoints: typeof schedulerToRunEntryPoints,\n // Given a profile call, returns the profile call that scheduled it.\n // For example given a timeout callback run event, returns its\n // setTimeout call event.\n asyncCallToScheduler: typeof asyncCallToScheduler,\n // Given a trace event, returns its corresponding async parent trace\n // event caused by an async js call. This can be used as a fallback\n // for cases where a corresponding JS call is not found at either\n // end of the async task scheduling pair (e.g. due to sampling data\n // incompleteness).\n // In the StackTraceForEvent helper, as we move up the call tree,\n // this is used to jump to an async parent stack from a\n // non-profile call trace event in cases where a profile call wasn't\n // found before. In theory we should make the jump from the scheduled\n // profile call using `asyncCallToScheduler`, but its possible that\n // the the call information isn't available to us as a consequence of\n // missing samples.\n runEntryPointToScheduler: typeof runEntryPointToScheduler,\n} {\n return {\n schedulerToRunEntryPoints,\n asyncCallToScheduler,\n runEntryPointToScheduler,\n };\n}\n\nexport function deps(): ['Renderer', 'Flows'] {\n return ['Renderer', 'Flows'];\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FramesHandler.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/handlers/FramesHandler.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,QAAQ,MAAM,oCAAoC,CAAC;AAC/D,OAAO,KAAK,OAAO,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAA2B,IAAI,IAAI,mBAAmB,EAAC,MAAM,6BAA6B,CAAC;AAClG,OAAO,EAAC,IAAI,IAAI,oBAAoB,EAAqB,MAAM,uBAAuB,CAAC;AACvF,OAAO,EAAC,IAAI,IAAI,eAAe,EAAuB,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAC,IAAI,IAAI,mBAAmB,EAA2B,MAAM,sBAAsB,CAAC;AAC3F,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AAGxC;;;;;;;;;GASG;AAEH,MAAM,SAAS,GAAyB,EAAE,CAAC;AAC3C,IAAI,KAAK,GAA4B,IAAI,CAAC;AAE1C,MAAM,UAAU,KAAK;IACnB,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAyB;IACnD,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAA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AAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;IACrH,MAAM,SAAS,GACX,QAAQ,CAAC,cAAc,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,IAAI,QAAQ,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC;IAC7G,OAAO,MAAM,CAAC,KAAK,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;AAC7C,CAAC","sourcesContent":["// Copyright 2023 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport * as Platform from '../../../core/platform/platform.js';\nimport * as Helpers from '../helpers/helpers.js';\nimport * as Types from '../types/types.js';\n\nimport {type AuctionWorkletsData, data as auctionWorkletsData} from './AuctionWorkletsHandler.js';\nimport {data as layerTreeHandlerData, type LayerTreeData} from './LayerTreeHandler.js';\nimport {data as metaHandlerData, type MetaHandlerData} from './MetaHandler.js';\nimport {data as rendererHandlerData, type RendererHandlerData} from './RendererHandler.js';\nimport * as Threads from './Threads.js';\nimport type {HandlerName} from './types.js';\n\n/**\n * IMPORTANT: this handler is slightly different to the rest. This is because\n * it is an adaptation of the TimelineFrameModel that has been used in DevTools\n * for many years. Rather than re-implement all the logic from scratch, instead\n * this handler gathers up the events and instantitates the class in the\n * finalize() method. Once the class has parsed all events, it is used to then\n * return the array of frames.\n *\n * In time we expect to migrate this code to a more \"typical\" handler.\n */\n\nconst allEvents: Types.Events.Event[] = [];\nlet model: TimelineFrameModel|null = null;\n\nexport function reset(): void {\n allEvents.length = 0;\n}\n\nexport function handleEvent(event: Types.Events.Event): void {\n allEvents.push(event);\n}\n\nexport async function finalize(): Promise<void> {\n // Snapshot events can be emitted out of order, so we need to sort before\n // building the frames model.\n Helpers.Trace.sortTraceEventsInPlace(allEvents);\n\n const modelForTrace = new TimelineFrameModel(\n allEvents,\n rendererHandlerData(),\n auctionWorkletsData(),\n metaHandlerData(),\n layerTreeHandlerData(),\n );\n model = modelForTrace;\n}\n\nexport interface FramesData {\n frames: readonly Types.Events.LegacyTimelineFrame[];\n framesById: Readonly<Record<number, Types.Events.LegacyTimelineFrame|undefined>>;\n}\n\nexport function data(): FramesData {\n return {\n frames: model ? Array.from(model.frames()) : [],\n framesById: model ? {...model.framesById()} : {},\n };\n}\n\nexport function deps(): HandlerName[] {\n return ['Meta', 'Renderer', 'AuctionWorklets', 'LayerTree'];\n}\n\ntype FrameEvent = Types.Events.BeginFrame|Types.Events.DroppedFrame|Types.Events.RequestMainThreadFrame|\n Types.Events.BeginMainThreadFrame|Types.Events.Commit|Types.Events.CompositeLayers|\n Types.Events.ActivateLayerTree|Types.Events.NeedsBeginFrameChanged|Types.Events.DrawFrame;\n\nfunction isFrameEvent(event: Types.Events.Event): event is FrameEvent {\n return (\n Types.Events.isSetLayerId(event) || Types.Events.isBeginFrame(event) || Types.Events.isDroppedFrame(event) ||\n Types.Events.isRequestMainThreadFrame(event) || Types.Events.isBeginMainThreadFrame(event) ||\n Types.Events.isNeedsBeginFrameChanged(event) ||\n // Note that \"Commit\" is the replacement for \"CompositeLayers\" so in a trace\n // we wouldn't expect to see a combination of these. All \"new\" trace\n // recordings use \"Commit\", but we can easily support \"CompositeLayers\" too\n // to not break older traces being imported.\n Types.Events.isCommit(event) || Types.Events.isCompositeLayers(event) ||\n Types.Events.isActivateLayerTree(event) || Types.Events.isDrawFrame(event));\n}\n\nfunction entryIsTopLevel(entry: Types.Events.Event): boolean {\n const devtoolsTimelineCategory = 'disabled-by-default-devtools.timeline';\n return entry.name === Types.Events.Name.RUN_TASK && entry.cat.includes(devtoolsTimelineCategory);\n}\n\nexport class TimelineFrameModel {\n #frames: TimelineFrame[] = [];\n #frameById: {\n [x: number]: TimelineFrame,\n } = {};\n #beginFrameQueue: TimelineFrameBeginFrameQueue = new TimelineFrameBeginFrameQueue();\n #lastFrame: TimelineFrame|null = null;\n #mainFrameCommitted = false;\n #mainFrameRequested = false;\n #lastLayerTree: Types.Events.LegacyFrameLayerTreeData|null = null;\n #framePendingActivation: PendingFrame|null = null;\n #framePendingCommit: PendingFrame|null = null;\n #lastBeginFrame: number|null = null;\n #lastNeedsBeginFrame: number|null = null;\n #lastTaskBeginTime: Types.Timing.Micro|null = null;\n #layerTreeId: number|null = null;\n #activeProcessId: Types.Events.ProcessID|null = null;\n #activeThreadId: Types.Events.ThreadID|null = null;\n #layerTreeData: LayerTreeData;\n\n constructor(\n allEvents: readonly Types.Events.Event[], rendererData: RendererHandlerData,\n auctionWorkletsData: AuctionWorkletsData, metaData: MetaHandlerData, layerTreeData: LayerTreeData) {\n // We only care about getting threads from the Renderer, not Samples,\n // because Frames don't exist in a CPU Profile (which won't have Renderer\n // threads.)\n const mainThreads = Threads.threadsInRenderer(rendererData, auctionWorkletsData).filter(thread => {\n return thread.type === Threads.ThreadType.MAIN_THREAD && thread.processIsOnMainFrame;\n });\n const threadData = mainThreads.map(thread => {\n return {\n tid: thread.tid,\n pid: thread.pid,\n startTime: thread.entries[0].ts,\n };\n });\n\n this.#layerTreeData = layerTreeData;\n this.#addTraceEvents(allEvents, threadData, metaData.mainFrameId);\n }\n\n framesById(): Readonly<Record<number, TimelineFrame|undefined>> {\n return this.#frameById;\n }\n\n frames(): TimelineFrame[] {\n return this.#frames;\n }\n\n #handleBeginFrame(startTime: Types.Timing.Micro, seqId: number): void {\n if (!this.#lastFrame) {\n this.#startFrame(startTime, seqId);\n }\n this.#lastBeginFrame = startTime;\n\n this.#beginFrameQueue.addFrameIfNotExists(seqId, startTime, false, false);\n }\n\n #handleDroppedFrame(startTime: Types.Timing.Micro, seqId: number, isPartial: boolean): void {\n if (!this.#lastFrame) {\n this.#startFrame(startTime, seqId);\n }\n\n // This line handles the case where no BeginFrame event is issued for\n // the dropped frame. In this situation, add a BeginFrame to the queue\n // as if it actually occurred.\n this.#beginFrameQueue.addFrameIfNotExists(seqId, startTime, true, isPartial);\n this.#beginFrameQueue.setDropped(seqId, true);\n this.#beginFrameQueue.setPartial(seqId, isPartial);\n }\n\n #handleDrawFrame(startTime: Types.Timing.Micro, seqId: number): void {\n if (!this.#lastFrame) {\n this.#startFrame(startTime, seqId);\n return;\n }\n\n // - if it wasn't drawn, it didn't happen!\n // - only show frames that either did not wait for the main thread frame or had one committed.\n if (this.#mainFrameCommitted || !this.#mainFrameRequested) {\n if (this.#lastNeedsBeginFrame) {\n const idleTimeEnd = this.#framePendingActivation ? this.#framePendingActivation.triggerTime :\n (this.#lastBeginFrame || this.#lastNeedsBeginFrame);\n if (idleTimeEnd > this.#lastFrame.startTime) {\n this.#lastFrame.idle = true;\n this.#lastBeginFrame = null;\n }\n this.#lastNeedsBeginFrame = null;\n }\n\n const framesToVisualize = this.#beginFrameQueue.processPendingBeginFramesOnDrawFrame(seqId);\n\n // Visualize the current frame and all pending frames before it.\n for (const frame of framesToVisualize) {\n const isLastFrameIdle = this.#lastFrame.idle;\n\n // If |frame| is the first frame after an idle period, the CPU time\n // will be logged (\"committed\") under |frame| if applicable.\n this.#startFrame(frame.startTime, seqId);\n if (isLastFrameIdle && this.#framePendingActivation) {\n this.#commitPendingFrame();\n }\n if (frame.isDropped) {\n this.#lastFrame.dropped = true;\n }\n if (frame.isPartial) {\n this.#lastFrame.isPartial = true;\n }\n }\n }\n this.#mainFrameCommitted = false;\n }\n\n #handleActivateLayerTree(): void {\n if (!this.#lastFrame) {\n return;\n }\n if (this.#framePendingActivation && !this.#lastNeedsBeginFrame) {\n this.#commitPendingFrame();\n }\n }\n\n #handleRequestMainThreadFrame(): void {\n if (!this.#lastFrame) {\n return;\n }\n this.#mainFrameRequested = true;\n }\n\n #handleCommit(): void {\n if (!this.#framePendingCommit) {\n return;\n }\n this.#framePendingActivation = this.#framePendingCommit;\n this.#framePendingCommit = null;\n this.#mainFrameRequested = false;\n this.#mainFrameCommitted = true;\n }\n\n #handleLayerTreeSnapshot(layerTree: Types.Events.LegacyFrameLayerTreeData): void {\n this.#lastLayerTree = layerTree;\n }\n\n #handleNeedFrameChanged(startTime: Types.Timing.Micro, needsBeginFrame: boolean): void {\n if (needsBeginFrame) {\n this.#lastNeedsBeginFrame = startTime;\n }\n }\n\n #startFrame(startTime: Types.Timing.Micro, seqId: number): void {\n if (this.#lastFrame) {\n this.#flushFrame(this.#lastFrame, startTime);\n }\n this.#lastFrame =\n new TimelineFrame(seqId, startTime, Types.Timing.Micro(startTime - metaHandlerData().traceBounds.min));\n }\n\n #flushFrame(frame: TimelineFrame, endTime: Types.Timing.Micro): void {\n frame.setLayerTree(this.#lastLayerTree);\n frame.setEndTime(endTime);\n if (this.#lastLayerTree) {\n this.#lastLayerTree.paints = frame.paints;\n }\n const lastFrame = this.#frames[this.#frames.length - 1];\n if (this.#frames.length && lastFrame &&\n (frame.startTime !== lastFrame.endTime || frame.startTime > frame.endTime)) {\n console.assert(\n false, `Inconsistent frame time for frame ${this.#frames.length} (${frame.startTime} - ${frame.endTime})`);\n }\n const newFramesLength = this.#frames.push(frame);\n frame.setIndex(newFramesLength - 1);\n if (typeof frame.mainFrameId === 'number') {\n this.#frameById[frame.mainFrameId] = frame;\n }\n }\n\n #commitPendingFrame(): void {\n if (!this.#framePendingActivation || !this.#lastFrame) {\n return;\n }\n\n this.#lastFrame.paints = this.#framePendingActivation.paints;\n this.#lastFrame.mainFrameId = this.#framePendingActivation.mainFrameId;\n this.#framePendingActivation = null;\n }\n\n #addTraceEvents(\n events: readonly Types.Events.Event[], threadData: Array<{\n pid: Types.Events.ProcessID,\n tid: Types.Events.ThreadID,\n startTime: Types.Timing.Micro,\n }>,\n mainFrameId: string): void {\n let j = 0;\n this.#activeThreadId = threadData.length && threadData[0].tid || null;\n this.#activeProcessId = threadData.length && threadData[0].pid || null;\n for (let i = 0; i < events.length; ++i) {\n while (j + 1 < threadData.length && threadData[j + 1].startTime <= events[i].ts) {\n this.#activeThreadId = threadData[++j].tid;\n this.#activeProcessId = threadData[j].pid;\n }\n this.#addTraceEvent(events[i], mainFrameId);\n }\n this.#activeThreadId = null;\n this.#activeProcessId = null;\n }\n\n #addTraceEvent(event: Types.Events.Event, mainFrameId: string): void {\n if (Types.Events.isSetLayerId(event) && event.args.data.frame === mainFrameId) {\n this.#layerTreeId = event.args.data.layerTreeId;\n } else if (Types.Events.isLayerTreeHostImplSnapshot(event) && Number(event.id) === this.#layerTreeId) {\n this.#handleLayerTreeSnapshot({\n entry: event,\n paints: [],\n });\n } else {\n if (isFrameEvent(event)) {\n this.#processCompositorEvents(event);\n }\n // Make sure we only use events from the main thread: we check the PID as\n // well in case two processes have a thread with the same TID.\n if (event.tid === this.#activeThreadId && event.pid === this.#activeProcessId) {\n this.#addMainThreadTraceEvent(event);\n }\n }\n }\n\n #processCompositorEvents(entry: FrameEvent): void {\n if (entry.args['layerTreeId'] !== this.#layerTreeId) {\n return;\n }\n if (Types.Events.isBeginFrame(entry)) {\n this.#handleBeginFrame(entry.ts, entry.args['frameSeqId']);\n } else if (Types.Events.isDrawFrame(entry)) {\n this.#handleDrawFrame(entry.ts, entry.args['frameSeqId']);\n } else if (Types.Events.isActivateLayerTree(entry)) {\n this.#handleActivateLayerTree();\n } else if (Types.Events.isRequestMainThreadFrame(entry)) {\n this.#handleRequestMainThreadFrame();\n } else if (Types.Events.isNeedsBeginFrameChanged(entry)) {\n // needsBeginFrame property will either be 0 or 1, which represents\n // true/false in this case, hence the Boolean() wrapper.\n this.#handleNeedFrameChanged(entry.ts, entry.args['data'] && Boolean(entry.args['data']['needsBeginFrame']));\n } else if (Types.Events.isDroppedFrame(entry)) {\n this.#handleDroppedFrame(entry.ts, entry.args['frameSeqId'], Boolean(entry.args['hasPartialUpdate']));\n }\n }\n\n #addMainThreadTraceEvent(entry: Types.Events.Event): void {\n if (entryIsTopLevel(entry)) {\n this.#lastTaskBeginTime = entry.ts;\n }\n if (!this.#framePendingCommit && MAIN_FRAME_MARKERS.has(entry.name as Types.Events.Name)) {\n this.#framePendingCommit = new PendingFrame(this.#lastTaskBeginTime || entry.ts);\n }\n if (!this.#framePendingCommit) {\n return;\n }\n\n if (Types.Events.isBeginMainThreadFrame(entry) && entry.args.data.frameId) {\n this.#framePendingCommit.mainFrameId = entry.args.data.frameId;\n }\n if (Types.Events.isPaint(entry)) {\n const snapshot = this.#layerTreeData.paintsToSnapshots.get(entry);\n if (snapshot) {\n this.#framePendingCommit.paints.push(new LayerPaintEvent(entry, snapshot));\n }\n }\n // Commit will be replacing CompositeLayers but CompositeLayers is kept\n // around for backwards compatibility.\n if ((Types.Events.isCompositeLayers(entry) || Types.Events.isCommit(entry)) &&\n entry.args['layerTreeId'] === this.#layerTreeId) {\n this.#handleCommit();\n }\n }\n}\n\nconst MAIN_FRAME_MARKERS = new Set<Types.Events.Name>([\n Types.Events.Name.SCHEDULE_STYLE_RECALCULATION,\n Types.Events.Name.INVALIDATE_LAYOUT,\n Types.Events.Name.BEGIN_MAIN_THREAD_FRAME,\n Types.Events.Name.SCROLL_LAYER,\n]);\n\n/**\n * Legacy class that represents TimelineFrames that was ported from the old SDK.\n * This class is purposefully not exported as it breaks the abstraction that\n * every event shown on the timeline is a trace event. Instead, we use the Type\n * LegacyTimelineFrame to represent frames in the codebase. These do implement\n * the right interface to be treated just like they were a trace event.\n */\nclass TimelineFrame implements Types.Events.LegacyTimelineFrame {\n // These fields exist to satisfy the base Event type which all\n // \"trace events\" must implement. They aren't used, but doing this means we\n // can pass `TimelineFrame` instances into places that expect\n // Types.Events.Event.\n cat = 'devtools.legacy_frame';\n name = 'frame';\n ph = Types.Events.Phase.COMPLETE;\n ts: Types.Timing.Micro;\n pid = Types.Events.ProcessID(-1);\n tid = Types.Events.ThreadID(-1);\n\n index = -1;\n startTime: Types.Timing.Micro;\n startTimeOffset: Types.Timing.Micro;\n endTime: Types.Timing.Micro;\n duration: Types.Timing.Micro;\n idle: boolean;\n dropped: boolean;\n isPartial: boolean;\n layerTree: Types.Events.LegacyFrameLayerTreeData|null;\n paints: LayerPaintEvent[];\n mainFrameId: number|undefined;\n readonly seqId: number;\n\n constructor(seqId: number, startTime: Types.Timing.Micro, startTimeOffset: Types.Timing.Micro) {\n this.seqId = seqId;\n this.startTime = startTime;\n this.ts = startTime;\n this.startTimeOffset = startTimeOffset;\n this.endTime = this.startTime;\n this.duration = Types.Timing.Micro(0);\n this.idle = false;\n this.dropped = false;\n this.isPartial = false;\n this.layerTree = null;\n this.paints = [];\n this.mainFrameId = undefined;\n }\n\n setIndex(i: number): void {\n this.index = i;\n }\n\n setEndTime(endTime: Types.Timing.Micro): void {\n this.endTime = endTime;\n this.duration = Types.Timing.Micro(this.endTime - this.startTime);\n }\n\n setLayerTree(layerTree: Types.Events.LegacyFrameLayerTreeData|null): void {\n this.layerTree = layerTree;\n }\n\n /**\n * Fake the `dur` field to meet the expected value given that we pretend\n * these TimelineFrame classes are trace events across the codebase.\n */\n get dur(): Types.Timing.Micro {\n return this.duration;\n }\n}\n\nexport class LayerPaintEvent implements Types.Events.LegacyLayerPaintEvent {\n readonly #event: Types.Events.Paint;\n #snapshot: Types.Events.DisplayItemListSnapshot;\n\n constructor(event: Types.Events.Paint, snapshot: Types.Events.DisplayItemListSnapshot) {\n this.#event = event;\n this.#snapshot = snapshot;\n }\n\n layerId(): number {\n return this.#event.args.data.layerId;\n }\n\n event(): Types.Events.Paint {\n return this.#event;\n }\n\n picture(): Types.Events.LegacyLayerPaintEventPicture|null {\n const rect = this.#snapshot.args.snapshot.params?.layer_rect;\n const pictureData = this.#snapshot.args.snapshot.skp64;\n return rect && pictureData ? {rect, serializedPicture: pictureData} : null;\n }\n}\n\nexport class PendingFrame {\n paints: LayerPaintEvent[];\n mainFrameId: number|undefined;\n triggerTime: number;\n constructor(triggerTime: number) {\n this.paints = [];\n this.mainFrameId = undefined;\n this.triggerTime = triggerTime;\n }\n}\n\n// The parameters of an impl-side BeginFrame.\nclass BeginFrameInfo {\n seqId: number;\n startTime: Types.Timing.Micro;\n isDropped: boolean;\n isPartial: boolean;\n constructor(seqId: number, startTime: Types.Timing.Micro, isDropped: boolean, isPartial: boolean) {\n this.seqId = seqId;\n this.startTime = startTime;\n this.isDropped = isDropped;\n this.isPartial = isPartial;\n }\n}\n\n// A queue of BeginFrames pending visualization.\n// BeginFrames are added into this queue as they occur; later when their\n// corresponding DrawFrames occur (or lack thereof), the BeginFrames are removed\n// from the queue and their timestamps are used for visualization.\nexport class TimelineFrameBeginFrameQueue {\n private queueFrames: number[] = [];\n\n // Maps frameSeqId to BeginFrameInfo.\n private mapFrames: {\n [x: number]: BeginFrameInfo,\n } = {};\n\n // Add a BeginFrame to the queue, if it does not already exit.\n addFrameIfNotExists(seqId: number, startTime: Types.Timing.Micro, isDropped: boolean, isPartial: boolean): void {\n if (!(seqId in this.mapFrames)) {\n this.mapFrames[seqId] = new BeginFrameInfo(seqId, startTime, isDropped, isPartial);\n this.queueFrames.push(seqId);\n }\n }\n\n // Set a BeginFrame in queue as dropped.\n setDropped(seqId: number, isDropped: boolean): void {\n if (seqId in this.mapFrames) {\n this.mapFrames[seqId].isDropped = isDropped;\n }\n }\n\n setPartial(seqId: number, isPartial: boolean): void {\n if (seqId in this.mapFrames) {\n this.mapFrames[seqId].isPartial = isPartial;\n }\n }\n\n processPendingBeginFramesOnDrawFrame(seqId: number): BeginFrameInfo[] {\n const framesToVisualize: BeginFrameInfo[] = [];\n\n // Do not visualize this frame in the rare case where the current DrawFrame\n // does not have a corresponding BeginFrame.\n if (seqId in this.mapFrames) {\n // Pop all BeginFrames before the current frame, and add only the dropped\n // ones in |frames_to_visualize|.\n // Non-dropped frames popped here are BeginFrames that are never\n // drawn (but not considered dropped either for some reason).\n // Those frames do not require an proactive visualization effort and will\n // be naturally presented as continuationss of other frames.\n while (this.queueFrames[0] !== seqId) {\n const currentSeqId = this.queueFrames[0];\n if (this.mapFrames[currentSeqId].isDropped) {\n framesToVisualize.push(this.mapFrames[currentSeqId]);\n }\n\n delete this.mapFrames[currentSeqId];\n this.queueFrames.shift();\n }\n\n // Pop the BeginFrame associated with the current DrawFrame.\n framesToVisualize.push(this.mapFrames[seqId]);\n delete this.mapFrames[seqId];\n this.queueFrames.shift();\n }\n return framesToVisualize;\n }\n}\n\nexport function framesWithinWindow(\n frames: readonly Types.Events.LegacyTimelineFrame[], startTime: Types.Timing.Micro,\n endTime: Types.Timing.Micro): Types.Events.LegacyTimelineFrame[] {\n const firstFrame = Platform.ArrayUtilities.lowerBound(frames, startTime || 0, (time, frame) => time - frame.endTime);\n const lastFrame =\n Platform.ArrayUtilities.lowerBound(frames, endTime || Infinity, (time, frame) => time - frame.startTime);\n return frames.slice(firstFrame, lastFrame);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"FramesHandler.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/handlers/FramesHandler.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,QAAQ,MAAM,oCAAoC,CAAC;AAC/D,OAAO,KAAK,OAAO,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAA2B,IAAI,IAAI,mBAAmB,EAAC,MAAM,6BAA6B,CAAC;AAClG,OAAO,EAAC,IAAI,IAAI,oBAAoB,EAAqB,MAAM,uBAAuB,CAAC;AACvF,OAAO,EAAC,IAAI,IAAI,eAAe,EAAuB,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAC,IAAI,IAAI,mBAAmB,EAA2B,MAAM,sBAAsB,CAAC;AAC3F,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AAGxC;;;;;;;;;GASG;AAEH,MAAM,SAAS,GAAyB,EAAE,CAAC;AAC3C,IAAI,KAAK,GAA4B,IAAI,CAAC;AAE1C,MAAM,UAAU,KAAK;IACnB,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAyB;IACnD,SAAS,CAAC,IAAI,CAAC,KAAK,CAA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AAI,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;IACrH,MAAM,SAAS,GACX,QAAQ,CAAC,cAAc,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,IAAI,QAAQ,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC;IAC7G,OAAO,MAAM,CAAC,KAAK,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;AAC7C,CAAC","sourcesContent":["// Copyright 2023 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport * as Platform from '../../../core/platform/platform.js';\nimport * as Helpers from '../helpers/helpers.js';\nimport * as Types from '../types/types.js';\n\nimport {type AuctionWorkletsData, data as auctionWorkletsData} from './AuctionWorkletsHandler.js';\nimport {data as layerTreeHandlerData, type LayerTreeData} from './LayerTreeHandler.js';\nimport {data as metaHandlerData, type MetaHandlerData} from './MetaHandler.js';\nimport {data as rendererHandlerData, type RendererHandlerData} from './RendererHandler.js';\nimport * as Threads from './Threads.js';\nimport type {HandlerName} from './types.js';\n\n/**\n * IMPORTANT: this handler is slightly different to the rest. This is because\n * it is an adaptation of the TimelineFrameModel that has been used in DevTools\n * for many years. Rather than re-implement all the logic from scratch, instead\n * this handler gathers up the events and instantitates the class in the\n * finalize() method. Once the class has parsed all events, it is used to then\n * return the array of frames.\n *\n * In time we expect to migrate this code to a more \"typical\" handler.\n */\n\nconst allEvents: Types.Events.Event[] = [];\nlet model: TimelineFrameModel|null = null;\n\nexport function reset(): void {\n allEvents.length = 0;\n}\n\nexport function handleEvent(event: Types.Events.Event): void {\n allEvents.push(event);\n}\n\nexport async function finalize(): Promise<void> {\n // Snapshot events can be emitted out of order, so we need to sort before\n // building the frames model.\n Helpers.Trace.sortTraceEventsInPlace(allEvents);\n\n const modelForTrace = new TimelineFrameModel(\n allEvents,\n rendererHandlerData(),\n auctionWorkletsData(),\n metaHandlerData(),\n layerTreeHandlerData(),\n );\n model = modelForTrace;\n}\n\nexport interface FramesData {\n frames: readonly Types.Events.LegacyTimelineFrame[];\n framesById: Readonly<Record<number, Types.Events.LegacyTimelineFrame|undefined>>;\n}\n\nexport function data(): FramesData {\n return {\n frames: model ? Array.from(model.frames()) : [],\n framesById: model ? {...model.framesById()} : {},\n };\n}\n\nexport function deps(): HandlerName[] {\n return ['Meta', 'Renderer', 'AuctionWorklets', 'LayerTree'];\n}\n\ntype FrameEvent = Types.Events.BeginFrame|Types.Events.DroppedFrame|Types.Events.RequestMainThreadFrame|\n Types.Events.BeginMainThreadFrame|Types.Events.Commit|Types.Events.CompositeLayers|\n Types.Events.ActivateLayerTree|Types.Events.NeedsBeginFrameChanged|Types.Events.DrawFrame;\n\nfunction isFrameEvent(event: Types.Events.Event): event is FrameEvent {\n return (\n Types.Events.isSetLayerId(event) || Types.Events.isBeginFrame(event) || Types.Events.isDroppedFrame(event) ||\n Types.Events.isRequestMainThreadFrame(event) || Types.Events.isBeginMainThreadFrame(event) ||\n Types.Events.isNeedsBeginFrameChanged(event) ||\n // Note that \"Commit\" is the replacement for \"CompositeLayers\" so in a trace\n // we wouldn't expect to see a combination of these. All \"new\" trace\n // recordings use \"Commit\", but we can easily support \"CompositeLayers\" too\n // to not break older traces being imported.\n Types.Events.isCommit(event) || Types.Events.isCompositeLayers(event) ||\n Types.Events.isActivateLayerTree(event) || Types.Events.isDrawFrame(event));\n}\n\nfunction entryIsTopLevel(entry: Types.Events.Event): boolean {\n const devtoolsTimelineCategory = 'disabled-by-default-devtools.timeline';\n return entry.name === Types.Events.Name.RUN_TASK && entry.cat.includes(devtoolsTimelineCategory);\n}\n\nexport class TimelineFrameModel {\n #frames: TimelineFrame[] = [];\n #frameById: Record<number, TimelineFrame> = {};\n #beginFrameQueue: TimelineFrameBeginFrameQueue = new TimelineFrameBeginFrameQueue();\n #lastFrame: TimelineFrame|null = null;\n #mainFrameCommitted = false;\n #mainFrameRequested = false;\n #lastLayerTree: Types.Events.LegacyFrameLayerTreeData|null = null;\n #framePendingActivation: PendingFrame|null = null;\n #framePendingCommit: PendingFrame|null = null;\n #lastBeginFrame: number|null = null;\n #lastNeedsBeginFrame: number|null = null;\n #lastTaskBeginTime: Types.Timing.Micro|null = null;\n #layerTreeId: number|null = null;\n #activeProcessId: Types.Events.ProcessID|null = null;\n #activeThreadId: Types.Events.ThreadID|null = null;\n #layerTreeData: LayerTreeData;\n\n constructor(\n allEvents: readonly Types.Events.Event[], rendererData: RendererHandlerData,\n auctionWorkletsData: AuctionWorkletsData, metaData: MetaHandlerData, layerTreeData: LayerTreeData) {\n // We only care about getting threads from the Renderer, not Samples,\n // because Frames don't exist in a CPU Profile (which won't have Renderer\n // threads.)\n const mainThreads = Threads.threadsInRenderer(rendererData, auctionWorkletsData).filter(thread => {\n return thread.type === Threads.ThreadType.MAIN_THREAD && thread.processIsOnMainFrame;\n });\n const threadData = mainThreads.map(thread => {\n return {\n tid: thread.tid,\n pid: thread.pid,\n startTime: thread.entries[0].ts,\n };\n });\n\n this.#layerTreeData = layerTreeData;\n this.#addTraceEvents(allEvents, threadData, metaData.mainFrameId);\n }\n\n framesById(): Readonly<Record<number, TimelineFrame|undefined>> {\n return this.#frameById;\n }\n\n frames(): TimelineFrame[] {\n return this.#frames;\n }\n\n #handleBeginFrame(startTime: Types.Timing.Micro, seqId: number): void {\n if (!this.#lastFrame) {\n this.#startFrame(startTime, seqId);\n }\n this.#lastBeginFrame = startTime;\n\n this.#beginFrameQueue.addFrameIfNotExists(seqId, startTime, false, false);\n }\n\n #handleDroppedFrame(startTime: Types.Timing.Micro, seqId: number, isPartial: boolean): void {\n if (!this.#lastFrame) {\n this.#startFrame(startTime, seqId);\n }\n\n // This line handles the case where no BeginFrame event is issued for\n // the dropped frame. In this situation, add a BeginFrame to the queue\n // as if it actually occurred.\n this.#beginFrameQueue.addFrameIfNotExists(seqId, startTime, true, isPartial);\n this.#beginFrameQueue.setDropped(seqId, true);\n this.#beginFrameQueue.setPartial(seqId, isPartial);\n }\n\n #handleDrawFrame(startTime: Types.Timing.Micro, seqId: number): void {\n if (!this.#lastFrame) {\n this.#startFrame(startTime, seqId);\n return;\n }\n\n // - if it wasn't drawn, it didn't happen!\n // - only show frames that either did not wait for the main thread frame or had one committed.\n if (this.#mainFrameCommitted || !this.#mainFrameRequested) {\n if (this.#lastNeedsBeginFrame) {\n const idleTimeEnd = this.#framePendingActivation ? this.#framePendingActivation.triggerTime :\n (this.#lastBeginFrame || this.#lastNeedsBeginFrame);\n if (idleTimeEnd > this.#lastFrame.startTime) {\n this.#lastFrame.idle = true;\n this.#lastBeginFrame = null;\n }\n this.#lastNeedsBeginFrame = null;\n }\n\n const framesToVisualize = this.#beginFrameQueue.processPendingBeginFramesOnDrawFrame(seqId);\n\n // Visualize the current frame and all pending frames before it.\n for (const frame of framesToVisualize) {\n const isLastFrameIdle = this.#lastFrame.idle;\n\n // If |frame| is the first frame after an idle period, the CPU time\n // will be logged (\"committed\") under |frame| if applicable.\n this.#startFrame(frame.startTime, seqId);\n if (isLastFrameIdle && this.#framePendingActivation) {\n this.#commitPendingFrame();\n }\n if (frame.isDropped) {\n this.#lastFrame.dropped = true;\n }\n if (frame.isPartial) {\n this.#lastFrame.isPartial = true;\n }\n }\n }\n this.#mainFrameCommitted = false;\n }\n\n #handleActivateLayerTree(): void {\n if (!this.#lastFrame) {\n return;\n }\n if (this.#framePendingActivation && !this.#lastNeedsBeginFrame) {\n this.#commitPendingFrame();\n }\n }\n\n #handleRequestMainThreadFrame(): void {\n if (!this.#lastFrame) {\n return;\n }\n this.#mainFrameRequested = true;\n }\n\n #handleCommit(): void {\n if (!this.#framePendingCommit) {\n return;\n }\n this.#framePendingActivation = this.#framePendingCommit;\n this.#framePendingCommit = null;\n this.#mainFrameRequested = false;\n this.#mainFrameCommitted = true;\n }\n\n #handleLayerTreeSnapshot(layerTree: Types.Events.LegacyFrameLayerTreeData): void {\n this.#lastLayerTree = layerTree;\n }\n\n #handleNeedFrameChanged(startTime: Types.Timing.Micro, needsBeginFrame: boolean): void {\n if (needsBeginFrame) {\n this.#lastNeedsBeginFrame = startTime;\n }\n }\n\n #startFrame(startTime: Types.Timing.Micro, seqId: number): void {\n if (this.#lastFrame) {\n this.#flushFrame(this.#lastFrame, startTime);\n }\n this.#lastFrame =\n new TimelineFrame(seqId, startTime, Types.Timing.Micro(startTime - metaHandlerData().traceBounds.min));\n }\n\n #flushFrame(frame: TimelineFrame, endTime: Types.Timing.Micro): void {\n frame.setLayerTree(this.#lastLayerTree);\n frame.setEndTime(endTime);\n if (this.#lastLayerTree) {\n this.#lastLayerTree.paints = frame.paints;\n }\n const lastFrame = this.#frames[this.#frames.length - 1];\n if (this.#frames.length && lastFrame &&\n (frame.startTime !== lastFrame.endTime || frame.startTime > frame.endTime)) {\n console.assert(\n false, `Inconsistent frame time for frame ${this.#frames.length} (${frame.startTime} - ${frame.endTime})`);\n }\n const newFramesLength = this.#frames.push(frame);\n frame.setIndex(newFramesLength - 1);\n if (typeof frame.mainFrameId === 'number') {\n this.#frameById[frame.mainFrameId] = frame;\n }\n }\n\n #commitPendingFrame(): void {\n if (!this.#framePendingActivation || !this.#lastFrame) {\n return;\n }\n\n this.#lastFrame.paints = this.#framePendingActivation.paints;\n this.#lastFrame.mainFrameId = this.#framePendingActivation.mainFrameId;\n this.#framePendingActivation = null;\n }\n\n #addTraceEvents(\n events: readonly Types.Events.Event[], threadData: Array<{\n pid: Types.Events.ProcessID,\n tid: Types.Events.ThreadID,\n startTime: Types.Timing.Micro,\n }>,\n mainFrameId: string): void {\n let j = 0;\n this.#activeThreadId = threadData.length && threadData[0].tid || null;\n this.#activeProcessId = threadData.length && threadData[0].pid || null;\n for (let i = 0; i < events.length; ++i) {\n while (j + 1 < threadData.length && threadData[j + 1].startTime <= events[i].ts) {\n this.#activeThreadId = threadData[++j].tid;\n this.#activeProcessId = threadData[j].pid;\n }\n this.#addTraceEvent(events[i], mainFrameId);\n }\n this.#activeThreadId = null;\n this.#activeProcessId = null;\n }\n\n #addTraceEvent(event: Types.Events.Event, mainFrameId: string): void {\n if (Types.Events.isSetLayerId(event) && event.args.data.frame === mainFrameId) {\n this.#layerTreeId = event.args.data.layerTreeId;\n } else if (Types.Events.isLayerTreeHostImplSnapshot(event) && Number(event.id) === this.#layerTreeId) {\n this.#handleLayerTreeSnapshot({\n entry: event,\n paints: [],\n });\n } else {\n if (isFrameEvent(event)) {\n this.#processCompositorEvents(event);\n }\n // Make sure we only use events from the main thread: we check the PID as\n // well in case two processes have a thread with the same TID.\n if (event.tid === this.#activeThreadId && event.pid === this.#activeProcessId) {\n this.#addMainThreadTraceEvent(event);\n }\n }\n }\n\n #processCompositorEvents(entry: FrameEvent): void {\n if (entry.args['layerTreeId'] !== this.#layerTreeId) {\n return;\n }\n if (Types.Events.isBeginFrame(entry)) {\n this.#handleBeginFrame(entry.ts, entry.args['frameSeqId']);\n } else if (Types.Events.isDrawFrame(entry)) {\n this.#handleDrawFrame(entry.ts, entry.args['frameSeqId']);\n } else if (Types.Events.isActivateLayerTree(entry)) {\n this.#handleActivateLayerTree();\n } else if (Types.Events.isRequestMainThreadFrame(entry)) {\n this.#handleRequestMainThreadFrame();\n } else if (Types.Events.isNeedsBeginFrameChanged(entry)) {\n // needsBeginFrame property will either be 0 or 1, which represents\n // true/false in this case, hence the Boolean() wrapper.\n this.#handleNeedFrameChanged(entry.ts, entry.args['data'] && Boolean(entry.args['data']['needsBeginFrame']));\n } else if (Types.Events.isDroppedFrame(entry)) {\n this.#handleDroppedFrame(entry.ts, entry.args['frameSeqId'], Boolean(entry.args['hasPartialUpdate']));\n }\n }\n\n #addMainThreadTraceEvent(entry: Types.Events.Event): void {\n if (entryIsTopLevel(entry)) {\n this.#lastTaskBeginTime = entry.ts;\n }\n if (!this.#framePendingCommit && MAIN_FRAME_MARKERS.has(entry.name as Types.Events.Name)) {\n this.#framePendingCommit = new PendingFrame(this.#lastTaskBeginTime || entry.ts);\n }\n if (!this.#framePendingCommit) {\n return;\n }\n\n if (Types.Events.isBeginMainThreadFrame(entry) && entry.args.data.frameId) {\n this.#framePendingCommit.mainFrameId = entry.args.data.frameId;\n }\n if (Types.Events.isPaint(entry)) {\n const snapshot = this.#layerTreeData.paintsToSnapshots.get(entry);\n if (snapshot) {\n this.#framePendingCommit.paints.push(new LayerPaintEvent(entry, snapshot));\n }\n }\n // Commit will be replacing CompositeLayers but CompositeLayers is kept\n // around for backwards compatibility.\n if ((Types.Events.isCompositeLayers(entry) || Types.Events.isCommit(entry)) &&\n entry.args['layerTreeId'] === this.#layerTreeId) {\n this.#handleCommit();\n }\n }\n}\n\nconst MAIN_FRAME_MARKERS = new Set<Types.Events.Name>([\n Types.Events.Name.SCHEDULE_STYLE_RECALCULATION,\n Types.Events.Name.INVALIDATE_LAYOUT,\n Types.Events.Name.BEGIN_MAIN_THREAD_FRAME,\n Types.Events.Name.SCROLL_LAYER,\n]);\n\n/**\n * Legacy class that represents TimelineFrames that was ported from the old SDK.\n * This class is purposefully not exported as it breaks the abstraction that\n * every event shown on the timeline is a trace event. Instead, we use the Type\n * LegacyTimelineFrame to represent frames in the codebase. These do implement\n * the right interface to be treated just like they were a trace event.\n */\nclass TimelineFrame implements Types.Events.LegacyTimelineFrame {\n // These fields exist to satisfy the base Event type which all\n // \"trace events\" must implement. They aren't used, but doing this means we\n // can pass `TimelineFrame` instances into places that expect\n // Types.Events.Event.\n cat = 'devtools.legacy_frame';\n name = 'frame';\n ph = Types.Events.Phase.COMPLETE;\n ts: Types.Timing.Micro;\n pid = Types.Events.ProcessID(-1);\n tid = Types.Events.ThreadID(-1);\n\n index = -1;\n startTime: Types.Timing.Micro;\n startTimeOffset: Types.Timing.Micro;\n endTime: Types.Timing.Micro;\n duration: Types.Timing.Micro;\n idle: boolean;\n dropped: boolean;\n isPartial: boolean;\n layerTree: Types.Events.LegacyFrameLayerTreeData|null;\n paints: LayerPaintEvent[];\n mainFrameId: number|undefined;\n readonly seqId: number;\n\n constructor(seqId: number, startTime: Types.Timing.Micro, startTimeOffset: Types.Timing.Micro) {\n this.seqId = seqId;\n this.startTime = startTime;\n this.ts = startTime;\n this.startTimeOffset = startTimeOffset;\n this.endTime = this.startTime;\n this.duration = Types.Timing.Micro(0);\n this.idle = false;\n this.dropped = false;\n this.isPartial = false;\n this.layerTree = null;\n this.paints = [];\n this.mainFrameId = undefined;\n }\n\n setIndex(i: number): void {\n this.index = i;\n }\n\n setEndTime(endTime: Types.Timing.Micro): void {\n this.endTime = endTime;\n this.duration = Types.Timing.Micro(this.endTime - this.startTime);\n }\n\n setLayerTree(layerTree: Types.Events.LegacyFrameLayerTreeData|null): void {\n this.layerTree = layerTree;\n }\n\n /**\n * Fake the `dur` field to meet the expected value given that we pretend\n * these TimelineFrame classes are trace events across the codebase.\n */\n get dur(): Types.Timing.Micro {\n return this.duration;\n }\n}\n\nexport class LayerPaintEvent implements Types.Events.LegacyLayerPaintEvent {\n readonly #event: Types.Events.Paint;\n #snapshot: Types.Events.DisplayItemListSnapshot;\n\n constructor(event: Types.Events.Paint, snapshot: Types.Events.DisplayItemListSnapshot) {\n this.#event = event;\n this.#snapshot = snapshot;\n }\n\n layerId(): number {\n return this.#event.args.data.layerId;\n }\n\n event(): Types.Events.Paint {\n return this.#event;\n }\n\n picture(): Types.Events.LegacyLayerPaintEventPicture|null {\n const rect = this.#snapshot.args.snapshot.params?.layer_rect;\n const pictureData = this.#snapshot.args.snapshot.skp64;\n return rect && pictureData ? {rect, serializedPicture: pictureData} : null;\n }\n}\n\nexport class PendingFrame {\n paints: LayerPaintEvent[];\n mainFrameId: number|undefined;\n triggerTime: number;\n constructor(triggerTime: number) {\n this.paints = [];\n this.mainFrameId = undefined;\n this.triggerTime = triggerTime;\n }\n}\n\n// The parameters of an impl-side BeginFrame.\nclass BeginFrameInfo {\n seqId: number;\n startTime: Types.Timing.Micro;\n isDropped: boolean;\n isPartial: boolean;\n constructor(seqId: number, startTime: Types.Timing.Micro, isDropped: boolean, isPartial: boolean) {\n this.seqId = seqId;\n this.startTime = startTime;\n this.isDropped = isDropped;\n this.isPartial = isPartial;\n }\n}\n\n// A queue of BeginFrames pending visualization.\n// BeginFrames are added into this queue as they occur; later when their\n// corresponding DrawFrames occur (or lack thereof), the BeginFrames are removed\n// from the queue and their timestamps are used for visualization.\nexport class TimelineFrameBeginFrameQueue {\n private queueFrames: number[] = [];\n\n // Maps frameSeqId to BeginFrameInfo.\n private mapFrames: Record<number, BeginFrameInfo> = {};\n\n // Add a BeginFrame to the queue, if it does not already exit.\n addFrameIfNotExists(seqId: number, startTime: Types.Timing.Micro, isDropped: boolean, isPartial: boolean): void {\n if (!(seqId in this.mapFrames)) {\n this.mapFrames[seqId] = new BeginFrameInfo(seqId, startTime, isDropped, isPartial);\n this.queueFrames.push(seqId);\n }\n }\n\n // Set a BeginFrame in queue as dropped.\n setDropped(seqId: number, isDropped: boolean): void {\n if (seqId in this.mapFrames) {\n this.mapFrames[seqId].isDropped = isDropped;\n }\n }\n\n setPartial(seqId: number, isPartial: boolean): void {\n if (seqId in this.mapFrames) {\n this.mapFrames[seqId].isPartial = isPartial;\n }\n }\n\n processPendingBeginFramesOnDrawFrame(seqId: number): BeginFrameInfo[] {\n const framesToVisualize: BeginFrameInfo[] = [];\n\n // Do not visualize this frame in the rare case where the current DrawFrame\n // does not have a corresponding BeginFrame.\n if (seqId in this.mapFrames) {\n // Pop all BeginFrames before the current frame, and add only the dropped\n // ones in |frames_to_visualize|.\n // Non-dropped frames popped here are BeginFrames that are never\n // drawn (but not considered dropped either for some reason).\n // Those frames do not require an proactive visualization effort and will\n // be naturally presented as continuationss of other frames.\n while (this.queueFrames[0] !== seqId) {\n const currentSeqId = this.queueFrames[0];\n if (this.mapFrames[currentSeqId].isDropped) {\n framesToVisualize.push(this.mapFrames[currentSeqId]);\n }\n\n delete this.mapFrames[currentSeqId];\n this.queueFrames.shift();\n }\n\n // Pop the BeginFrame associated with the current DrawFrame.\n framesToVisualize.push(this.mapFrames[seqId]);\n delete this.mapFrames[seqId];\n this.queueFrames.shift();\n }\n return framesToVisualize;\n }\n}\n\nexport function framesWithinWindow(\n frames: readonly Types.Events.LegacyTimelineFrame[], startTime: Types.Timing.Micro,\n endTime: Types.Timing.Micro): Types.Events.LegacyTimelineFrame[] {\n const firstFrame = Platform.ArrayUtilities.lowerBound(frames, startTime || 0, (time, frame) => time - frame.endTime);\n const lastFrame =\n Platform.ArrayUtilities.lowerBound(frames, endTime || Infinity, (time, frame) => time - frame.startTime);\n return frames.slice(firstFrame, lastFrame);\n}\n"]}
|