[DevTools] use @extends instead of @implements for RuntimeDispatcher
To make type checks using closure we generate protocol_externs, for
each domain we generate Protocol.${domainName}Dispatcher @interface.
SDK.${domainName}Dispatcher uses @implements with generated interface,
closure compiler in this case forces us to have all interface method
implemented.
Problem: when we try to add new event for one of V8 domains, we can not
add this notification and its implementation in the same CL, so closure
blocks landing new events in V8 domains.
We can resolve this problem by using @extends instead of @implements
for V8 domains. In this case closure will still check that if we
override something - we override it properly but allow us to not
override all events.
I tried this approach for Page domain as well since it contains a lot
of unused by DevTools events but my attempt failed because we have
SDK.ScreenCaptureModel. It implements dispatcher and extends model,
unfortunately closure does not support multiple inheritance and to
use @extends here we should extract dispatcher from ScreenCaptureModel.
R=dgozman@chromium.org
Bug: chromium:848849
Change-Id: I14fa87b53aeaff5bd7daea7dd36a6917688841cf
Reviewed-on: https://chromium-review.googlesource.com/1082594
Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Reviewed-by: Andrey Lushnikov <lushnikov@chromium.org>
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#563830}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 14157eee77965e191ec21af278bdcb2aecf9f08e
diff --git a/scripts/build/generate_protocol_externs.py b/scripts/build/generate_protocol_externs.py
index 1725fa0..5babdfd 100755
--- a/scripts/build/generate_protocol_externs.py
+++ b/scripts/build/generate_protocol_externs.py
@@ -231,7 +231,10 @@
output_file.write("\n/** @typedef {%s} */\nProtocol.%s.%s;\n" %
(type_traits[type["type"]], domain_name, type["id"]))
- output_file.write("/** @interface */\n")
+ if domain_name in ["Runtime", "Debugger", "HeapProfiler"]:
+ output_file.write("/** @constructor */\n")
+ else:
+ output_file.write("/** @interface */\n")
output_file.write("Protocol.%sDispatcher = function() {};\n" % domain_name)
if "events" in domain:
for event in domain["events"]: