New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 711464 link

Starred by 8 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug

Blocking:
issue 707815
issue 728584


Participants' hotlists:
Hotlist-Bindings-IDLCompiler


Sign in to add a comment

Filenames generated as the result of typedef (a or b or c) NewName are unscalable

Project Member Reported by dcheng@chromium.org, Apr 13 2017

Issue description

https://codereview.chromium.org/2817093002 added a new entry to the typedef:
 typedef (HTMLImageElement or
+         SVGImageElement or
          HTMLVideoElement or
          HTMLCanvasElement or
          Blob or
          ImageData or
          ImageBitmap or
          OffscreenCanvas) ImageBitmapSource;

But this can cause generated filenames in the build files can exceed MAX_PATH, e.g.:

obj/third_party/WebKit/Source/bindings/core/v8/bindings_core_impl/HTMLImageElementOrSVGImageElementOrHTMLVideoElementOrHTMLCanvasElementOrBlobOrImageDataOrImageBitmapOrOffscreenCanvas.obj.rsp

appended to the name of the build directory on the builders:
C:\b\build\slave\chromium-win-x64-pgo-builder\build\src\out\Release_x64

is now too long
 
 Issue 712697  has been merged into this issue.
Blocking: 707815

Comment 3 by bashi@chromium.org, Apr 20 2017

Owner: bashi@chromium.org
Short-term workaround: The code generator throws an exception when the generated filename is too long. It should say that "Please add an alias to shorten_union_name() for TooooLongUnionName"

Possible longer-term solutions:
- Use C++ template IDLUnion<T1, T2, ...> and stop generating union type containers. I'm not sure this is doable though.
- Use typedef (ImageBitmapSource in this case) for generated files if exists.
Project Member

Comment 4 by bugdroid1@chromium.org, Apr 20 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/d8aa2f436c16b14c49320c78dca9ae64388ef3cd

commit d8aa2f436c16b14c49320c78dca9ae64388ef3cd
Author: Kenichi Ishibashi <bashi@chromium.org>
Date: Thu Apr 20 08:30:20 2017

IDL code generator: Throw an exception when a union name is too long

This is a hacky workaround to make sure that the code generator doesn't
generate too long file names for union type containers. This doesn't fix
the problem but asks developers to add an alias for long names.

BUG=711464

Change-Id: Ibfb7d3dc0c128b38f1b60d555f060223d915f792
Reviewed-on: https://chromium-review.googlesource.com/482839
Reviewed-by: Hitoshi Yoshida <peria@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Commit-Queue: Kenichi Ishibashi <bashi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#465949}
[modify] https://crrev.com/d8aa2f436c16b14c49320c78dca9ae64388ef3cd/third_party/WebKit/Source/bindings/scripts/utilities.py

Comment 5 by fs...@chromium.org, Apr 24 2017

bashi@ thanks for doing this. :)
For the long term solution, is there a reason for us not to always use the typedef name?

Comment 6 by bashi@chromium.org, Apr 25 2017

Couple of reasons.
- There might be more than one typedefs for the same union type.
- A union type may have the same members but the semantics may be different between IDL interfaces. For example,
// Foo.idl
typedef (boolean or double) FooSpecificName;
// Bar.idl
interface Bar {
  void method((boolean or double) arg);
}

Generating Bar::method(FooSpecificName arg) would sound strange.

Suggestions/ideas are highly welcomed :)

Comment 7 by dcheng@chromium.org, Apr 25 2017

One silly idea is to just smash the basename of the IDL file and an arbitrary suffix together, e.g. V8ImageBitmapFactoriesUnions.cpp

(but I guess this would mean that the IDL compiler needs to know which IDL the union definition came from)

Comment 8 by bashi@chromium.org, Apr 25 2017

Thanks dcheng@!

Yeah IDL compiler needs to know where unions come from. I think we can add such metadata but unclear things still remain like what we should do when two IDL files have the same union definition.

Comment 9 by dcheng@chromium.org, Apr 25 2017

Wouldn't the IDL basename be sufficient to disambiguate this? Or we have multiple IDL files with the same name?

Comment 10 by bashi@chromium.org, Apr 25 2017

Multiple IDL files can use the same union type.

// Foo.idl
interface Foo {
  void method((boolean or double) arg);
}

// Bar.idl
dictionary Bar {
  (boolean or double) member;
}

I'm not sure which base name should be used for (boolean or double).
One possibility (though it might be awkward to implement) might be to use the typedef name if it is only referred to through the typedef name in IDL.

