Commit a42a629f authored by Alexey Kozyatinskiy's avatar Alexey Kozyatinskiy Committed by Commit Bot

Roll third_party/inspector_protocol to 4d389ba

This roll includes:
  - [inspector_protocol] first class citizien .pdl support

+ migrated cros_protocol.json to .pdl

TBR=dgozman@chromium.org,dpranke@chromium.org,pfeldman@chromium.org
NOPRESUBMIT=true
Bug:none

Change-Id: I0fff1582bd41115e2aa348008c7a5d48f5c59a7e
Reviewed-on: https://chromium-review.googlesource.com/1014468
Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Reviewed-by: default avatarDirk Pranke <dpranke@chromium.org>
Reviewed-by: default avatarAleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Reviewed-by: default avatarPavel Feldman <pfeldman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#551382}
parent eadf8dce
...@@ -582,6 +582,7 @@ _KNOWN_INVALID_JSON_FILE_PATTERNS = [ ...@@ -582,6 +582,7 @@ _KNOWN_INVALID_JSON_FILE_PATTERNS = [
r'^components[\\\/]policy[\\\/]resources[\\\/]policy_templates\.json$', r'^components[\\\/]policy[\\\/]resources[\\\/]policy_templates\.json$',
r'^third_party[\\\/]protobuf[\\\/]', r'^third_party[\\\/]protobuf[\\\/]',
r'^third_party[\\\/]WebKit[\\\/]LayoutTests[\\\/]external[\\\/]wpt[\\\/]', r'^third_party[\\\/]WebKit[\\\/]LayoutTests[\\\/]external[\\\/]wpt[\\\/]',
r'^third_party[\\\/]blink[\\\/]renderer[\\\/]devtools[\\\/]protocol\.json$',
] ]
......
...@@ -36,7 +36,7 @@ if (!is_android) { ...@@ -36,7 +36,7 @@ if (!is_android) {
_concatenated_protocol_path = _concatenated_protocol_path =
"$root_gen_dir/chrome/browser/devtools/protocol.json" "$root_gen_dir/chrome/browser/devtools/protocol.json"
action("concatenate_protocols") { action("concatenate_protocols") {
script = _inspector_protocol + "/ConcatenateProtocols.py" script = _inspector_protocol + "/concatenate_protocols.py"
deps = [ deps = [
"//third_party/blink/renderer/core/inspector:protocol_version", "//third_party/blink/renderer/core/inspector:protocol_version",
...@@ -54,8 +54,8 @@ if (!is_android) { ...@@ -54,8 +54,8 @@ if (!is_android) {
args = [ rebase_path(_blink_protocol_path, root_build_dir) ] args = [ rebase_path(_blink_protocol_path, root_build_dir) ]
if (is_chromeos) { if (is_chromeos) {
inputs += [ "cros_protocol.json" ] inputs += [ "cros_protocol.pdl" ]
args += [ rebase_path("cros_protocol.json", root_build_dir) ] args += [ rebase_path("cros_protocol.pdl", root_build_dir) ]
} }
args += [ rebase_path(output_file, root_build_dir) ] args += [ rebase_path(output_file, root_build_dir) ]
......
{
"domains": [
{
"domain": "WindowManager",
"commands": [
{
"name": "enterOverviewMode",
"description": "Enter the overview mode."
},
{
"name": "exitOverviewMode",
"description": "Exit the overview mode."
}
]
}
],
"version": {
"major": "1",
"minor": "0"
}
}
# Copyright 2018 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.
version
major 1
minor 0
domain WindowManager
# Enter the overview mode.
command enterOverviewMode
# Exit the overview mode.
command exitOverviewMode
...@@ -19,7 +19,7 @@ _protocol_generated = [ ...@@ -19,7 +19,7 @@ _protocol_generated = [
action("protocol_compatibility") { action("protocol_compatibility") {
visibility = [ ":*" ] # Only targets in this file can depend on this. visibility = [ ":*" ] # Only targets in this file can depend on this.
script = "$_inspector_protocol/CheckProtocolCompatibility.py" script = "$_inspector_protocol/check_protocol_compatibility.py"
inputs = [ inputs = [
"protocol.json", "protocol.json",
] ]
......
...@@ -115,7 +115,7 @@ inspector_protocol_generate("protocol_sources") { ...@@ -115,7 +115,7 @@ inspector_protocol_generate("protocol_sources") {
config_values = [ "imported.path=$_imported" ] config_values = [ "imported.path=$_imported" ]
inputs = [ inputs = [
"$blink_core_output_dir/inspector/browser_protocol.json", "browser_protocol.pdl",
v8_inspector_js_protocol, v8_inspector_js_protocol,
"inspector_protocol_config.json", "inspector_protocol_config.json",
] ]
...@@ -180,7 +180,6 @@ inspector_protocol_generate("protocol_sources") { ...@@ -180,7 +180,6 @@ inspector_protocol_generate("protocol_sources") {
] ]
deps = [ deps = [
":protocol_convert_to_json",
":protocol_version", ":protocol_version",
] ]
} }
...@@ -211,29 +210,11 @@ jumbo_source_set("generated") { ...@@ -211,29 +210,11 @@ jumbo_source_set("generated") {
] ]
} }
action("protocol_convert_to_json") {
script = _inspector_protocol_dir + "/ConvertProtocolToJSON.py"
inputs = [
"browser_protocol.pdl",
]
output_file = "$blink_core_output_dir/inspector/browser_protocol.json"
outputs = [
output_file,
]
args = [
rebase_path("browser_protocol.pdl", root_build_dir),
rebase_path(output_file, root_build_dir),
]
}
action("protocol_compatibility_check") { action("protocol_compatibility_check") {
script = _inspector_protocol_dir + "/CheckProtocolCompatibility.py" script = _inspector_protocol_dir + "/check_protocol_compatibility.py"
deps = [
":protocol_convert_to_json",
]
inputs = [ inputs = [
"$blink_core_output_dir/inspector/browser_protocol.json", "browser_protocol.pdl",
"browser_protocol-1.3.json", "browser_protocol-1.3.json",
v8_inspector_js_protocol, v8_inspector_js_protocol,
] ]
...@@ -245,8 +226,7 @@ action("protocol_compatibility_check") { ...@@ -245,8 +226,7 @@ action("protocol_compatibility_check") {
args = [ args = [
"--stamp", "--stamp",
rebase_path(_stamp, root_build_dir), rebase_path(_stamp, root_build_dir),
rebase_path("$blink_core_output_dir/inspector/browser_protocol.json", rebase_path("browser_protocol.pdl", root_build_dir),
root_build_dir),
rebase_path(v8_inspector_js_protocol, root_build_dir), rebase_path(v8_inspector_js_protocol, root_build_dir),
] ]
} }
...@@ -254,12 +234,11 @@ action("protocol_compatibility_check") { ...@@ -254,12 +234,11 @@ action("protocol_compatibility_check") {
action("protocol_version") { action("protocol_version") {
deps = [ deps = [
":protocol_compatibility_check", ":protocol_compatibility_check",
":protocol_convert_to_json",
] ]
script = _inspector_protocol_dir + "/ConcatenateProtocols.py" script = _inspector_protocol_dir + "/concatenate_protocols.py"
inputs = [ inputs = [
"$blink_core_output_dir/inspector/browser_protocol.json", "browser_protocol.pdl",
v8_inspector_js_protocol, v8_inspector_js_protocol,
] ]
output_file = "$blink_core_output_dir/inspector/protocol.json" output_file = "$blink_core_output_dir/inspector/protocol.json"
...@@ -268,8 +247,7 @@ action("protocol_version") { ...@@ -268,8 +247,7 @@ action("protocol_version") {
] ]
args = [ args = [
rebase_path("$blink_core_output_dir/inspector/browser_protocol.json", rebase_path("browser_protocol.pdl", root_build_dir),
root_build_dir),
rebase_path(v8_inspector_js_protocol, root_build_dir), rebase_path(v8_inspector_js_protocol, root_build_dir),
rebase_path(output_file, root_build_dir), rebase_path(output_file, root_build_dir),
] ]
......
...@@ -5,9 +5,6 @@ pfeldman@chromium.org ...@@ -5,9 +5,6 @@ pfeldman@chromium.org
# Changes to remote debugging protocol require devtools review to # Changes to remote debugging protocol require devtools review to
# ensure backwards compatibility and committment to maintain. # ensure backwards compatibility and committment to maintain.
per-file browser_protocol.json=set noparent
per-file browser_protocol.json=dgozman@chromium.org
per-file browser_protocol.json=pfeldman@chromium.org
per-file browser_protocol.pdl=set noparent per-file browser_protocol.pdl=set noparent
per-file browser_protocol.pdl=dgozman@chromium.org per-file browser_protocol.pdl=dgozman@chromium.org
per-file browser_protocol.pdl=pfeldman@chromium.org per-file browser_protocol.pdl=pfeldman@chromium.org
......
...@@ -11,7 +11,7 @@ def _CompileDevtoolsFrontend(input_api, output_api): ...@@ -11,7 +11,7 @@ def _CompileDevtoolsFrontend(input_api, output_api):
# If a devtools file is changed, the PRESUBMIT hook in Source/devtools # If a devtools file is changed, the PRESUBMIT hook in Source/devtools
# will run closure compiler # will run closure compiler
if (any("browser_protocol.json" in path for path in local_paths) and if (any("browser_protocol.pdl" in path for path in local_paths) and
all(devtools not in path for path in local_paths)): all(devtools not in path for path in local_paths)):
compile_path = input_api.os_path.join( compile_path = input_api.os_path.join(
input_api.PresubmitLocalPath(), "..", "..", "devtools", "scripts", "compile_frontend.py") input_api.PresubmitLocalPath(), "..", "..", "devtools", "scripts", "compile_frontend.py")
......
{ {
"protocol": { "protocol": {
"path": "browser_protocol.json", "path": "browser_protocol.pdl",
"package": "core/inspector/protocol", "package": "core/inspector/protocol",
"output": "inspector/protocol", "output": "inspector/protocol",
"namespace": ["blink", "protocol"], "namespace": ["blink", "protocol"],
......
...@@ -1279,8 +1279,9 @@ group("devtools_closure_compile") { ...@@ -1279,8 +1279,9 @@ group("devtools_closure_compile") {
"//testing/scripts/common.py", "//testing/scripts/common.py",
"//testing/scripts/run_devtools_check.py", "//testing/scripts/run_devtools_check.py",
"//testing/xvfb.py", "//testing/xvfb.py",
"//third_party/blink/renderer/core/inspector/browser_protocol.json", "//third_party/blink/renderer/core/inspector/browser_protocol.pdl",
"//v8/src/inspector/js_protocol.json", "//third_party/inspector_protocol/pdl.py",
"//v8/src/inspector/js_protocol.pdl",
] ]
} }
......
The protocol.json has split into separate files. https://crbug.com/580337 The protocol.json has split into separate files. https://crbug.com/580337
One for the browser, one for a V8 javascript environment: One for the browser, one for a V8 javascript environment:
src/third_party/blink/renderer/core/inspector/browser_protocol.json src/third_party/blink/renderer/core/inspector/browser_protocol.pdl
src/v8/src/inspector/js_protocol.json src/v8/src/inspector/js_protocol.pdl
Browsable here: Browsable here:
https://chromium.googlesource.com/chromium/src/+/master/third_party/blink/renderer/core/inspector/browser_protocol.json https://chromium.googlesource.com/chromium/src/+/master/third_party/blink/renderer/core/inspector/browser_protocol.pdl
https://chromium.googlesource.com/v8/v8/+/master/src/inspector/js_protocol.json https://chromium.googlesource.com/v8/v8/+/master/src/inspector/js_protocol.pdl
More details on the protocol: More details on the protocol:
https://developer.chrome.com/devtools/docs/debugger-protocol https://developer.chrome.com/devtools/docs/debugger-protocol
...@@ -28,12 +28,21 @@ ...@@ -28,12 +28,21 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import os import os
import os.path as path
import re import re
import sys
try: try:
import json import json
except ImportError: except ImportError:
import simplejson as json import simplejson as json
sys.path.append(
path.normpath(
path.join(
path.dirname(path.abspath(__file__)),
os.pardir, os.pardir, os.pardir, os.pardir, os.pardir, 'inspector_protocol')))
import pdl # pylint: disable=F0401
type_traits = { type_traits = {
"any": "*", "any": "*",
"string": "string", "string": "string",
...@@ -97,8 +106,8 @@ def param_name(param): ...@@ -97,8 +106,8 @@ def param_name(param):
def load_schema(file, domains): def load_schema(file, domains):
input_file = open(file, "r") input_file = open(file, "r")
json_string = input_file.read() parsed_json = pdl.loads(input_file.read(), file)
parsed_json = json.loads(json_string) input_file.close()
domains.extend(parsed_json["domains"]) domains.extend(parsed_json["domains"])
......
...@@ -334,8 +334,8 @@ def main(): ...@@ -334,8 +334,8 @@ def main():
protocol_externs_file = args.protocol_externs_file protocol_externs_file = args.protocol_externs_file
else: else:
generate_protocol_externs.generate_protocol_externs(protocol_externs_file, generate_protocol_externs.generate_protocol_externs(protocol_externs_file,
path.join(inspector_path, 'browser_protocol.json'), path.join(inspector_path, 'browser_protocol.pdl'),
path.join(v8_inspector_path, 'js_protocol.json')) path.join(v8_inspector_path, 'js_protocol.pdl'))
loader = modular_build.DescriptorLoader(devtools_frontend_path) loader = modular_build.DescriptorLoader(devtools_frontend_path)
descriptors = loader.load_applications(application_descriptors) descriptors = loader.load_applications(application_descriptors)
modules_by_name = descriptors.modules modules_by_name = descriptors.modules
......
...@@ -191,6 +191,7 @@ _PNG_FILE_EXTENSION = 'png' ...@@ -191,6 +191,7 @@ _PNG_FILE_EXTENSION = 'png'
# with FileType.NONE are automatically skipped without warning. # with FileType.NONE are automatically skipped without warning.
_SKIPPED_FILES_WITHOUT_WARNING = [ _SKIPPED_FILES_WITHOUT_WARNING = [
'LayoutTests' + os.path.sep, 'LayoutTests' + os.path.sep,
'third_party' + os.path.sep + 'blink' + os.path.sep + 'renderer' + os.path.sep + 'devtools' + os.path.sep + 'protocol.json',
] ]
# Extensions of files which are allowed to contain carriage returns. # Extensions of files which are allowed to contain carriage returns.
......
...@@ -2,7 +2,7 @@ Name: inspector protocol ...@@ -2,7 +2,7 @@ Name: inspector protocol
Short Name: inspector_protocol Short Name: inspector_protocol
URL: https://chromium.googlesource.com/deps/inspector_protocol/ URL: https://chromium.googlesource.com/deps/inspector_protocol/
Version: 0 Version: 0
Revision: e4f23bda98c295d09d3c19274b8000151e869be3 Revision: 4d389ba40dec55eb2b3703eb7726ac5c4fe1177d
License: BSD License: BSD
License File: LICENSE License File: LICENSE
Security Critical: no Security Critical: no
......
...@@ -50,6 +50,8 @@ import os.path ...@@ -50,6 +50,8 @@ import os.path
import optparse import optparse
import sys import sys
import pdl
try: try:
import json import json
except ImportError: except ImportError:
...@@ -228,8 +230,8 @@ def load_schema(file_name, domains): ...@@ -228,8 +230,8 @@ def load_schema(file_name, domains):
if not os.path.isfile(file_name): if not os.path.isfile(file_name):
return return
input_file = open(file_name, "r") input_file = open(file_name, "r")
json_string = input_file.read() parsed_json = pdl.loads(input_file.read(), file_name)
parsed_json = json.loads(json_string) input_file.close()
domains += parsed_json["domains"] domains += parsed_json["domains"]
return parsed_json["version"] return parsed_json["version"]
...@@ -422,6 +424,7 @@ def load_domains_and_baselines(file_name, domains, baseline_domains): ...@@ -422,6 +424,7 @@ def load_domains_and_baselines(file_name, domains, baseline_domains):
version = load_schema(os.path.normpath(file_name), domains) version = load_schema(os.path.normpath(file_name), domains)
suffix = "-%s.%s.json" % (version["major"], version["minor"]) suffix = "-%s.%s.json" % (version["major"], version["minor"])
baseline_file = file_name.replace(".json", suffix) baseline_file = file_name.replace(".json", suffix)
baseline_file = file_name.replace(".pdl", suffix)
load_schema(os.path.normpath(baseline_file), baseline_domains) load_schema(os.path.normpath(baseline_file), baseline_domains)
return version return version
......
...@@ -14,6 +14,8 @@ try: ...@@ -14,6 +14,8 @@ try:
except ImportError: except ImportError:
import simplejson as json import simplejson as json
import pdl
# Path handling for libraries and templates # Path handling for libraries and templates
# Paths have to be normalized because Jinja uses the exact template path to # Paths have to be normalized because Jinja uses the exact template path to
# determine the hash used in the cache filename, and we need a pre-caching step # determine the hash used in the cache filename, and we need a pre-caching step
...@@ -335,9 +337,8 @@ class Protocol(object): ...@@ -335,9 +337,8 @@ class Protocol(object):
def read_protocol_file(self, file_name): def read_protocol_file(self, file_name):
input_file = open(file_name, "r") input_file = open(file_name, "r")
json_string = input_file.read() parsed_json = pdl.loads(input_file.read(), file_name)
input_file.close() input_file.close()
parsed_json = json.loads(json_string)
version = parsed_json["version"]["major"] + "." + parsed_json["version"]["minor"] version = parsed_json["version"]["major"] + "." + parsed_json["version"]["minor"]
domains = [] domains = []
for domain in parsed_json["domains"]: for domain in parsed_json["domains"]:
......
...@@ -11,6 +11,7 @@ try: ...@@ -11,6 +11,7 @@ try:
except ImportError: except ImportError:
import simplejson as json import simplejson as json
import pdl
def main(argv): def main(argv):
if len(argv) < 1: if len(argv) < 1:
...@@ -25,8 +26,7 @@ def main(argv): ...@@ -25,8 +26,7 @@ def main(argv):
sys.stderr.write("Cannot find %s\n" % file_name) sys.stderr.write("Cannot find %s\n" % file_name)
return 1 return 1
input_file = open(file_name, "r") input_file = open(file_name, "r")
json_string = input_file.read() parsed_json = pdl.loads(input_file.read(), file_name)
parsed_json = json.loads(json_string)
domains += parsed_json["domains"] domains += parsed_json["domains"]
version = parsed_json["version"] version = parsed_json["version"]
......
# 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
import pdl
def main(argv):
if len(argv) < 2:
sys.stderr.write("Usage: %s <protocol.pdl> <protocol.json>\n" % sys.argv[0])
return 1
file_name = os.path.normpath(argv[0])
input_file = open(file_name, "r")
pdl_string = input_file.read()
protocol = pdl.loads(pdl_string, file_name)
input_file.close()
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:]))
...@@ -27,7 +27,7 @@ template("inspector_protocol_generate") { ...@@ -27,7 +27,7 @@ template("inspector_protocol_generate") {
inspector_protocol_dir = invoker.inspector_protocol_dir inspector_protocol_dir = invoker.inspector_protocol_dir
action(target_name) { action(target_name) {
script = "$inspector_protocol_dir/CodeGenerator.py" script = "$inspector_protocol_dir/code_generator.py"
inputs = [ inputs = [
invoker.config_file, invoker.config_file,
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
'templates/Imported_h.template', 'templates/Imported_h.template',
'templates/TypeBuilder_cpp.template', 'templates/TypeBuilder_cpp.template',
'templates/TypeBuilder_h.template', 'templates/TypeBuilder_h.template',
'CodeGenerator.py', 'code_generator.py',
] ]
} }
} }
# Copyright 2017 The Chromium Authors. All rights reserved. # Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
...@@ -8,7 +8,6 @@ import os.path ...@@ -8,7 +8,6 @@ import os.path
import re import re
import sys import sys
file_name = None
description = '' description = ''
primitiveTypes = ['integer', 'number', 'boolean', 'string', 'object', 'any', 'array'] primitiveTypes = ['integer', 'number', 'boolean', 'string', 'object', 'any', 'array']
...@@ -43,7 +42,7 @@ def createItem(d, experimental, deprecated, name=None): ...@@ -43,7 +42,7 @@ def createItem(d, experimental, deprecated, name=None):
return result return result
def parse(data): def parse(data, file_name):
protocol = collections.OrderedDict() protocol = collections.OrderedDict()
protocol['version'] = collections.OrderedDict() protocol['version'] = collections.OrderedDict()
protocol['domains'] = [] protocol['domains'] = []
...@@ -161,23 +160,8 @@ def parse(data): ...@@ -161,23 +160,8 @@ def parse(data):
sys.exit(1) sys.exit(1)
return protocol return protocol
def main(argv):
if len(argv) < 2: def loads(data, file_name):
sys.stderr.write("Usage: %s <protocol.pdl> <protocol.json>\n" % sys.argv[0]) if file_name.endswith(".pdl"):
return 1 return parse(data, file_name)
global file_name return json.loads(data)
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:]))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment