Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry pick PR #2454: Stabilize JavaScript Profiler in Cobalt #2548

Closed

Conversation

cobalt-github-releaser-bot
Copy link
Collaborator

Refer to the original PR: #2454

b/323983545

A major refactor was needed in order to prevent the JavaScript Profiler from SEGFAULTING due to a garbage-collected nullptr.

This refactor includes the use of a ProfilerGroup class. The life of a cobalt::js_profiler::Profiler is extended by adding scoped_refptrs to the ProfilerGroup; thus preventing GC. Profilers live as long as their ProfilerGroup, which lives as long as the Isolate and Web Agent. One ProfilerGroup is bound to one web::Agent, and contains one v8::Isolate, one v8::CpuProfiler, and many cobalt::js_profiler::Profilers.

The major advantage of this refactor is that it does not crash, and is more faithful to the original Chromium Implementation.

Test-On-Device: true

@kaidokert
Copy link
Member

Marking as draft for now ( keeps the merge queue shorter )

@aelzeiny aelzeiny marked this pull request as ready for review March 26, 2024 20:00
b/323983545

A major refactor was needed in order to prevent the JavaScript Profiler
from SEGFAULTING due to a garbage-collected nullptr.

This refactor includes the use of a `ProfilerGroup` class. The life of a
cobalt::js_profiler::Profiler is extended by adding scoped_refptrs to
the ProfilerGroup; thus preventing GC. Profilers live as long as their
ProfilerGroup, which lives as long as the Isolate and Web Agent. One
`ProfilerGroup` is bound to one `web::Agent`, and contains one
`v8::Isolate`, one `v8::CpuProfiler`, and many
`cobalt::js_profiler::Profiler`s.

The major advantage of this refactor is that it does not crash, and is
more faithful to the [original Chromium
Implementation](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/timing/profiler_group.cc;bpv=0;bpt=0).

Test-On-Device: true

---------

Co-authored-by: Ahmed Elzeiny <[email protected]>
(cherry picked from commit 84c616f)
@aelzeiny
Copy link
Contributor

Marking cherrypick as "ready for review".

Refer to the original PR: #2569

b/326457979

This set of BlackBox tests causes Cobalt to SEGFAULT by forcing Garbage
Collection to execute while the JS Profiler is running. It adds a new
API to CrashLog called h5vcc.crashLog.forceGarbageCollection() for the
purposes of testing. Reverts [an existing revert in PR
2567](#2567). Tests are rewritten
to be less CPU-intensive; expecting fewer stack frames over a longer
period of time.

Test-On-Device: true

---------

Co-authored-by: Kaido Kert <[email protected]>
Co-authored-by: Ahmed Elzeiny <[email protected]>
Co-authored-by: Brian Ting <[email protected]>
Co-authored-by: Colin Liang <[email protected]>
Co-authored-by: Bo-Rong Chen <[email protected]>
@aelzeiny
Copy link
Contributor

aelzeiny commented Apr 2, 2024

Merged "Cherry pick PR #2569: JavaScript Profiler Black box test" into this branch to ensure that both are shipped together.

@aelzeiny aelzeiny closed this Apr 2, 2024
@aelzeiny aelzeiny deleted the cherry-pick-24.lts.1+-2454 branch April 2, 2024 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants