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 #2820

Merged
merged 1 commit into from
Apr 3, 2024

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

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)
Copy link
Member

@kaidokert kaidokert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks safe to go in now

@aelzeiny aelzeiny merged commit a99c34e into 24.lts.1+ Apr 3, 2024
323 checks passed
@aelzeiny aelzeiny deleted the cherry-pick-24.lts.1+-2454 branch April 3, 2024 17:13
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