[webkit-reviews] review granted: [Bug 120385] Simplify and clean SpaceSplitString : [Attachment 209824] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Aug 27 18:06:33 PDT 2013


Ryosuke Niwa <rniwa at webkit.org> has granted Benjamin Poulain
<benjamin at webkit.org>'s request for review:
Bug 120385: Simplify and clean SpaceSplitString
https://bugs.webkit.org/show_bug.cgi?id=120385

Attachment 209824: Patch
https://bugs.webkit.org/attachment.cgi?id=209824&action=review

------- Additional Comments from Ryosuke Niwa <rniwa at webkit.org>
View in context: https://bugs.webkit.org/attachment.cgi?id=209824&action=review


> Source/WebCore/dom/SpaceSplitString.cpp:32
> +COMPILE_ASSERT(!(sizeof(SpaceSplitStringData) % sizeof(void*)),
SpaceSplitStringDataTailIsAlignedToWordSize);

sizeof(uint_ptr)

> Source/WebCore/dom/SpaceSplitString.cpp:93
> +    unsigned otherSize = other.m_size;

Maybe we should assert that other.m_size is non-zero?

> Source/WebCore/dom/SpaceSplitString.cpp:97
> +	   const AtomicString& name = other[i];
> +	   if (!contains(name))

No need for the temporary.

> Source/WebCore/dom/SpaceSplitString.cpp:106
> +    static const unsigned typicalNumberOfSpaceSplitString = 100;

Maybe we should comment how you got this number.

> Source/WebCore/dom/SpaceSplitString.cpp:173
> +class TokenCounterProcessor {
> +public:
> +    TokenCounterProcessor() : m_tokenCount(0) { }

Maybe it's better to call this TokenCounter?  That way, counter will stand out.


> Source/WebCore/dom/SpaceSplitString.cpp:188
> +class TokenInitializerProcessor {

TokenAtomicStringInitializer?

> Source/WebCore/dom/SpaceSplitString.cpp:235
> +    new (NotNull, spaceSplitStringData) SpaceSplitStringData(keyString,
tokenCount);
> +    AtomicString* tokenArrayStart = spaceSplitStringData->tokenArrayStart();

> +    TokenInitializerProcessor tokenInitializer(tokenArrayStart);
> +    tokenizeSpaceSplitString(tokenInitializer, keyString);
> +    ASSERT(tokenInitializer.nextMemoryBucket() - tokenArrayStart ==
tokenCount);
> +    ASSERT(reinterpret_cast<const
char*>(tokenInitializer.nextMemoryBucket()) == (reinterpret_cast<const
char*>(spaceSplitStringData) + sizeToAllocate));

Maybe we should extract this part as a function?


More information about the webkit-reviews mailing list