Hello Kentaro, would you please review this change? There is a corresponding change in the DevTools repository ( https://crrev.com/c/5598901 ), which includes a test for the new functionality. If you approve this change, then I would land that DevTools change before this one, and finish up with a second DevTools change to enable the skipped tests. Thanks for your time and consideration!
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. | Gerrit |
Camillo: Would you take a look at the change if this makes sense from the DevTools perspective? Then I'll LGTM this.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. | Gerrit |
return ThreadState::Current()->CopyNameForHeapSnapshot(utf_8.c_str());
`blink::NameProvider` implements `cppgc::NameTrait` which is supposed to work outside of heap snapshots as well.
We sometimes use this for debugging which would break now.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. | Gerrit |
return ThreadState::Current()->CopyNameForHeapSnapshot(utf_8.c_str());
`blink::NameProvider` implements `cppgc::NameTrait` which is supposed to work outside of heap snapshots as well.
We sometimes use this for debugging which would break now.
Oh, great point! I see now that HeapObjectHeader::GetName is called when formatting a message for a crash at [1], as well as a couple of other places.
A possible fix would be to change the contract of CopyNameForHeapSnapshot so that it returns nullptr if a heap snapshot is not in progress, and update this code to return Element::NameInHeapSnapshot in that case. Does that seem reasonable? (I added CopyNameForHeapSnapshot very recently, so I doubt any other embedders are depending on it yet.)
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. | Gerrit |
return ThreadState::Current()->CopyNameForHeapSnapshot(utf_8.c_str());
Seth Brenith`blink::NameProvider` implements `cppgc::NameTrait` which is supposed to work outside of heap snapshots as well.
We sometimes use this for debugging which would break now.
Oh, great point! I see now that HeapObjectHeader::GetName is called when formatting a message for a crash at [1], as well as a couple of other places.
A possible fix would be to change the contract of CopyNameForHeapSnapshot so that it returns nullptr if a heap snapshot is not in progress, and update this code to return Element::NameInHeapSnapshot in that case. Does that seem reasonable? (I added CopyNameForHeapSnapshot very recently, so I doubt any other embedders are depending on it yet.)
Can you check the same condition already on the existing API?
`CopyNameForHeapSnapshot()` seems to have a rather strange contract otherwise in that you can call it at any time but it only will be reasonable if we are creating a snapshot.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. | Gerrit |
return ThreadState::Current()->CopyNameForHeapSnapshot(utf_8.c_str());
Seth Brenith`blink::NameProvider` implements `cppgc::NameTrait` which is supposed to work outside of heap snapshots as well.
We sometimes use this for debugging which would break now.
Michael LippautzOh, great point! I see now that HeapObjectHeader::GetName is called when formatting a message for a crash at [1], as well as a couple of other places.
A possible fix would be to change the contract of CopyNameForHeapSnapshot so that it returns nullptr if a heap snapshot is not in progress, and update this code to return Element::NameInHeapSnapshot in that case. Does that seem reasonable? (I added CopyNameForHeapSnapshot very recently, so I doubt any other embedders are depending on it yet.)
Can you check the same condition already on the existing API?
`CopyNameForHeapSnapshot()` seems to have a rather strange contract otherwise in that you can call it at any time but it only will be reasonable if we are creating a snapshot.
`v8::internal::HeapProfiler` has a function `bool IsTakingSnapshot()`, but there isn't a corresponding function on the public API. Would it make sense for me to add one? Then embedders could easily tell whether it's safe to call `CopyNameForHeapSnapshot`.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. | Gerrit |
return ThreadState::Current()->CopyNameForHeapSnapshot(utf_8.c_str());
Seth Brenith`blink::NameProvider` implements `cppgc::NameTrait` which is supposed to work outside of heap snapshots as well.
We sometimes use this for debugging which would break now.
Michael LippautzOh, great point! I see now that HeapObjectHeader::GetName is called when formatting a message for a crash at [1], as well as a couple of other places.
A possible fix would be to change the contract of CopyNameForHeapSnapshot so that it returns nullptr if a heap snapshot is not in progress, and update this code to return Element::NameInHeapSnapshot in that case. Does that seem reasonable? (I added CopyNameForHeapSnapshot very recently, so I doubt any other embedders are depending on it yet.)
Seth BrenithCan you check the same condition already on the existing API?
`CopyNameForHeapSnapshot()` seems to have a rather strange contract otherwise in that you can call it at any time but it only will be reasonable if we are creating a snapshot.
`v8::internal::HeapProfiler` has a function `bool IsTakingSnapshot()`, but there isn't a corresponding function on the public API. Would it make sense for me to add one? Then embedders could easily tell whether it's safe to call `CopyNameForHeapSnapshot`.
Seems like a better fit than allowing the copy call to be always called?
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. | Gerrit |
Commit-Queue | +1 |
return ThreadState::Current()->CopyNameForHeapSnapshot(utf_8.c_str());
Seth Brenith`blink::NameProvider` implements `cppgc::NameTrait` which is supposed to work outside of heap snapshots as well.
We sometimes use this for debugging which would break now.
Michael LippautzOh, great point! I see now that HeapObjectHeader::GetName is called when formatting a message for a crash at [1], as well as a couple of other places.
A possible fix would be to change the contract of CopyNameForHeapSnapshot so that it returns nullptr if a heap snapshot is not in progress, and update this code to return Element::NameInHeapSnapshot in that case. Does that seem reasonable? (I added CopyNameForHeapSnapshot very recently, so I doubt any other embedders are depending on it yet.)
Seth BrenithCan you check the same condition already on the existing API?
`CopyNameForHeapSnapshot()` seems to have a rather strange contract otherwise in that you can call it at any time but it only will be reasonable if we are creating a snapshot.
Michael Lippautz`v8::internal::HeapProfiler` has a function `bool IsTakingSnapshot()`, but there isn't a corresponding function on the public API. Would it make sense for me to add one? Then embedders could easily tell whether it's safe to call `CopyNameForHeapSnapshot`.
Seems like a better fit than allowing the copy call to be always called?
Sounds good, thanks! I've updated the code here to check whether a snapshot is in progress.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. | Gerrit |
Code-Review | +1 |
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. | Gerrit |
Commit-Queue | +2 |
Thanks for reviewing, Michael!
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. | Gerrit |
Code-Review | +1 |
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. | Gerrit |
Add detail to names of HTML elements in heap snapshots
In heap snapshots, it can be difficult to see which HTMLElement
instances correspond to which elements. With this change, Blink will
provide a formatted start tag as the name which will be shown in the
heap snapshot.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. | Gerrit |