Bug 186410 - Implement KeyedDecoderGeneric and KeyedEncoderGeneric
Summary: Implement KeyedDecoderGeneric and KeyedEncoderGeneric
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Fujii Hironori
URL:
Keywords: InRadar
Depends on:
Blocks: 175336
  Show dependency treegraph
 
Reported: 2018-06-07 14:41 PDT by Don Olmstead
Modified: 2019-04-18 21:28 PDT (History)
6 users (show)

See Also:


Attachments
WIP patch (18.20 KB, patch)
2019-04-17 01:15 PDT, Fujii Hironori
no flags Details | Formatted Diff | Diff
Patch (19.99 KB, patch)
2019-04-17 02:52 PDT, Fujii Hironori
no flags Details | Formatted Diff | Diff
Patch (20.00 KB, patch)
2019-04-17 02:53 PDT, Fujii Hironori
don.olmstead: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Don Olmstead 2018-06-07 14:41:22 PDT
Currently there is a glib and CoreFoundation implementation of KeyedEncoder and KeyedDecoder. There should be a generic implementation of this available for platforms not using glib and CoreFoundation.
Comment 1 Fujii Hironori 2019-03-27 20:50:52 PDT
It seems that WebCore/platform/generic/KeyedDecoderGeneric.cpp can be implemented by using wtf/persistence/PersistentDecoder.h.
Comment 2 Fujii Hironori 2019-04-17 01:15:07 PDT
Created attachment 367619 [details]
WIP patch
Comment 3 Fujii Hironori 2019-04-17 02:52:03 PDT
Created attachment 367621 [details]
Patch
Comment 4 Fujii Hironori 2019-04-17 02:53:57 PDT
Created attachment 367622 [details]
Patch
Comment 5 Alex Christensen 2019-04-17 09:29:39 PDT
Comment on attachment 367622 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=367622&action=review

> Source/WebCore/platform/generic/KeyedEncoderGeneric.h:56
> +        BeginObject,
> +        EndObject,
> +        BeginArray,
> +        BeginArrayElement,
> +        EndArrayElement,
> +        EndArray,

We actually only need Object and Array here, but removing the others would require changing the CF version.  Maybe we should just update both versions in the future.  Then we could use recursion instead of having our own stacks, too.  What do you think?
Comment 6 Fujii Hironori 2019-04-17 20:25:41 PDT
(In reply to Alex Christensen from comment #5)
> We actually only need Object and Array here, but removing the others would
> require changing the CF version.  Maybe we should just update both versions
> in the future.  Then we could use recursion instead of having our own
> stacks, too.  What do you think?

I agreed on your opinion. KeyedDecoder interface is badly designed.
We can take two approaches in this case, SAX approach and DOM approach.

In DOM approach, KeyedDecoder should have a iterator which indicates the current node.
In SAX approach, KeyedDecoder should only have event driven callbacks.

Anyway, we need to rewrite all clients in order to do the refactoring.

* IDBKeyData::decode
* deserializeIDBKeyPath in IDBSerialization.cpp
* ResourceLoadStatistics::decode

I guess those tasks are not so easy.

Regarding having own stack, I'm not sure how we shoud do.
Because I observes stack overflow in the 2500-level nested array
in storage/indexeddb/key-type-array.html in WinCairo port.
Comment 7 Fujii Hironori 2019-04-18 21:28:01 PDT
Committed r244450: <https://trac.webkit.org/changeset/244450>
Comment 8 Radar WebKit Bug Importer 2019-04-18 21:28:19 PDT
<rdar://problem/50039501>