Converting libDOM to use vtable, the first step

John-Mark Bell jmb at netsurf-browser.org
Wed Mar 11 15:08:16 GMT 2009


On Wed, 2009-03-11 at 21:46 +0800, Bo Yang wrote:
> Hi,
>   The attached patch only convert node/attr two part of the DOM to use
> vtable method. It makes the libDOM not compile, but the complete patch
> to convert to vtable is really to large to review, so post the patch
> incrementally is better. We can find the issues earlier this way. Any
> advice and comments are appreciated! Thanks!

This is mostly fine. A couple of comments, however:

1) I'm not entirely sure where you're going with dom_node_create()
2) I don't think that there should be a destroy() entry in the public 
   vtable -- destruction of objects occurs implicitly when their 
   reference count falls to zero and they're not hooked into the tree.
   Therefore, we don't want to give the client the possibility of 
   screwing things up by calling the destroy() entry directly.
   I think we want the first two fields in dom_node_internal to be:

	void *vtable;
	void (*destroy)(...);

   as the destructor should be private.
3) attr_vtable needs to be static.


J.




More information about the netsurf-dev mailing list