I have to imagine that the ones overflowing aren't the simple ones, like (boolean or double), but are the ones with many possibilities, like ImageBitmapSource, and it seems unlikely to me that another union be exactly the same by coincidence.


Another option might be to make the union type implemented by a template, and then probably offer a type alias to the typedef names in .idl. It might be tricky to make the resulting type quite as nice as the current generated ones, though. And it's almost certainly overkill. But it would look something like this: https://gist.github.com/jeremyroman/73500b3fa91030451b9f5164035ed534
#10: I'm suggesting that the union type be defined in a file called V8FooUnions.cpp for the union from Foo.idl, and V8BarUnions.cpp for the union from Bar.idl.

Comment 13 by bashi@chromium.org, Apr 25 2017

#11

Thanks Jeremy for suggestions! About a year ago I tried to use template but gave up due to lack of my template skills. Your code looks promising and now we have ToV8() and NativeValueTraits thanks to yukishiino@ and racuko@ so template approach may be an option. That said I agree that this is overkill. We may want to take your first option.

#12

I got your idea. Probably we may want to avoid duplicates if possible :)
Blocking: 728584
Issue 728584 has been merged into this issue.
Cc: bashi@chromium.org yukishiino@chromium.org haraken@chromium.org dpranke@chromium.org raphael....@intel.com
 Issue 611545  has been merged into this issue.
Labels: -Pri-1 Pri-2
Project Member

Comment 18 by bugdroid1@chromium.org, Jun 2 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/c0cdd99d33f708afb6ba0a7694482b4bdffbbaeb

commit c0cdd99d33f708afb6ba0a7694482b4bdffbbaeb
Author: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
Date: Fri Jun 02 14:00:22 2017

bindings: Use a smaller union name length limit (80 instead of 120).

While we do not reach a proper solution to the underlying problem of
generating union file names that are too long, make the accepted length
threshold 80 instead of 120 and convert all names longer than the new
threshold.

This should (at least for now) prevent errors such as the one reported in
https://bugs.chromium.org/p/chromium/issues/detail?id=725996#c10, where the
combination of the builder's name, union file name and target path in the
build directory went over Windows' length limit of 260 characters.

Bug: 711464,  725996 
Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: I69d0afa9baaef1f6c5bd2103d965ac1ad8253488
Reviewed-on: https://chromium-review.googlesource.com/522685
Reviewed-by: Yuki Shiino <yukishiino@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Commit-Queue: Raphael Kubo da Costa (rakuco) <raphael.kubo.da.costa@intel.com>
Cr-Commit-Position: refs/heads/master@{#476632}
[modify] https://crrev.com/c0cdd99d33f708afb6ba0a7694482b4bdffbbaeb/third_party/WebKit/Source/bindings/modules/v8/generated.gni
[modify] https://crrev.com/c0cdd99d33f708afb6ba0a7694482b4bdffbbaeb/third_party/WebKit/Source/bindings/scripts/utilities.py
[rename] https://crrev.com/c0cdd99d33f708afb6ba0a7694482b4bdffbbaeb/third_party/WebKit/Source/bindings/tests/results/core/NestedUnionType.cpp
[rename] https://crrev.com/c0cdd99d33f708afb6ba0a7694482b4bdffbbaeb/third_party/WebKit/Source/bindings/tests/results/core/NestedUnionType.h
[modify] https://crrev.com/c0cdd99d33f708afb6ba0a7694482b4bdffbbaeb/third_party/WebKit/Source/bindings/tests/results/core/V8TestTypedefs.h
[modify] https://crrev.com/c0cdd99d33f708afb6ba0a7694482b4bdffbbaeb/third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.h
[modify] https://crrev.com/c0cdd99d33f708afb6ba0a7694482b4bdffbbaeb/third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.cpp
[modify] https://crrev.com/c0cdd99d33f708afb6ba0a7694482b4bdffbbaeb/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContext.cpp
[modify] https://crrev.com/c0cdd99d33f708afb6ba0a7694482b4bdffbbaeb/third_party/WebKit/Source/modules/webgl/WebGLRenderingContext.cpp

Comment 19 by peria@chromium.org, Jul 14 2017

 Issue 700907  has been merged into this issue.
Project Member

Comment 20 by sheriffbot@chromium.org, Jul 16

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Owner: peria@chromium.org
Status: Assigned (was: Untriaged)
Reassign to peria@.
Labels: Hotlist-Bindings-IDLCompiler

Sign in to add a comment