[webkit-dev] A proposal for "Platform Mechanisms"
Anders Carlsson
andersca at apple.com
Wed Jun 16 18:03:42 PDT 2010
On Jun 16, 2010, at 5:55 PM, Darin Adler wrote:
> Sounds reasonable to me. We already follow pointers and use virtual functions for all these things, so I don’t see them adding a lot of overhead.
>
> Would these Mechanism classes replace all the current Client classes?
Like Kenneth said, these are more like "global clients". I don't see the benefit of replacing our current Client classes.
> Would the mechanism objects be obtained once and cached globally? How is the initial PlatformMechanism object created?
My current design is a bit different from the example I gave in my original mail. The getter functions are not virtual, but the functions to create the various mechanisms are. Something like:
class PlatformMechanism {
public:
PluginMechanism* pluginMechanism()
{
if (!m_pluginMechanism)
m_pluginMechanism = createPluginMechanism();
return m_pluginMechanism;
}
private:
virtual PluginMechanism* createPluginMechanism() = 0;
PluginMechanism* m_pluginMechanism;
};
> How is the initial PlatformMechanism object created?
WebKit will create a class that derives from PlatformMechanism. In the WebKit initialization code we'll create an instance of this class and set it as the platform mechanism using a setPlatformMechanism call.
- Anders
More information about the webkit-dev
mailing list