Coverage Report

Created: 2026-12-01 07:00

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/proc/self/cwd/cpp/htmlparser/document.cc
Line
Count
Source
1
#include "absl/flags/flag.h"
2
#include "cpp/htmlparser/document.h"
3
4
ABSL_FLAG(std::size_t, htmlparser_nodes_allocator_block_size,
5
          256 << 10 /* 256k */,
6
          "Allocator block size for html nodes.");
7
8
namespace htmlparser {
9
10
Document::Document() :
11
12.6k
    node_allocator_(new Allocator<Node>(
12
12.6k
        ::absl::GetFlag(FLAGS_htmlparser_nodes_allocator_block_size))),
13
12.6k
    root_node_(NewNode(NodeType::DOCUMENT_NODE)) {}
14
15
22.3M
Node* Document::NewNode(NodeType node_type, Atom atom) {
16
22.3M
  return node_allocator_->Construct(node_type, atom);
17
22.3M
}
18
19
3.40M
Node* Document::CloneNode(const Node* from) {
20
3.40M
  Node* clone = NewNode(from->Type());
21
3.40M
  clone->atom_ = from->atom_;
22
3.40M
  clone->data_ = from->data_;
23
3.40M
  clone->attributes_.reserve(from->Attributes().size());
24
3.40M
  std::copy(from->Attributes().begin(), from->Attributes().end(),
25
3.40M
            std::back_inserter(clone->attributes_));
26
3.40M
  return clone;
27
3.40M
}
28
29
}  // namespace htmlparser