Introduce concept of fragments
The LogBuffer had some surprising behavior: // This would DCHECK; LogBuffer buf1; buf1 << "Foo" << Tag{"div"}; // This would create two nested divs instead of a sequence of two divs: LogBuffer buf2; buf1 << Tag{"div"} << CTag{} << Tag{"div"} << CTag{}; This CL fixes these problems by introducing fragments - the equivalent to the DOM DocumentFragment. The root of each LogBuffer is now a fragment that can host an arbitrary number of children of type text and element. Some optimizations occur: A LogBuffer with a single child in the fragment will return this child when LogBuffer::RetrieveResult() is called. Similarly, streaming a LogBuffer into another one will inline the children of the first into the second instead of appendin the fragment. Due to these optimizations, the JavaScript handler in the WebUI can be sure that only the outer most Node is a fragment. Bug: 928595 Change-Id: I0eed2f1e900a5aca9511c771d18ee1e264a503e7 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1724674 Commit-Queue: Dominic Battré <battre@chromium.org> Reviewed-by:Jan Wilken Dörrie <jdoerrie@chromium.org> Cr-Commit-Position: refs/heads/master@{#682336}
Showing
Please register or sign in to comment