Make Persistence::Encoder and Persistence::Decoder appropriate for in-memory encoding I'll be needed an in-memory only encoder/decoder in WebCore soon and these classes *almost* hit the mark. The reason they don't quite hit the mark is the SHA1 functionality with is expensive and unnecessary for bits we're not going to store on disk. I plan to split out a base class that skips the SHA1'ing but keeps all of the same great template infrastructure.
Retitle: Make the WTF Encoder/Decoders appropriate for in-memory encoding (Don't always do the SHA1 checksumming)
Created attachment 317889 [details] Patch
Attachment 317889 [details] did not pass style-queue: ERROR: Source/WTF/wtf/coding/Encoder.h:87: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WTF/wtf/coding/Encoder.h:88: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WTF/wtf/coding/Encoder.h:89: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WTF/wtf/coding/Encoder.h:90: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WTF/wtf/coding/Encoder.h:91: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WTF/wtf/coding/Encoder.h:92: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WTF/wtf/coding/Encoder.h:93: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WTF/wtf/coding/Encoder.h:94: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WTF/wtf/coding/Encoder.h:95: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WTF/wtf/coding/Encoder.h:96: More than one command on the same line [whitespace/newline] [4] Total errors found: 10 in 25 files If any of these errors are false positives, please file a bug against check-webkit-style.
I am not sure combining these is a good idea. The Persistence coders need to maintain the same binary format, whereas the in-memory coders are free to change. We've seen in the past cases where people were not aware that binary format was not stable for the WebKit2 coders, and were using it to write to the filesystem, and then when it changed, bad things happened. So, despite there being the desire to share code here, I think this is a rare instance where that might not be the right call.
Comment on attachment 317889 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=317889&action=review > Tools/TestWebKitAPI/Tests/WTF/Coding.cpp:62 > +// This should reliable capture a mistake where both encoders start doing the extra work of checksumming reliably
(In reply to Sam Weinig from comment #4) > I am not sure combining these is a good idea. The Persistence coders need to > maintain the same binary format, whereas the in-memory coders are free to > change. > > We've seen in the past cases where people were not aware that binary format > was not stable for the WebKit2 coders, and were using it to write to the > filesystem, and then when it changed, bad things happened. > > So, despite there being the desire to share code here, I think this is a > rare instance where that might not be the right call. This is a good point. I agree making it a general purpose coder increases the odds that somebody will unknowingly change the format. (And I noticed, sadly, that there are not any API tests to guarantee backwards compatibility...) We clearly need some WTF API tests for this reason. Additionally I wonder if there's some way in the code we could make it even less likely that somebody would unknowingly change the format? (But if we did have API test coverage, that would still be something that wouldn't last for long) I'll fork it.
Retitling: Rename the source files for the WTF persistent coders This will avoid conflicts from the upcoming non-persistent coders.
Created attachment 317900 [details] Patch
Attachment 317900 [details] did not pass style-queue: ERROR: Source/WTF/wtf/persistence/PersistentEncoder.h:94: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WTF/wtf/persistence/PersistentEncoder.h:95: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WTF/wtf/persistence/PersistentEncoder.h:96: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WTF/wtf/persistence/PersistentEncoder.h:97: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WTF/wtf/persistence/PersistentEncoder.h:98: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WTF/wtf/persistence/PersistentEncoder.h:99: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WTF/wtf/persistence/PersistentEncoder.h:100: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WTF/wtf/persistence/PersistentEncoder.h:101: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WTF/wtf/persistence/PersistentEncoder.h:102: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WTF/wtf/persistence/PersistentEncoder.h:103: More than one command on the same line [whitespace/newline] [4] Total errors found: 10 in 17 files If any of these errors are false positives, please file a bug against check-webkit-style.
Comment on attachment 317900 [details] Patch Clearing flags on attachment: 317900 Committed r220574: <http://trac.webkit.org/changeset/220574>
All reviewed patches have been landed. Closing bug.
<rdar://problem/33841949>