Commit 8c1a0fa6 authored by nbarth@chromium.org's avatar nbarth@chromium.org

Add back [ImplementedInBaseClass] IDL extended attribute

Originally [LegacyImplementedInBaseClass] was intended to be short-term,
as the name suggests, for some refactoring.

However, for more complex cases of 'implements' usage,
the requirements that 'implements' puts on C++ implementation
makes it an ugly mess.
Thus allowing implementation in base class seems useful long-term,
so re-introducing.

Per:
WebGLRenderingContextBase
https://codereview.chromium.org/205243013/

Documentation:
http://www.chromium.org/blink/webidl/blink-idl-extended-attributes#TOC-ImplementedInBaseClass-i-

Compare earlier CL removing this:
Remove support for [LegacyImplementedInBaseClass] IDL extended attribute 
https://codereview.chromium.org/169273002/

R=haraken
BUG=344224

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

git-svn-id: svn://svn.chromium.org/blink/trunk@169830 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 97f46930
...@@ -60,6 +60,7 @@ WillBeGarbageCollected ...@@ -60,6 +60,7 @@ WillBeGarbageCollected
GlobalContext=Window|WorkerGlobalScope|SharedWorkerGlobalScope|DedicatedWorkerGlobalScope|ServiceWorkerGlobalScope GlobalContext=Window|WorkerGlobalScope|SharedWorkerGlobalScope|DedicatedWorkerGlobalScope|ServiceWorkerGlobalScope
Immutable Immutable
ImplementedAs=* ImplementedAs=*
ImplementedInBaseClass
InitializedByEventConstructor InitializedByEventConstructor
MeasureAs=* MeasureAs=*
NamedConstructor=* NamedConstructor=*
......
...@@ -163,7 +163,9 @@ def compute_individual_info(idl_filename): ...@@ -163,7 +163,9 @@ def compute_individual_info(idl_filename):
implemented_as = extended_attributes.get('ImplementedAs') implemented_as = extended_attributes.get('ImplementedAs')
# FIXME: remove [NoHeader] once switch to Python # FIXME: remove [NoHeader] once switch to Python
this_include_path = (include_path(idl_filename, implemented_as) this_include_path = (include_path(idl_filename, implemented_as)
if 'NoHeader' not in extended_attributes else None) if ('ImplementedInBaseClass' not in extended_attributes
and 'NoHeader' not in extended_attributes)
else None)
# Handle partial interfaces # Handle partial interfaces
partial_interface_name = get_partial_interface_name_from_idl(idl_file_contents) partial_interface_name = get_partial_interface_name_from_idl(idl_file_contents)
......
...@@ -143,15 +143,17 @@ def transfer_extended_attributes(dependency_interface, dependency_interface_base ...@@ -143,15 +143,17 @@ def transfer_extended_attributes(dependency_interface, dependency_interface_base
# C++ class name of the implementation, stored in [ImplementedBy], which # C++ class name of the implementation, stored in [ImplementedBy], which
# defaults to the basename of dependency IDL file. # defaults to the basename of dependency IDL file.
# This can be overridden by [ImplementedAs] on the dependency interface. # This can be overridden by [ImplementedAs] on the dependency interface,
# and omitted entirely by [ImplementedInBaseClass].
# Note that [ImplementedAs] is used with different meanings on interfaces # Note that [ImplementedAs] is used with different meanings on interfaces
# and members: # and members:
# for Blink class name and function name (or constant name), respectively. # for Blink class name and function name (or constant name), respectively.
# Thus we do not want to copy this from the interface to the member, but # Thus we do not want to copy this from the interface to the member, but
# instead extract it and handle it separately. # instead extract it and handle it separately.
merged_extended_attributes['ImplementedBy'] = ( if 'ImplementedInBaseClass' not in dependency_interface.extended_attributes:
dependency_interface.extended_attributes.get( merged_extended_attributes['ImplementedBy'] = (
'ImplementedAs', dependency_interface_basename)) dependency_interface.extended_attributes.get(
'ImplementedAs', dependency_interface_basename))
for attribute in dependency_interface.attributes: for attribute in dependency_interface.attributes:
attribute.extended_attributes.update(merged_extended_attributes) attribute.extended_attributes.update(merged_extended_attributes)
......
// Copyright 2014 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.
[
ImplementedInBaseClass, // Conflicts with default implements class name and [ImplementedAs]
NoInterfaceObject,
] interface TestImplements3 {
attribute DOMString implements3StringAttribute;
static attribute DOMString implements3StaticStringAttribute;
void implements3VoidMethod();
static void implements3StaticVoidMethod();
};
...@@ -50,3 +50,4 @@ ...@@ -50,3 +50,4 @@
TestInterfacePython implements TestImplements; TestInterfacePython implements TestImplements;
TestInterfacePython implements TestImplements2; TestInterfacePython implements TestImplements2;
TestInterfacePython implements TestImplements3;
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