[webkit-reviews] review granted: [Bug 189775] Improve node statistics for rare data : [Attachment 350167] Improved the logging

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Sep 19 21:08:16 PDT 2018


Simon Fraser (smfr) <simon.fraser at apple.com> has granted Ryosuke Niwa
<rniwa at webkit.org>'s request for review:
Bug 189775: Improve node statistics for rare data
https://bugs.webkit.org/show_bug.cgi?id=189775

Attachment 350167: Improved the logging

https://bugs.webkit.org/attachment.cgi?id=350167&action=review




--- Comment #2 from Simon Fraser (smfr) <simon.fraser at apple.com> ---
Comment on attachment 350167
  --> https://bugs.webkit.org/attachment.cgi?id=350167
Improved the logging

View in context: https://bugs.webkit.org/attachment.cgi?id=350167&action=review

> Source/WebCore/dom/Node.cpp:130
> +static const char* stringForRareDataUseType(NodeRareData::UseType useType)
> +{
> +    switch (useType) {
> +    case NodeRareData::UseType::ConnectedFrameCount:
> +	   return "ConnectedFrameCount";
> +    case NodeRareData::UseType::NodeList:
> +	   return "NodeList";
> +    case NodeRareData::UseType::MutationObserver:
> +	   return "MutationObserver";
> +    case NodeRareData::UseType::TabIndex:
> +	   return "TabIndex";
> +    case NodeRareData::UseType::StyleFlags:
> +	   return "StyleFlags";
> +    case NodeRareData::UseType::MinimumSize:
> +	   return "MinimumSize";
> +    case NodeRareData::UseType::ScrollingPosition:
> +	   return "ScrollingPosition";
> +    case NodeRareData::UseType::ComputedStyle:
> +	   return "ComputedStyle";
> +    case NodeRareData::UseType::Dataset:
> +	   return "Dataset";
> +    case NodeRareData::UseType::ClassList:
> +	   return "ClassList";
> +    case NodeRareData::UseType::ShadowRoot:
> +	   return "ShadowRoot";
> +    case NodeRareData::UseType::CustomElementQueue:
> +	   return "CustomElementQueue";
> +    case NodeRareData::UseType::AttributeMap:
> +	   return "AttributeMap";
> +    case NodeRareData::UseType::InteractionObserver:
> +	   return "InteractionObserver";
> +    case NodeRareData::UseType::PseudoElements:
> +	   return "PseudoElements";
> +    }
> +    return nullptr;
> +}

It would be nicer to implement TextStream& operator<<(TextStream& ts,
NodeRareData::UseType) and do the outputting by building a TextStream. Then we
can use that for log streams as well.

> Source/WebCore/dom/Node.cpp:175
> +	       for (auto type : useTypes) {
> +		   UNUSED_PARAM(type);
> +		   useTypeCount++;
> +	       }

Why not implement OptionSet::numberOfBitsSet() with one of the classic
bit-counting algorithms?


More information about the webkit-reviews mailing list