Bug 29095 - Rename 3D Canvas related classes to use WebGL prefix
Summary: Rename 3D Canvas related classes to use WebGL prefix
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGL (show other bugs)
Version: 528+ (Nightly build)
Hardware: All OS X 10.5
: P2 Normal
Assignee: Oliver Hunt
URL:
Keywords:
: 31170 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-09-09 10:38 PDT by Chris Marrin
Modified: 2009-11-10 02:04 PST (History)
4 users (show)

See Also:


Attachments
Patch (1.27 MB, patch)
2009-11-08 21:19 PST, Kenneth Russell
oliver: review-
Details | Formatted Diff | Diff
Automatic rename patch (37.16 KB, patch)
2009-11-10 01:08 PST, Oliver Hunt
mjs: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Marrin 2009-09-09 10:38:52 PDT
This is the official name of the object in the spec.
Comment 1 Kenneth Russell 2009-11-08 21:19:44 PST
Created attachment 42731 [details]
Patch

To track the naming convention in the WebGL spec, renamed CanvasRenderingContext3D, CanvasObject and subclasses, CanvasArrayBuffer, and CanvasArray and subclasses to use the WebGL prefix.

Updated WebGL tests (both manual and LayoutTests).

Built and tested WebKit in Debug and Release mode. Built and tested Chromium in Debug mode with WebGL enabled. A checkin is needed to the Chromium tree once the WebKit changes have been committed.
Comment 2 Kenneth Russell 2009-11-08 21:21:46 PST
*** Bug 31170 has been marked as a duplicate of this bug. ***
Comment 3 Oliver Hunt 2009-11-08 22:15:49 PST
Comment on attachment 42731 [details]
Patch

The normal model for changes like these is to rename the class, then moves the files.  It makes it easier to see what is actually changing.
Comment 4 Oliver Hunt 2009-11-09 11:48:56 PST
Ken, I've been told that you disagree with my review, however you have made no comments in this bug, nor have you attempted to contact me.  I will try to make this clearer

From the point of view of reviewing a patch, a file move with changes is incredibly difficult.  Therefore we do rename patches in two parts -- the first part is to rename the class, the second is to rename the file.  This means the first patch is simply a whole pile of isolated renames, and the second patch is reported as a move.  This makes reviewing far simpler, and makes it easier to see what is happening in the revision history.
Comment 5 Kenneth Russell 2009-11-09 12:42:51 PST
I'll resubmit the patch containing only the changes to the files' contents. I'll need that patch committed before I can do the file renamings.
Comment 6 Kenneth Russell 2009-11-09 14:34:48 PST
Note that splitting this patch in this way will not result in the second patch being a simple move. Because IDL files are changing, references to various headers from the js and v8 bindings will change. I hope that this will not prevent the restructured patch from being approved.
Comment 7 Oliver Hunt 2009-11-09 14:38:14 PST
(In reply to comment #6)
> Note that splitting this patch in this way will not result in the second patch
> being a simple move. Because IDL files are changing, references to various
> headers from the js and v8 bindings will change. I hope that this will not
> prevent the restructured patch from being approved.

I figured that the IDL files would be a pain to rename/move but they tend to be very small anyway (with the exception of the obvious root context class) -- It may be worth doing the rename+move of Canvas/WebGLRenderingContext separately from everything else
Comment 8 Kenneth Russell 2009-11-09 14:55:08 PST
There are also interdependencies among the .cpp / .h files in html/canvas, so these will not be a simple renaming either in the second patch.

There is no advantage to renaming CanvasRenderingContext3D in a separate patch. This will only make more work. The majority of the code changes are due to the renaming of the CanvasArray and CanvasObject subclasses.
Comment 9 Kenneth Russell 2009-11-09 18:12:15 PST
I've tried to split up this patch as requested. I was able to get WebKit to compile and link. It required the addition of several temporary headers like html/canvas/WebGLArray.h so that the derived sources would compile.

I'm having difficulty making Chromium build. The V8 code generation script (specifically, WebCore/WebCore.gyp/scripts/rule_binding.py) assumes that the IDL file's name is the same as the class named in the IDL file.

As I see it, there are a few options:

1) Invest even more time hacking on the V8 code generation scripts.

2) Completely disable the WebGL build for Chromium while this non-atomic renaming is being done.

3) Apply my original, atomic patch.

I don't want to do (1); it is a waste of time.

