[chromium-dev] Re: Question about V8 bindings

2009-07-23 Thread Mads Sig Ager
Ah, yes of course. The generated code for the base class itself needs it. I had also forgotten that we use the ID to get the superclass template to inherit from. Don't listen to me. :-) -- Mads On Wed, Jul 22, 2009 at 10:15 PM, Drew Wilsonatwil...@chromium.org wrote: Digging further through

[chromium-dev] Re: Question about V8 bindings

2009-07-22 Thread Drew Wilson
I think this may not be true, as I got a compilation error in the generated bindings when I removed the type enum for the base class. Note that the code generated for my derived class contains an explicit reference to the base class: static v8::Persistentv8::FunctionTemplate

[chromium-dev] Re: Question about V8 bindings

2009-07-22 Thread Drew Wilson
Digging further through the errors, it seems that the generated code for the base class itself is littered with references to the V8ClassIndex::type value. For example: static v8::Handlev8::Value locationAttrGetter(v8::Localv8::String name, const v8::AccessorInfo info) {

[chromium-dev] Re: Question about V8 bindings

2009-07-21 Thread Drew Wilson
Sigh. I keep sending this with the wrong email address. I wish Gmail would just use the address from the last time I replied to the thread. -=-=- It seems like that would have some undesirable side-effects, aside from the fact that WebKit frowns on using virtual functions unnecessarily. So, let's

[chromium-dev] Re: Question about V8 bindings

2009-07-21 Thread Jeremy Orlow
On Tue, Jul 21, 2009 at 10:19 AM, Drew Wilson atwil...@google.com wrote: It seems like that would have some undesirable side-effects, aside from the fact that WebKit frowns on using virtual functions unnecessarily. So, let's imagine that I have two derived classes, SharedWorkerContext and

[chromium-dev] Re: Question about V8 bindings

2009-07-21 Thread Jeremy Orlow
On Tue, Jul 21, 2009 at 10:27 AM, Drew Wilson atwil...@chromium.org wrote: Sigh. I keep sending this with the wrong email address. I wish Gmail would just use the address from the last time I replied to the thread. Settings - Accounts - When receiving a message:Reply from the same address the

[chromium-dev] Re: Question about V8 bindings

2009-07-21 Thread Drew Wilson
Yes, there's polymorphism in the IDL files. For example, the IDL for DedicatedWorkerContext is: interface [ bunch of random attributes ] DedicatedWorkerContext : WorkerContext { void postMessage(in DOMString message, in [Optional] MessagePort messagePort)

[chromium-dev] Re: Question about V8 bindings

2009-07-21 Thread Adam Barth
I think the way this works in general is that you create the wrapper for the derived class. You can see all the switch statements in V8DOMWrapper.cpp that try to do this for Nodes, etc. Adam On Tue, Jul 21, 2009 at 10:32 AM, Jeremy Orlowjor...@chromium.org wrote: On Tue, Jul 21, 2009 at

[chromium-dev] Re: Question about V8 bindings

2009-07-21 Thread Drew Wilson
The other unanswered question is whether it's useful to define the base type in V8Index.h. If a wrapper of the base type (WRAPPERCONTEXT) is never instantiated, do I still need to define it for the purposes of things like instanceof and prototype chains? Or is it *only* used to specify the type of

[chromium-dev] Re: Question about V8 bindings

2009-07-21 Thread Mads Sig Ager
If you don't need the base 'type' in the binding layer code, you don't have to specify it in the V8Index file. Prototype chains and instanceof operations are all handled by V8 based on the code generated from the IDL files and it is independent of the 'type' declarations in the V8Index file.

[chromium-dev] Re: Question about V8 bindings

2009-07-20 Thread Jeremy Orlow
Sorry if this is a dumb question, but why woudn't you simply have a WORKERCONTEXT and let virtual dispatch do its job for the rest? Shared methods can be implemented on the base class and the rest can be purely virtual with implementations in the sub classes. J On Mon, Jul 20, 2009 at 3:21 PM,

[chromium-dev] Re: Question about V8 bindings

2009-07-20 Thread Jeremy Orlow
In other words, make all workers appear the same to V8 (i.e. as a WORKERCONTEXT) and then implement polymorphism in the implementations being wrapped by V8. On Mon, Jul 20, 2009 at 8:19 PM, Jeremy Orlow jor...@chromium.org wrote: Sorry if this is a dumb question, but why woudn't you simply have