summaryrefslogtreecommitdiff
path: root/chromium/third_party/inspector_protocol
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-01-31 16:33:43 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-02-06 16:33:22 +0000
commitda51f56cc21233c2d30f0fe0d171727c3102b2e0 (patch)
tree4e579ab70ce4b19bee7984237f3ce05a96d59d83 /chromium/third_party/inspector_protocol
parentc8c2d1901aec01e934adf561a9fdf0cc776cdef8 (diff)
downloadqtwebengine-chromium-da51f56cc21233c2d30f0fe0d171727c3102b2e0.tar.gz
BASELINE: Update Chromium to 65.0.3525.40
Also imports missing submodules Change-Id: I36901b7c6a325cda3d2c10cedb2186c25af3b79b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/third_party/inspector_protocol')
-rw-r--r--chromium/third_party/inspector_protocol/ConvertProtocolToJSON.py183
-rw-r--r--chromium/third_party/inspector_protocol/README.chromium2
-rw-r--r--chromium/third_party/inspector_protocol/templates/TypeBuilder_h.template6
3 files changed, 185 insertions, 6 deletions
diff --git a/chromium/third_party/inspector_protocol/ConvertProtocolToJSON.py b/chromium/third_party/inspector_protocol/ConvertProtocolToJSON.py
new file mode 100644
index 00000000000..56fc09d78cb
--- /dev/null
+++ b/chromium/third_party/inspector_protocol/ConvertProtocolToJSON.py
@@ -0,0 +1,183 @@
+# Copyright 2017 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import collections
+import json
+import os.path
+import re
+import sys
+
+file_name = None
+description = ''
+
+primitiveTypes = ['integer', 'number', 'boolean', 'string', 'object', 'any', 'array']
+
+
+def assignType(item, type, isArray=False):
+ if isArray:
+ item['type'] = 'array'
+ item['items'] = collections.OrderedDict()
+ assignType(item['items'], type)
+ return
+
+ if type == 'enum':
+ type = 'string'
+ if type in primitiveTypes:
+ item['type'] = type
+ else:
+ item['$ref'] = type
+
+
+def createItem(d, experimental, deprecated, name=None):
+ result = collections.OrderedDict(d)
+ if name:
+ result['name'] = name
+ global description
+ if description:
+ result['description'] = description.strip()
+ if experimental:
+ result['experimental'] = True
+ if deprecated:
+ result['deprecated'] = True
+ return result
+
+
+def parse(data):
+ protocol = collections.OrderedDict()
+ protocol['version'] = collections.OrderedDict()
+ protocol['domains'] = []
+ domain = None
+ item = None
+ subitems = None
+ nukeDescription = False
+ global description
+ lines = data.split('\n')
+ for i in range(0, len(lines)):
+ if nukeDescription:
+ description = ''
+ nukeDescription = False
+ line = lines[i]
+ trimLine = line.strip()
+
+ if trimLine.startswith('#'):
+ if len(description):
+ description += '\n'
+ description += trimLine[2:]
+ continue
+ else:
+ nukeDescription = True
+
+ if len(trimLine) == 0:
+ continue
+
+ match = re.compile('^(experimental )?(deprecated )?domain (.*)').match(line)
+ if match:
+ domain = createItem({'domain' : match.group(3)}, match.group(1), match.group(2))
+ protocol['domains'].append(domain)
+ continue
+
+ match = re.compile('^ depends on ([^\s]+)').match(line)
+ if match:
+ if 'dependencies' not in domain:
+ domain['dependencies'] = []
+ domain['dependencies'].append(match.group(1))
+ continue
+
+ match = re.compile('^ (experimental )?(deprecated )?type (.*) extends (array of )?([^\s]+)').match(line)
+ if match:
+ if 'types' not in domain:
+ domain['types'] = []
+ item = createItem({'id': match.group(3)}, match.group(1), match.group(2))
+ assignType(item, match.group(5), match.group(4))
+ domain['types'].append(item)
+ continue
+
+ match = re.compile('^ (experimental )?(deprecated )?(command|event) (.*)').match(line)
+ if match:
+ list = []
+ if match.group(3) == 'command':
+ if 'commands' in domain:
+ list = domain['commands']
+ else:
+ list = domain['commands'] = []
+ else:
+ if 'events' in domain:
+ list = domain['events']
+ else:
+ list = domain['events'] = []
+
+ item = createItem({}, match.group(1), match.group(2), match.group(4))
+ list.append(item)
+ continue
+
+ match = re.compile('^ (experimental )?(deprecated )?(optional )?(array of )?([^\s]+) ([^\s]+)').match(line)
+ if match:
+ param = createItem({}, match.group(1), match.group(2), match.group(6))
+ if match.group(3):
+ param['optional'] = True
+ assignType(param, match.group(5), match.group(4))
+ if match.group(5) == 'enum':
+ enumliterals = param['enum'] = []
+ subitems.append(param)
+ continue
+
+ match = re.compile('^ (parameters|returns|properties)').match(line)
+ if match:
+ subitems = item[match.group(1)] = []
+ continue
+
+ match = re.compile('^ enum').match(line)
+ if match:
+ enumliterals = item['enum'] = []
+ continue
+
+ match = re.compile('^version').match(line)
+ if match:
+ continue
+
+ match = re.compile('^ major (\d+)').match(line)
+ if match:
+ protocol['version']['major'] = match.group(1)
+ continue
+
+ match = re.compile('^ minor (\d+)').match(line)
+ if match:
+ protocol['version']['minor'] = match.group(1)
+ continue
+
+ match = re.compile('^ redirect ([^\s]+)').match(line)
+ if match:
+ item['redirect'] = match.group(1)
+ continue
+
+ match = re.compile('^ ( )?[^\s]+$').match(line)
+ if match:
+ # enum literal
+ enumliterals.append(trimLine)
+ continue
+
+ print 'Error in %s:%s, illegal token: \t%s' % (file_name, i, line)
+ sys.exit(1)
+ return protocol
+
+def main(argv):
+ if len(argv) < 2:
+ sys.stderr.write("Usage: %s <protocol.pdl> <protocol.json>\n" % sys.argv[0])
+ return 1
+ global file_name
+ file_name = os.path.normpath(argv[0])
+ input_file = open(file_name, "r")
+ pdl_string = input_file.read()
+ protocol = parse(pdl_string)
+ output_file = open(argv[0].replace('.pdl', '.json'), 'wb')
+ json.dump(protocol, output_file, indent=4, separators=(',', ': '))
+ output_file.close()
+
+ output_file = open(os.path.normpath(argv[1]), 'wb')
+ json.dump(protocol, output_file, indent=4, separators=(',', ': '))
+ output_file.close()
+
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv[1:]))
diff --git a/chromium/third_party/inspector_protocol/README.chromium b/chromium/third_party/inspector_protocol/README.chromium
index 4c6545f91f6..537cac6fac0 100644
--- a/chromium/third_party/inspector_protocol/README.chromium
+++ b/chromium/third_party/inspector_protocol/README.chromium
@@ -2,7 +2,7 @@ Name: inspector protocol
Short Name: inspector_protocol
URL: https://chromium.googlesource.com/deps/inspector_protocol/
Version: 0
-Revision: 65caa48c1d301e35f60b94ae770b0c68c34960d4
+Revision: 752d4abd13119010cf30e454e8ef9b5fb7ef43a3
License: BSD
License File: LICENSE
Security Critical: no
diff --git a/chromium/third_party/inspector_protocol/templates/TypeBuilder_h.template b/chromium/third_party/inspector_protocol/templates/TypeBuilder_h.template
index 00e916a43b4..744d496026a 100644
--- a/chromium/third_party/inspector_protocol/templates/TypeBuilder_h.template
+++ b/chromium/third_party/inspector_protocol/templates/TypeBuilder_h.template
@@ -32,14 +32,11 @@ namespace {{domain.domain}} {
{% if not protocol.generate_type(domain.domain, type.id) %}{% continue %}{% endif %}
{% if type.type == "object" %}
{% if "properties" in type %}
-// {{type.description}}
class {{type.id}};
{% else %}
-// {{type.description}}
using {{type.id}} = Object;
{% endif %}
{% elif type.type != "array" %}
-// {{type.description}}
using {{type.id}} = {{protocol.resolve_type(type).type}};
{% endif %}
{% endfor %}
@@ -74,7 +71,6 @@ namespace {{param.name | to_title_case}}Enum {
{% if not protocol.generate_type(domain.domain, type.id) %}{% continue %}{% endif %}
{% if not (type.type == "object") or not ("properties" in type) %}{% continue %}{% endif %}
-// {{type.description}}
class {{config.protocol.export_macro}} {{type.id}} : public Serializable{% if protocol.is_exported(domain.domain, type.id) %}, public API::{{type.id}}{% endif %}{
PROTOCOL_DISALLOW_COPY({{type.id}});
public:
@@ -116,7 +112,7 @@ public:
enum {
NoFieldsSet = 0,
{% for property in type.properties|rejectattr("optional") %}
- {{property.name | to_title_case}}Set = 1 << {{loop.index}},
+ {{property.name | to_title_case}}Set = 1 << {{loop.index}},
{% endfor %}
AllFieldsSet = (
{%- for property in type.properties %}