[Webkit-unassigned] [Bug 67931] [GTK] Add WebKitWebContext to GTK API

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Sep 20 23:49:38 PDT 2011


https://bugs.webkit.org/show_bug.cgi?id=67931





--- Comment #9 from Carlos Garcia Campos <cgarcia at igalia.com>  2011-09-20 23:49:38 PST ---
(In reply to comment #8)
> (From update of attachment 108001 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=108001&action=review
> 
> > Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp:74
> > +    static GOnce onceInit = G_ONCE_INIT;
> > +    return WEBKIT_WEB_CONTEXT(g_once(&onceInit, getDefaultWebContext, 0));
> 
> Out of curiosity does GOnce require that GObject be created in another function.

Yes, GOnce calls the function the first time is called and returns the stored value for subsequent calls.

> I'm not sure I understand the benefit over something like this:

The only benefict is that GOnce ensures that the initialization is serialized across multiple threads.

> static WebKitWebContext* webContext = 0;
> if (webContext)
>     return webContext;
> 
> webContext = WEBKIT_WEB_CONTEXT(g_object_new(WEBKIT_TYPE_WEB_CONTEXT, NULL));
> webContext->priv->context = WKContextGetSharedProcessContext();
> WKContextSetCacheModel(webContext->priv->context, kWKCacheModelPrimaryWebBrowser);
> return webContext;
> 
> It's fewer lines and clearer.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list