mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1757241 - Remove special case handling for ReadableStream in WebIDL generator r=edgar
Differential Revision: https://phabricator.services.mozilla.com/D143074
This commit is contained in:
parent
d07e459e7b
commit
f1ae8a3f13
@ -1425,10 +1425,7 @@ class CGHeaders(CGWrapper):
|
||||
# just include their header if we need to have functions
|
||||
# taking references to them declared in that header.
|
||||
headerSet = declareIncludes
|
||||
if unrolled.isReadableStream():
|
||||
headerSet.add("mozilla/dom/ReadableStream.h")
|
||||
else:
|
||||
headerSet.add("mozilla/dom/TypedArray.h")
|
||||
headerSet.add("mozilla/dom/TypedArray.h")
|
||||
else:
|
||||
try:
|
||||
typeDesc = config.getDescriptor(unrolled.inner.identifier.name)
|
||||
@ -1673,10 +1670,7 @@ def UnionTypes(unionTypes, config):
|
||||
if f.isSpiderMonkeyInterface():
|
||||
headers.add("js/RootingAPI.h")
|
||||
headers.add("js/Value.h")
|
||||
if f.isReadableStream():
|
||||
headers.add("mozilla/dom/ReadableStream.h")
|
||||
else:
|
||||
headers.add("mozilla/dom/TypedArray.h")
|
||||
headers.add("mozilla/dom/TypedArray.h")
|
||||
else:
|
||||
try:
|
||||
typeDesc = config.getDescriptor(f.inner.identifier.name)
|
||||
@ -1788,10 +1782,7 @@ def UnionConversions(unionTypes, config):
|
||||
elif f.isInterface():
|
||||
if f.isSpiderMonkeyInterface():
|
||||
headers.add("js/RootingAPI.h")
|
||||
if f.isReadableStream():
|
||||
headers.add("mozilla/dom/ReadableStream.h")
|
||||
else:
|
||||
headers.add("mozilla/dom/TypedArray.h")
|
||||
headers.add("mozilla/dom/TypedArray.h")
|
||||
elif f.inner.isExternal():
|
||||
try:
|
||||
typeDesc = config.getDescriptor(f.inner.identifier.name)
|
||||
|
@ -189,7 +189,6 @@ class WebIDLCodegenManager(LoggingMixin):
|
||||
cache_dir=None,
|
||||
make_deps_path=None,
|
||||
make_deps_target=None,
|
||||
use_builtin_readable_stream=True,
|
||||
):
|
||||
"""Create an instance that manages WebIDLs in the build system.
|
||||
|
||||
@ -226,7 +225,6 @@ class WebIDLCodegenManager(LoggingMixin):
|
||||
self._cache_dir = cache_dir
|
||||
self._make_deps_path = make_deps_path
|
||||
self._make_deps_target = make_deps_target
|
||||
self._use_builtin_readable_stream = use_builtin_readable_stream
|
||||
|
||||
if (make_deps_path and not make_deps_target) or (
|
||||
not make_deps_path and make_deps_target
|
||||
@ -382,11 +380,7 @@ class WebIDLCodegenManager(LoggingMixin):
|
||||
)
|
||||
|
||||
hashes = {}
|
||||
parser = WebIDL.Parser(
|
||||
self._cache_dir,
|
||||
lexer=None,
|
||||
use_builtin_readable_stream=self._use_builtin_readable_stream,
|
||||
)
|
||||
parser = WebIDL.Parser(self._cache_dir, lexer=None)
|
||||
|
||||
for path in sorted(self._input_paths):
|
||||
with io.open(path, "r", encoding="utf-8") as fh:
|
||||
@ -650,22 +644,15 @@ class WebIDLCodegenManager(LoggingMixin):
|
||||
result[2].add(path)
|
||||
|
||||
|
||||
def create_build_system_manager(
|
||||
topsrcdir=None, topobjdir=None, dist_dir=None, use_builtin_readable_stream=None
|
||||
):
|
||||
def create_build_system_manager(topsrcdir=None, topobjdir=None, dist_dir=None):
|
||||
"""Create a WebIDLCodegenManager for use by the build system."""
|
||||
if topsrcdir is None:
|
||||
assert (
|
||||
topobjdir is None
|
||||
and dist_dir is None
|
||||
and use_builtin_readable_stream is None
|
||||
)
|
||||
assert topobjdir is None and dist_dir is None
|
||||
import buildconfig
|
||||
|
||||
topsrcdir = buildconfig.topsrcdir
|
||||
topobjdir = buildconfig.topobjdir
|
||||
dist_dir = buildconfig.substs["DIST"]
|
||||
use_builtin_readable_stream = not buildconfig.substs.get("MOZ_DOM_STREAMS")
|
||||
|
||||
src_dir = os.path.join(topsrcdir, "dom", "bindings")
|
||||
obj_dir = os.path.join(topobjdir, "dom", "bindings")
|
||||
@ -699,5 +686,4 @@ def create_build_system_manager(
|
||||
# The make rules include a codegen.pp file containing dependencies.
|
||||
make_deps_path=os.path.join(obj_dir, "codegen.pp"),
|
||||
make_deps_target="webidl.stub",
|
||||
use_builtin_readable_stream=use_builtin_readable_stream,
|
||||
)
|
||||
|
@ -2450,9 +2450,6 @@ class IDLType(IDLObject):
|
||||
def isRecord(self):
|
||||
return False
|
||||
|
||||
def isReadableStream(self):
|
||||
return False
|
||||
|
||||
def isArrayBuffer(self):
|
||||
return False
|
||||
|
||||
@ -2481,7 +2478,7 @@ class IDLType(IDLObject):
|
||||
def isSpiderMonkeyInterface(self):
|
||||
"""Returns a boolean indicating whether this type is an 'interface'
|
||||
type that is implemented in SpiderMonkey."""
|
||||
return self.isInterface() and (self.isBufferSource() or self.isReadableStream())
|
||||
return self.isInterface() and self.isBufferSource()
|
||||
|
||||
def isAny(self):
|
||||
return self.tag() == IDLType.Tags.any
|
||||
@ -2698,9 +2695,6 @@ class IDLNullableType(IDLParametrizedType):
|
||||
def isRecord(self):
|
||||
return self.inner.isRecord()
|
||||
|
||||
def isReadableStream(self):
|
||||
return self.inner.isReadableStream()
|
||||
|
||||
def isArrayBuffer(self):
|
||||
return self.inner.isArrayBuffer()
|
||||
|
||||
@ -3209,9 +3203,6 @@ class IDLTypedefType(IDLType):
|
||||
def isRecord(self):
|
||||
return self.inner.isRecord()
|
||||
|
||||
def isReadableStream(self):
|
||||
return self.inner.isReadableStream()
|
||||
|
||||
def isDictionary(self):
|
||||
return self.inner.isDictionary()
|
||||
|
||||
@ -3554,7 +3545,6 @@ class IDLBuiltinType(IDLType):
|
||||
"Uint32Array",
|
||||
"Float32Array",
|
||||
"Float64Array",
|
||||
"ReadableStream",
|
||||
)
|
||||
|
||||
TagLookup = {
|
||||
@ -3590,7 +3580,6 @@ class IDLBuiltinType(IDLType):
|
||||
Types.Uint32Array: IDLType.Tags.interface,
|
||||
Types.Float32Array: IDLType.Tags.interface,
|
||||
Types.Float64Array: IDLType.Tags.interface,
|
||||
Types.ReadableStream: IDLType.Tags.interface,
|
||||
}
|
||||
|
||||
PrettyNames = {
|
||||
@ -3626,7 +3615,6 @@ class IDLBuiltinType(IDLType):
|
||||
Types.Uint32Array: "Uint32Array",
|
||||
Types.Float32Array: "Float32Array",
|
||||
Types.Float64Array: "Float64Array",
|
||||
Types.ReadableStream: "ReadableStream",
|
||||
}
|
||||
|
||||
def __init__(
|
||||
@ -3787,19 +3775,11 @@ class IDLBuiltinType(IDLType):
|
||||
and self._typeTag <= IDLBuiltinType.Types.Float64Array
|
||||
)
|
||||
|
||||
def isReadableStream(self):
|
||||
return self._typeTag == IDLBuiltinType.Types.ReadableStream
|
||||
|
||||
def isInterface(self):
|
||||
# TypedArray things are interface types per the TypedArray spec,
|
||||
# but we handle them as builtins because SpiderMonkey implements
|
||||
# all of it internally.
|
||||
return (
|
||||
self.isArrayBuffer()
|
||||
or self.isArrayBufferView()
|
||||
or self.isTypedArray()
|
||||
or self.isReadableStream()
|
||||
)
|
||||
return self.isArrayBuffer() or self.isArrayBufferView() or self.isTypedArray()
|
||||
|
||||
def isNonCallbackInterface(self):
|
||||
# All the interfaces we can be are non-callback
|
||||
@ -3893,7 +3873,6 @@ class IDLBuiltinType(IDLType):
|
||||
# ArrayBuffer is distinguishable from everything
|
||||
# that's not an ArrayBuffer or a callback interface
|
||||
(self.isArrayBuffer() and not other.isArrayBuffer())
|
||||
or (self.isReadableStream() and not other.isReadableStream())
|
||||
or
|
||||
# ArrayBufferView is distinguishable from everything
|
||||
# that's not an ArrayBufferView or typed array.
|
||||
@ -4100,11 +4079,6 @@ BuiltinTypes = {
|
||||
"Float64Array",
|
||||
IDLBuiltinType.Types.Float64Array,
|
||||
),
|
||||
IDLBuiltinType.Types.ReadableStream: IDLBuiltinType(
|
||||
BuiltinLocation("<builtin type>"),
|
||||
"ReadableStream",
|
||||
IDLBuiltinType.Types.ReadableStream,
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
@ -6757,9 +6731,6 @@ class Tokenizer(object):
|
||||
def t_IDENTIFIER(self, t):
|
||||
r"[_-]?[A-Za-z][0-9A-Z_a-z-]*"
|
||||
t.type = self.keywords.get(t.value, "IDENTIFIER")
|
||||
# If Builtin readable streams are disabled, mark ReadableStream as an identifier.
|
||||
if t.type == "READABLESTREAM" and not self._use_builtin_readable_streams:
|
||||
t.type = "IDENTIFIER"
|
||||
return t
|
||||
|
||||
def t_STRING(self, t):
|
||||
@ -6850,7 +6821,6 @@ class Tokenizer(object):
|
||||
"setlike": "SETLIKE",
|
||||
"iterable": "ITERABLE",
|
||||
"namespace": "NAMESPACE",
|
||||
"ReadableStream": "READABLESTREAM",
|
||||
"constructor": "CONSTRUCTOR",
|
||||
"symbol": "SYMBOL",
|
||||
"async": "ASYNC",
|
||||
@ -6871,8 +6841,7 @@ class Tokenizer(object):
|
||||
],
|
||||
)
|
||||
|
||||
def __init__(self, outputdir, lexer=None, use_builtin_readable_streams=True):
|
||||
self._use_builtin_readable_streams = use_builtin_readable_streams
|
||||
def __init__(self, outputdir, lexer=None):
|
||||
if lexer:
|
||||
self.lexer = lexer
|
||||
else:
|
||||
@ -8324,15 +8293,12 @@ class Parser(Tokenizer):
|
||||
"""
|
||||
DistinguishableType : PrimitiveType Null
|
||||
| ARRAYBUFFER Null
|
||||
| READABLESTREAM Null
|
||||
| OBJECT Null
|
||||
"""
|
||||
if p[1] == "object":
|
||||
type = BuiltinTypes[IDLBuiltinType.Types.object]
|
||||
elif p[1] == "ArrayBuffer":
|
||||
type = BuiltinTypes[IDLBuiltinType.Types.ArrayBuffer]
|
||||
elif p[1] == "ReadableStream":
|
||||
type = BuiltinTypes[IDLBuiltinType.Types.ReadableStream]
|
||||
else:
|
||||
type = BuiltinTypes[p[1]]
|
||||
|
||||
@ -8681,8 +8647,8 @@ class Parser(Tokenizer):
|
||||
[Location(self.lexer, p.lineno, p.lexpos, self._filename)],
|
||||
)
|
||||
|
||||
def __init__(self, outputdir="", lexer=None, use_builtin_readable_stream=True):
|
||||
Tokenizer.__init__(self, outputdir, lexer, use_builtin_readable_stream)
|
||||
def __init__(self, outputdir="", lexer=None):
|
||||
Tokenizer.__init__(self, outputdir, lexer)
|
||||
|
||||
logger = SqueakyCleanLogger()
|
||||
try:
|
||||
|
@ -386,7 +386,6 @@ class CommonBackend(BuildBackend):
|
||||
self.environment.topsrcdir,
|
||||
self.environment.topobjdir,
|
||||
mozpath.join(self.environment.topobjdir, "dist"),
|
||||
use_builtin_readable_stream=False, # Shouldn't matter if true or false here.
|
||||
)
|
||||
self._handle_generated_sources(manager.expected_build_output_files())
|
||||
self._write_unified_files(
|
||||
|
Loading…
Reference in New Issue
Block a user