Oliver, I would prefer to do (3), but if you want, I will disable WebGL in Chromium and upload a new patch to satisfy (2). As I pointed out, this will not result in the second part of the patch being a simple renaming. There are interdependencies between headers like CanvasFloatArray.h and CanvasArray.h which require them to be renamed and updated in a single step. It might be technically possible to do multiple rename / update commits so that no commit contains a renaming of a file that also contains modifications, but this will only prolong the agony of this update.
Comment 10 Oliver Hunt 2009-11-09 18:22:25 PST
(In reply to comment #9)
> I've tried to split up this patch as requested. I was able to get WebKit to
> compile and link. It required the addition of several temporary headers like
> html/canvas/WebGLArray.h so that the derived sources would compile.
> 
> I'm having difficulty making Chromium build. The V8 code generation script
> (specifically, WebCore/WebCore.gyp/scripts/rule_binding.py) assumes that the
> IDL file's name is the same as the class named in the IDL file.
> 
> As I see it, there are a few options:
> 
> 1) Invest even more time hacking on the V8 code generation scripts.
> 
> 2) Completely disable the WebGL build for Chromium while this non-atomic
> renaming is being done.
> 
> 3) Apply my original, atomic patch.
> 
> I don't want to do (1); it is a waste of time.
> 
> Oliver, I would prefer to do (3), but if you want, I will disable WebGL in
> Chromium and upload a new patch to satisfy (2). As I pointed out, this will not
> result in the second part of the patch being a simple renaming. There are
> interdependencies between headers like CanvasFloatArray.h and CanvasArray.h
> which require them to be renamed and updated in a single step. It might be
> technically possible to do multiple rename / update commits so that no commit
> contains a renaming of a file that also contains modifications, but this will
> only prolong the agony of this update.

*sigh*  this would be immensely easier if chrome didn't choose to have its own bindings.

I am disinclined to make things worse for the normal webkit builds in the name of not destroying chrome builds, but i may be willing to accept an atomic commit after i see what's required to do the rename myself.
Comment 11 Oliver Hunt 2009-11-09 19:02:06 PST
> *sigh*  this would be immensely easier if chrome didn't choose to have its own
> bindings.
> 
> I am disinclined to make things worse for the normal webkit builds in the name
> of not destroying chrome builds, but i may be willing to accept an atomic
> commit after i see what's required to do the rename myself.

After playing around it would seem that it is difficult to do this degree a renaming without an ancillary typedef.  I don't really like that idea so it would appear that the best solution is an atomic rename and move.

