[Content Extensions] Use less memory for CombinedURLFilters.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Apr 2015 19:40:19 +0000 (19:40 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Apr 2015 19:40:19 +0000 (19:40 +0000)
commit6129d64d0ef49cedeb7de832cb8b290df26745ae
treec6d69beb3a0c8c3d47361eabb4abbca3e3328041
parente0860137ad3678c963b0b79ff8b0cf9e6ae2db0c
[Content Extensions] Use less memory for CombinedURLFilters.
https://bugs.webkit.org/show_bug.cgi?id=144290

Patch by Alex Christensen <achristensen@webkit.org> on 2015-04-28
Reviewed by Andreas Kling.

Source/WebCore:

* contentextensions/CombinedURLFilters.cpp:
(WebCore::ContentExtensions::recursiveMemoryUsed):
(WebCore::ContentExtensions::CombinedURLFilters::addPattern):
(WebCore::ContentExtensions::generateNFAForSubtree):
(WebCore::ContentExtensions::CombinedURLFilters::createNFAs):
* contentextensions/NFA.cpp:
(WebCore::ContentExtensions::NFA::memoryUsed):
(WebCore::ContentExtensions::NFA::setActions):
* contentextensions/NFA.h:
* contentextensions/NFANode.h:
* contentextensions/Term.h:
(WebCore::ContentExtensions::Term::Term::generateGraph):
(WebCore::ContentExtensions::Term::generateSubgraphForAtom):
Use Vectors instead of HashTables in PrefixTreeVertex because the sets stay small and need to be more memory efficient.

Source/WTF:

* wtf/Forward.h:
* wtf/Vector.h:
Added a minCapacity template parameter to allow changing the minimum size of an
allocated buffer. The default minCapacity is kept at 16 unless otherwise specified
to have no change on existing code, but this could be changed later. A smaller
default minCapacity would use less memory with small Vectors but spend more time
copying when expanding to large Vectors.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@183499 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WTF/ChangeLog
Source/WTF/wtf/Forward.h
Source/WTF/wtf/Vector.h
Source/WebCore/ChangeLog
Source/WebCore/contentextensions/CombinedURLFilters.cpp
Source/WebCore/contentextensions/NFA.cpp
Source/WebCore/contentextensions/NFA.h
Source/WebCore/contentextensions/NFANode.h
Source/WebCore/contentextensions/Term.h