WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
101452
[chromium] Create proxy classes for WebViewClient and WebWidgetClient and use themn for layout tests
https://bugs.webkit.org/show_bug.cgi?id=101452
Summary
[chromium] Create proxy classes for WebViewClient and WebWidgetClient and use...
jochen
Reported
2012-11-07 05:08:31 PST
[chromium] Create proxy classes for WebViewClient and WebWidgetClient and use themn for layout tests
Attachments
Patch
(48.22 KB, patch)
2012-11-07 05:13 PST
,
jochen
no flags
Details
Formatted Diff
Diff
script used to generate proxy classes
(6.48 KB, text/x-python)
2012-11-07 05:19 PST
,
jochen
no flags
Details
Patch
(15.23 KB, patch)
2012-11-08 01:11 PST
,
jochen
no flags
Details
Formatted Diff
Diff
Patch
(15.42 KB, patch)
2012-11-08 01:34 PST
,
jochen
no flags
Details
Formatted Diff
Diff
Patch
(15.87 KB, patch)
2012-11-08 04:52 PST
,
jochen
no flags
Details
Formatted Diff
Diff
Patch
(15.94 KB, patch)
2012-11-08 07:58 PST
,
jochen
no flags
Details
Formatted Diff
Diff
Patch
(18.75 KB, patch)
2012-11-08 12:23 PST
,
jochen
no flags
Details
Formatted Diff
Diff
Patch for landing
(18.76 KB, patch)
2012-11-09 00:35 PST
,
jochen
no flags
Details
Formatted Diff
Diff
Show Obsolete
(7)
View All
Add attachment
proposed patch, testcase, etc.
jochen
Comment 1
2012-11-07 05:13:05 PST
Created
attachment 172762
[details]
Patch
WebKit Review Bot
Comment 2
2012-11-07 05:16:25 PST
Please wait for approval from
abarth@webkit.org
,
dglazkov@chromium.org
,
fishd@chromium.org
,
jamesr@chromium.org
or
tkent@chromium.org
before submitting, as this patch contains changes to the Chromium public API. See also
https://trac.webkit.org/wiki/ChromiumWebKitAPI
.
jochen
Comment 3
2012-11-07 05:19:20 PST
Created
attachment 172764
[details]
script used to generate proxy classes I generated the proxy classes using this script. Turns out that parsing a header in python is not really straight forward, so I guess we shouldn't use this script to automatically generate the proxy for now, but instead rely on people updating both classes at the same time for now.
Adam Barth
Comment 4
2012-11-07 10:06:38 PST
I don't understand why you need to modify the API to do this.
Adam Barth
Comment 5
2012-11-07 10:07:16 PST
This also seems like a large maintenance burden.
James Robinson
Comment 6
2012-11-07 10:59:59 PST
Comment on
attachment 172762
[details]
Patch Can't you just do this on the chromium side? There is absolutely no way we'd be able to maintain this.
jochen
Comment 7
2012-11-07 11:11:32 PST
I don't think it's that much of a maintenance burden in the long term. If you change e.g. WebViewClient, you have to update three different implementations of this class (WebViewHost in DRT, WebViewHost in TestShell, and RenderViewImpl) already now, and in the future, at least the TestShell one will go away. The goal of this design is to not incur any extra cost for non-layout test code paths. The reason for putting this into WebKit instead of chrome is that it allows for implementing the testrunner related bits inside webkit - if somebody wanted to add a new method to the testRunner that requires some interaction with the WebViewClient, this design allows for implementing this entirely in webkit
Darin Fisher (:fishd, Google)
Comment 8
2012-11-07 11:50:07 PST
Adam, James: I'll echo what Jochen wrote. He and I discussed this recently. The idea is to make the TestRunner into a library that can be either embedded into DRT or content-shell. TestRunner needs to implement WebViewClient to do its work, but RenderViewImpl (in Chromium) also needs to implement WebViewClient. The idea is that RenderViewImpl would provide users with a way to override the WebViewClient. content-shell would initiate the TestRunner library and use its WebViewClient instead. The TestRunner's WebViewClient would need to delegate many calls to the real WebViewClient in order for content-shell to still function. The challenge in overriding WebViewClient is maintenance. If a method is added or removed, then the proxy in TestRunner needs to be updated. TestRunner does not need to intercept all WebViewClient methods. Many of the methods should just be passed through to the real WebViewClient. It seemed like teasing the forwarding of methods out into a separate proxy interface would help with this, but I could also see us just incorporating the proxy interface directly into TestRunner. Jochen, I think we should avoid the setter for WebViewClient. DRT or RenderViewImpl can provide a mechanism for overriding the WebViewClient that they pass into WebKit when initializing a WebView. I don't think we should need to support changing the WebViewClient at runtime.
Adam Barth
Comment 9
2012-11-07 13:44:18 PST
I'm happy to defer to fishd. It seems like there should be a way to share a single vtable rather than having a vtable full of self-thunks.
jochen
Comment 10
2012-11-07 14:19:25 PST
(In reply to
comment #9
)
> I'm happy to defer to fishd. It seems like there should be a way to share a single vtable rather than having a vtable full of self-thunks.
That would require hard-coding some knowledge about how the compiler will layout the vtable. While that's certainly possible, I'm not sure whether this is desirable.
Adam Barth
Comment 11
2012-11-07 14:24:46 PST
> That would require hard-coding some knowledge about how the compiler will layout the vtable. While that's certainly possible, I'm not sure whether this is desirable.
That's not necessarily true. The subclassing mechanism in C++ lets you share vtables.
jochen
Comment 12
2012-11-07 14:40:11 PST
(In reply to
comment #11
)
> > That would require hard-coding some knowledge about how the compiler will layout the vtable. While that's certainly possible, I'm not sure whether this is desirable. > > That's not necessarily true. The subclassing mechanism in C++ lets you share vtables.
You're right For that the proxy would need to be a template like template<class client> class WebViewClientProxy : public client { public: //... interesting methods };
jochen
Comment 13
2012-11-08 01:11:49 PST
Created
attachment 172951
[details]
Patch
jochen
Comment 14
2012-11-08 01:13:48 PST
Much smaller version using templates
jochen
Comment 15
2012-11-08 01:34:59 PST
Created
attachment 172956
[details]
Patch
jochen
Comment 16
2012-11-08 04:52:14 PST
Created
attachment 173016
[details]
Patch
jochen
Comment 17
2012-11-08 07:58:35 PST
Created
attachment 173046
[details]
Patch
jochen
Comment 18
2012-11-08 08:03:02 PST
This is how I'd hook this up
https://codereview.chromium.org/11362161/
Adam Barth
Comment 19
2012-11-08 10:31:37 PST
Comment on
attachment 173046
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=173046&action=review
> Tools/DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h:55 > + WebTestProxy(T t)
explicit
> Tools/DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h:74 > + virtual void postAccessibilityNotification(const WebKit::WebAccessibilityObject& obj, WebKit::WebAccessibilityNotification notification)
This function seems really long to put in an API. Will all the overrides need to be in public headers?
jochen
Comment 20
2012-11-08 10:37:22 PST
(In reply to
comment #19
)
> (From update of
attachment 173046
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=173046&action=review
> > > Tools/DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h:55 > > + WebTestProxy(T t) > > explicit > > > Tools/DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h:74 > > + virtual void postAccessibilityNotification(const WebKit::WebAccessibilityObject& obj, WebKit::WebAccessibilityNotification notification) > > This function seems really long to put in an API. Will all the overrides need to be in public headers?
As it's a template, the entire code has to go into the header.
jochen
Comment 21
2012-11-08 11:34:27 PST
Another possibility would be to move the actual implementation on WebTestProxyBase, and have the WebTestProxy template just dispatch the method. Was that preferable?
jochen
Comment 22
2012-11-08 12:23:49 PST
Created
attachment 173093
[details]
Patch
jochen
Comment 23
2012-11-08 12:24:16 PST
Here's a version that hides the implementation in WebTestProxyBase
James Robinson
Comment 24
2012-11-08 15:56:50 PST
Comment on
attachment 173093
[details]
Patch Why the templates? Can't this just be class WebTestProxy : WebViewClient { private: WebViewClient* m_realClient; }; ?
jochen
Comment 25
2012-11-08 22:04:00 PST
(In reply to
comment #24
)
> (From update of
attachment 173093
[details]
) > Why the templates? Can't this just be > > class WebTestProxy : WebViewClient { > private: > WebViewClient* m_realClient; > }; > > ?
Then I need to override all methods of WebViewClient (see the first patch)
Adam Barth
Comment 26
2012-11-08 22:19:16 PST
Comment on
attachment 173093
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=173093&action=review
Thanks. This approach looks much easier to maintain.
> Tools/DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h:63 > +template<class WebViewClientImpl, typename T>
WebViewClientImpl -> can we use a name for this template that seems more like a variable?
> Tools/DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h:73 > + virtual void postAccessibilityNotification(const WebKit::WebAccessibilityObject& obj, WebKit::WebAccessibilityNotification notification)
obj -> object
jochen
Comment 27
2012-11-09 00:35:44 PST
Created
attachment 173227
[details]
Patch for landing
jochen
Comment 28
2012-11-09 00:36:38 PST
(In reply to
comment #26
)
> (From update of
attachment 173093
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=173093&action=review
> > Thanks. This approach looks much easier to maintain. > > > Tools/DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h:63 > > +template<class WebViewClientImpl, typename T> > > WebViewClientImpl -> can we use a name for this template that seems more like a variable?
I like this name, as it indicates what the template parameter is supposed to be. Also, WTF uses similarly formatted names (either T,U, ... or descriptive names)
> > > Tools/DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h:73 > > + virtual void postAccessibilityNotification(const WebKit::WebAccessibilityObject& obj, WebKit::WebAccessibilityNotification notification) > > obj -> object
done
WebKit Review Bot
Comment 29
2012-11-09 01:01:21 PST
Comment on
attachment 173227
[details]
Patch for landing Clearing flags on attachment: 173227 Committed
r134027
: <
http://trac.webkit.org/changeset/134027
>
WebKit Review Bot
Comment 30
2012-11-09 01:01:28 PST
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug