Commit 6957a467 authored by c.shu@samsung.com's avatar c.shu@samsung.com

IDLs in core have 'implements' statements that depend on interfaces in modules, i.e.:

CoreFoo implements ModulesBar;

To avoid layer violation, these statements are moved to the implemented (RHS) IDL files.
The code generator is updated to support this.

BUG=358074
BUG=360435

Review URL: https://codereview.chromium.org/270573005

git-svn-id: svn://svn.chromium.org/blink/trunk@173599 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 6242c33e
...@@ -82,7 +82,7 @@ import os ...@@ -82,7 +82,7 @@ import os
import posixpath import posixpath
import sys import sys
from utilities import get_file_contents, write_pickle_file, get_interface_extended_attributes_from_idl, is_callback_interface_from_idl, get_partial_interface_name_from_idl, get_implemented_interfaces_from_idl, get_parent_interface, get_put_forward_interfaces_from_idl from utilities import get_file_contents, write_pickle_file, get_interface_extended_attributes_from_idl, is_callback_interface_from_idl, get_partial_interface_name_from_idl, get_implements_from_idl, get_parent_interface, get_put_forward_interfaces_from_idl
module_path = os.path.dirname(__file__) module_path = os.path.dirname(__file__)
source_path = os.path.normpath(os.path.join(module_path, os.pardir, os.pardir)) source_path = os.path.normpath(os.path.join(module_path, os.pardir, os.pardir))
...@@ -173,10 +173,12 @@ def compute_individual_info(idl_filename): ...@@ -173,10 +173,12 @@ def compute_individual_info(idl_filename):
# If not a partial interface, the basename is the interface name # If not a partial interface, the basename is the interface name
interface_name, _ = os.path.splitext(os.path.basename(idl_filename)) interface_name, _ = os.path.splitext(os.path.basename(idl_filename))
left_interfaces, right_interfaces = get_implements_from_idl(idl_file_contents, interface_name)
interfaces_info[interface_name] = { interfaces_info[interface_name] = {
'full_path': full_path, 'full_path': full_path,
'implemented_as': implemented_as, 'implemented_as': implemented_as,
'implements_interfaces': get_implemented_interfaces_from_idl(idl_file_contents, interface_name), 'implements_interfaces': right_interfaces,
'include_path': this_include_path, 'include_path': this_include_path,
# FIXME: temporary private field, while removing old treatement of # FIXME: temporary private field, while removing old treatement of
# 'implements': http://crbug.com/360435 # 'implements': http://crbug.com/360435
...@@ -191,6 +193,10 @@ def compute_individual_info(idl_filename): ...@@ -191,6 +193,10 @@ def compute_individual_info(idl_filename):
'referenced_interfaces': get_put_forward_interfaces_from_idl(idl_file_contents), 'referenced_interfaces': get_put_forward_interfaces_from_idl(idl_file_contents),
} }
for left_interface_name in left_interfaces:
interface_info = interfaces_info[left_interface_name]
interface_info['implements_interfaces'].append(interface_name)
# Record inheritance information # Record inheritance information
inherited_extended_attributes_by_interface[interface_name] = dict( inherited_extended_attributes_by_interface[interface_name] = dict(
(key, value) (key, value)
......
...@@ -58,15 +58,12 @@ def get_partial_interface_name_from_idl(file_contents): ...@@ -58,15 +58,12 @@ def get_partial_interface_name_from_idl(file_contents):
return match and match.group(1) return match and match.group(1)
def get_implemented_interfaces_from_idl(file_contents, interface_name): def get_implements_from_idl(file_contents, interface_name):
# Rule is: identifier-A implements identifier-B; # Rule is: identifier-A implements identifier-B;
# http://www.w3.org/TR/WebIDL/#idl-implements-statements # http://www.w3.org/TR/WebIDL/#idl-implements-statements
def get_implemented(left_identifier, right_identifier): # Returns two lists of interfaces that contain identifier-As and identifier-Bs.
# identifier-A must be the current interface # The 'implements' statements are supported in both identifier-A IDL and identifier-B IDL
if left_identifier != interface_name: # to avoid potential layering violation.
raise IdlBadFilenameError("Identifier on the left of the 'implements' statement should be %s in %s.idl, but found %s" % (interface_name, interface_name, left_identifier))
return right_identifier
implements_re = (r'^\s*' implements_re = (r'^\s*'
r'(\w+)\s+' r'(\w+)\s+'
r'implements\s+' r'implements\s+'
...@@ -75,7 +72,14 @@ def get_implemented_interfaces_from_idl(file_contents, interface_name): ...@@ -75,7 +72,14 @@ def get_implemented_interfaces_from_idl(file_contents, interface_name):
implements_matches = re.finditer(implements_re, file_contents, re.MULTILINE) implements_matches = re.finditer(implements_re, file_contents, re.MULTILINE)
implements_pairs = [(match.group(1), match.group(2)) implements_pairs = [(match.group(1), match.group(2))
for match in implements_matches] for match in implements_matches]
return [get_implemented(left, right) for left, right in implements_pairs] A_interfaces = []
B_interfaces = []
for left, right in implements_pairs:
if left == interface_name:
B_interfaces.append(right)
elif right == interface_name:
A_interfaces.append(left)
return (A_interfaces, B_interfaces)
def is_callback_interface_from_idl(file_contents): def is_callback_interface_from_idl(file_contents):
......
...@@ -214,7 +214,6 @@ ...@@ -214,7 +214,6 @@
}; };
Window implements GlobalEventHandlers; Window implements GlobalEventHandlers;
Window implements ImageBitmapFactories;
Window implements WindowBase64; Window implements WindowBase64;
Window implements WindowEventHandlers; Window implements WindowEventHandlers;
Window implements WindowTimers; Window implements WindowTimers;
...@@ -46,6 +46,5 @@ ...@@ -46,6 +46,5 @@
[MeasureAs=PrefixedWorkerURL] attribute URLConstructor webkitURL; // FIXME: deprecate this. [MeasureAs=PrefixedWorkerURL] attribute URLConstructor webkitURL; // FIXME: deprecate this.
}; };
WorkerGlobalScope implements ImageBitmapFactories;
WorkerGlobalScope implements WindowBase64; WorkerGlobalScope implements WindowBase64;
WorkerGlobalScope implements WindowTimers; WorkerGlobalScope implements WindowTimers;
...@@ -55,3 +55,7 @@ typedef (// HTMLImageElement or ...@@ -55,3 +55,7 @@ typedef (// HTMLImageElement or
[RaisesException] Promise createImageBitmap(ImageBitmap bitmap); [RaisesException] Promise createImageBitmap(ImageBitmap bitmap);
[RaisesException] Promise createImageBitmap(ImageBitmap bitmap, long sx, long sy, long sw, long sh); [RaisesException] Promise createImageBitmap(ImageBitmap bitmap, long sx, long sy, long sw, long sh);
}; };
Window implements ImageBitmapFactories;
WorkerGlobalScope implements ImageBitmapFactories;
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