Skip to content

Commit

Permalink
Bug 1129249 - Expose the element id in Gecko profiler for Restyle. r=…
Browse files Browse the repository at this point in the history
…dholbert r=benwa
  • Loading branch information
rmottola committed Aug 5, 2019
1 parent bd35dba commit 77231d1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
17 changes: 14 additions & 3 deletions layout/base/RestyleManager.cpp
Expand Up @@ -3600,10 +3600,21 @@ ElementRestyler::ComputeStyleChangeFor(nsIFrame* aFrame,
nsTArray<nsRefPtr<nsStyleContext>>&
aSwappedStructOwners)
{
PROFILER_LABEL("ElementRestyler", "ComputeStyleChangeFor",
js::ProfileEntry::Category::CSS);

nsIContent* content = aFrame->GetContent();
nsAutoCString idStr;
if (profiler_is_active() && content) {
nsIAtom* id = content->GetID();
if (id) {
id->ToUTF8String(idStr);
} else {
idStr.AssignLiteral("?");
}
}

PROFILER_LABEL_PRINTF("ElementRestyler", "ComputeStyleChangeFor",
js::ProfileEntry::Category::CSS,
content ? "Element: %s" : "%s",
content ? idStr.get() : "");
if (aMinChange) {
aChangeList->AppendChange(aFrame, content, aMinChange);
}
Expand Down
3 changes: 3 additions & 0 deletions tools/profiler/TableTicker.h
Expand Up @@ -74,6 +74,7 @@ class TableTicker: public Sampler {
mTaskTracer = hasFeature(aFeatures, aFeatureCount, "tasktracer");
mLayersDump = hasFeature(aFeatures, aFeatureCount, "layersdump");
mDisplayListDump = hasFeature(aFeatures, aFeatureCount, "displaylistdump");
mProfileRestyle = hasFeature(aFeatures, aFeatureCount, "restyle");

#if defined(XP_WIN)
if (mProfilePower) {
Expand Down Expand Up @@ -207,6 +208,7 @@ class TableTicker: public Sampler {
bool TaskTracer() const { return mTaskTracer; }
bool LayersDump() const { return mLayersDump; }
bool DisplayListDump() const { return mDisplayListDump; }
bool ProfileRestyle() const { return mProfileRestyle; }

protected:
// Called within a signal. This function must be reentrant
Expand Down Expand Up @@ -234,6 +236,7 @@ class TableTicker: public Sampler {
bool mProfilePower;
bool mLayersDump;
bool mDisplayListDump;
bool mProfileRestyle;

// Keep the thread filter to check against new thread that
// are started while profiling
Expand Down

0 comments on commit 77231d1

Please sign in to comment.