That said, each class can be renamed/moved in a separate patch, rather than a single 1.2mb patch which no one can reasonably review
Comment 12 Oliver Hunt 2009-11-09 19:25:25 PST
(In reply to comment #11)
> > *sigh*  this would be immensely easier if chrome didn't choose to have its own
> > bindings.
> > 
> > I am disinclined to make things worse for the normal webkit builds in the name
> > of not destroying chrome builds, but i may be willing to accept an atomic
> > commit after i see what's required to do the rename myself.
> 
> After playing around it would seem that it is difficult to do this degree a
> renaming without an ancillary typedef.  I don't really like that idea so it
> would appear that the best solution is an atomic rename and move.
> 
> That said, each class can be renamed/moved in a separate patch, rather than a
> single 1.2mb patch which no one can reasonably review

Okay, just had another attempt and it would seem i can rename all the files trivially and not worry about the types contained therein.  I think the correct approach is therefore to rename the files then rename the classes.  This should produce the nicest set of changes.
Comment 13 Oliver Hunt 2009-11-09 19:57:57 PST
Maciej has pointed out that we actually have a tool to automatically do renames like this (do-webcore-renames) I'm just seeing if it handles IDL files correctly.  If it does then our historic approach has been to run it and land the patch noting it was done automatically by do-webcore-rename.

If it does i'll just bang through the patches tonight, though you'll need to do v8 binding updates manually i suspect.
Comment 14 Kenneth Russell 2009-11-09 20:06:30 PST
(In reply to comment #12)
> Okay, just had another attempt and it would seem i can rename all the files
> trivially and not worry about the types contained therein.  I think the correct
> approach is therefore to rename the files then rename the classes.  This should
> produce the nicest set of changes.

I don't understand how this is different from what I've already tried.

 - For the WebKit build, it's still going to be necessary to make some updates to the contents of the files during the renaming. For example, CanvasFloatArray.h moves to WebGLFloatArray.h, but its #include "CanvasArray.h" must be changed to #include "WebGLArray.h".

 - The Chrome build will break in exactly the same way as before because of the mismatch between the IDL file's name and contents.

The patch above can be reviewed in the following way. In the "Formatted Diff" view, each of the moved and edited files shows up three times. First, a complete removal of the old file (e.g. "JSCanvasArrayBufferConstructor.cpp". Second, a complete replacement of the new file (e.g. "JSWebGLArrayBufferConstructor.cpp". Finally, and the only important one, exactly the edits that need to be reviewed, under the name e.g. JSWebGLArrayBufferConstructor.cpp. The terms that were replaced are highlighted in the third version. The first two can be ignored.

The exceptions to this rule in this review are the following files, which were modified:
WebCore/DerivedSources.make
WebCore/WebCore.gypi
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/bindings/js/JSDOMWindowCustom.cpp
WebCore/bindings/js/JSDocumentCustom.cpp
WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp
WebCore/bindings/scripts/CodeGeneratorV8.pm
WebCore/bindings/v8/DOMObjectsInclude.h
WebCore/bindings/v8/DerivedSourcesAllInOne.cpp
WebCore/bindings/v8/V8DOMWrapper.cpp
WebCore/bindings/v8/V8Index.cpp
WebCore/bindings/v8/V8Index.h
WebCore/bindings/v8/custom/V8CustomBinding.h
WebCore/bindings/v8/custom/V8DocumentCustom.cpp
WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp
WebCore/html/HTMLCanvasElement.cpp
WebCore/manual-tests/webgl/Earth.html
WebCore/manual-tests/webgl/ManyPlanetsDeep.html
WebCore/manual-tests/webgl/SpinningBox.html
WebCore/manual-tests/webgl/TeapotPerPixel.html
WebCore/manual-tests/webgl/TeapotPerVertex.html
WebCore/manual-tests/webgl/resources/CanvasMatrix.js
WebCore/manual-tests/webgl/resources/utils3d.js
WebCore/page/DOMWindow.idl
WebCore/platform/graphics/GraphicsContext3D.h
WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp
WebCore/rendering/RenderLayerBacking.cpp
LayoutTests/fast/canvas/webgl/array-unit-tests-expected.txt
LayoutTests/fast/canvas/webgl/array-unit-tests.html
LayoutTests/fast/canvas/webgl/gl-get-calls.html
LayoutTests/fast/canvas/webgl/triangle.html
LayoutTests/fast/canvas/webgl/resources/utils3d.js

I just paged through the review, ignoring all of the files that were completely removed or added, and verifying that the only textual changes were renaming of Canvas to WebGL and dropping of the 3D suffix from CanvasRenderingContext3D. This took less than ten minutes.
Comment 15 Oliver Hunt 2009-11-09 20:20:57 PST
(In reply to comment #14)
> (In reply to comment #12)
> > Okay, just had another attempt and it would seem i can rename all the files
> > trivially and not worry about the types contained therein.  I think the correct
> > approach is therefore to rename the files then rename the classes.  This should
> > produce the nicest set of changes.
> 
> I don't understand how this is different from what I've already tried.

My implication there was one file at a time.  But also it resulted in a simple patch that did a rename, followed by a vcs move which is trivial to verify across vcs revisions, rather than a move+changes.

>  - For the WebKit build, it's still going to be necessary to make some updates
> to the contents of the files during the renaming. For example,
> CanvasFloatArray.h moves to WebGLFloatArray.h, but its #include "CanvasArray.h"
> must be changed to #include "WebGLArray.h".
> 
>  - The Chrome build will break in exactly the same way as before because of the
> mismatch between the IDL file's name and contents.
>

This seems like a bug in the V8 bindings codegen -- it's probably worth fixing on the assumption we'll hit it again one day, the standard bindings generator script does not have this restriction.
 
> The patch above can be reviewed in the following way. In the "Formatted Diff"
> view, each of the moved and edited files shows up three times. First, a
> complete removal of the old file (e.g. "JSCanvasArrayBufferConstructor.cpp".
> Second, a complete replacement of the new file (e.g.
> "JSWebGLArrayBufferConstructor.cpp". Finally, and the only important one,
> exactly the edits that need to be reviewed, under the name e.g.
> JSWebGLArrayBufferConstructor.cpp. The terms that were replaced are highlighted
> in the third version. The first two can be ignored.

In a 1.2mb file that requires tracking them all down.

> I just paged through the review, ignoring all of the files that were completely
> removed or added, and verifying that the only textual changes were renaming of
> Canvas to WebGL and dropping of the 3D suffix from CanvasRenderingContext3D.
> This took less than ten minutes.
1.2Mb in less than 10 minutes is not a review.

Anyhoo, like i said in my last comment, i'm fairly sure that do-webcore-rename can do the required work automatically, and is something we've used in the past (i'd forgotten about it due to the length of time since we've really needed to rename anything)

--Oliver
Comment 16 Oliver Hunt 2009-11-09 20:30:31 PST
Okay, in my testing do-webcore-rename updates v8 build scripts as well, so i believe it should be fine to just use it.  I'll start pushing the individual patches in half an hour or so.
Comment 17 Oliver Hunt 2009-11-09 22:37:47 PST
I have a "big' do-webcore-renames patch that automatically renames all of the canvas/webgl types in one swoop, and the v8 bindings that live in the tree, and the manual-tests :D

Just building to verify.

Alas LayoutTests need to be update manually
Comment 18 Oliver Hunt 2009-11-10 01:08:59 PST
Created attachment 42852 [details]
Automatic rename patch

This is the important bit of the rename patch.  All renames inside WebCore happen automatically, including manual-test updates.

A few testcases in the LayoutTests directory need to be updated to handle the change in type name.
Comment 19 Maciej Stachowiak 2009-11-10 01:12:33 PST
Comment on attachment 42852 [details]
Automatic rename patch

r=me
Comment 20 Oliver Hunt 2009-11-10 02:04:56 PST
Committed r50725