• Devlin Cronin's avatar
    [JSON Schema Compiler] Add support for serializable functions · 350b8a72
    Devlin Cronin authored
    Add support for a new property on function types, serializableFunction.
    
    IDL Example:
    callback SerializableFunction = void();
    dictionary SerializableFunctionObject {
      [serializableFunction]SerializableFunction func;
    };
    
    JSON Example:
    {
      "type": "object",
      "id": "SerializableFunctionObject",
      "properties": {
        "func": {
          "name": "func",
          "serializableFunction": true,
          "type": "function",
          "parameters": []
        }
      }
    }
    
    If this trait is present, functions will be serialized and deserialized
    as strings, rather than as empty base::DictionaryValues.
    
    Add testing for the same.
    
    Note: this only provides support in the JSON schema compiler (which
    includes support in our auto-generated strong-typing code); a follow-up
    will add support in our bindings code for parsing the values passed
    from extensions.
    
    Bug: 1144841
    Change-Id: I430fb211166a5ccffaa6b478642e98115fd25565
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2518717
    Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
    Reviewed-by: default avatarKaran Bhatia <karandeepb@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#825727}
    350b8a72
model.py 27.3 KB