Right now we keep several copies of all the data in memory at the same time. We only need one copy of one DFA's byte code alive at a time.
Created attachment 252343 [details] Patch
Comment on attachment 252343 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=252343&action=review > Source/WebKit2/UIProcess/API/APIUserContentExtensionStore.cpp:77 > +const size_t ContentExtensionFileHeaderSize = sizeof(uint32_t) + 2 * sizeof(uint64_t); Why do this instead of sizeof(ContentExtensionMetaData)? Because of alignment, I suspect the expression above will be wrong.
Comment on attachment 252343 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=252343&action=review >> Source/WebKit2/UIProcess/API/APIUserContentExtensionStore.cpp:77 >> +const size_t ContentExtensionFileHeaderSize = sizeof(uint32_t) + 2 * sizeof(uint64_t); > > Why do this instead of sizeof(ContentExtensionMetaData)? Because of alignment, I suspect the expression above will be wrong. When writing the header, we only want to write 20 bytes. Otherwise we would be writing uninitialized memory to file.
Created attachment 252355 [details] Patch
Comment on attachment 252355 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=252355&action=review > Source/WebKit2/UIProcess/API/APIUserContentExtensionStore.cpp:84 > static Data encodeContentExtensionMetaData(const ContentExtensionMetaData& metaData) I think you want to add this to the end of this function: ASSERT(encoder.bufferSize() == ContentExtensionFileHeaderSize); > Source/WebKit2/UIProcess/API/APIUserContentExtensionStore.cpp:218 > + memset(invalidHeader, 0xff, sizeof(invalidHeader)); We normally use capitalized hex, 0xFF, in WebKit code.
http://trac.webkit.org/changeset/183817