Thought I would give a little post-op on the XPCom to NPRuntime conversion. One of the biggest issues with XPCom was the need for .idl files and the code that went along with them. How an .idl file worked was that you declared a class with a unique id and then the methods and properties of that class. Then you took that .idl file and ran it thru the xpidl compiler and this gave and .xpt and a .h file as the output. The .xpt was used by firefox,mozilla, et al to know what methods the class/plugin provided. The .h file was used by the code to create then entry points for the methods. Anyway, getting all the working on many different distrobutions was a pain. Many of the files needed for this step ended up in different places and usually the .pc files (the pkg-config files that say where everything is) were wrong.
So with libxul 1.9.1 coming out shortly and it changing things with XPCom again I decided to look at npruntime since that is where things need to go anyway. Before doing this I did make sure that I could get the plugin working in XPCom mode with 1.9.1 and I was able to, with some minimal fuss. But still decided to take a look into the conversion since I was sick of the whole idl thing.
So again I looked at the sample and noticed that the classes in the file, kinda resembled the stuff from XPCom and so I decided to get two methods working, play and pause. I had to declare an id and then define that id to be the same as the methods that I did in the .idl file. I then had to edit HasMethod to say, yeah I could handle that id. After I got HasMethod working I noticed that the code was dropping into Invoke and found that with a couple of lines of code I could take the same call that I used in the XPCom callbacks and apply it here. Once I got that working I started doing the bookwork and created all the methods and the callbacks. The same was pretty much true for the properties as well. And in about 8 hrs of work it was pretty much working.
The conversion turned out to be much less work than I expected it to be and I think the code is actually easier to understand now. Before I really dug into this, I looked at it and just was really dreading the conversion as I expected it to be a huge learning curve, but actually I was able to reuse a lot of what I already knew.