[Webkit-unassigned] [Bug 27899] [Gtk] Expose a database API
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Sep 2 23:44:07 PDT 2009
https://bugs.webkit.org/show_bug.cgi?id=27899
--- Comment #18 from Xan Lopez <xan.lopez at gmail.com> 2009-09-02 23:44:07 PDT ---
(From update of attachment 38925)
> +GHashTable* webkit_security_origins()
> +{
> + static GHashTable* securityOrigins = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, g_object_unref);
> + return securityOrigins;
> +}
This function should be static too.
> +G_CONST_RETURN gchar* webkit_security_origin_get_protocol(WebKitSecurityOrigin* securityOrigin)
> +{
> + g_return_val_if_fail(WEBKIT_IS_SECURITY_ORIGIN(securityOrigin), NULL);
> +
> + WebKitSecurityOriginPrivate* priv = securityOrigin->priv;
> + WebCore::String protocol = priv->coreOrigin->protocol();
> +
> + if (protocol.isEmpty())
> + return "";
> +
> + if (!priv->protocol)
> + priv->protocol = g_strdup(protocol.utf8().data());
> +
> + return priv->protocol;
> +}
Idle thought, shouldn't you just always cache the value, even if it's "", and
then return that without going to the core object? Same for host.
> +WebKitSecurityOrigin* WebKit::kit(WebCore::SecurityOrigin* coreOrigin)
> +{
> + ASSERT(coreOrigin);
> +
> + GHashTable* table = webkit_security_origins();
> + WebKitSecurityOrigin* origin = (WebKitSecurityOrigin*) g_hash_table_lookup(table, coreOrigin);
> +
> + if (!origin) {
> + origin = WEBKIT_SECURITY_ORIGIN(g_object_new(WEBKIT_TYPE_SECURITY_ORIGIN, NULL));
> + origin->priv->coreOrigin = coreOrigin;
> + g_hash_table_insert(webkit_security_origins(), coreOrigin, origin);
You could use 'table' here instead of calling webkit_security_origins() again.
> + }
> +
> + return origin;
> +}
> +
> +
> +static void webkit_web_database_class_init(WebKitWebDatabaseClass* klass)
> +{
> + GObjectClass* gobjectClass = G_OBJECT_CLASS(klass);
> + gobjectClass->finalize = webkit_web_database_finalize;
> + gobjectClass->set_property = webkit_web_database_set_property;
> + gobjectClass->get_property = webkit_web_database_get_property;
You are not setting dispose here :)
Except for the last point it's all pretty minor/silly stuff, so you have my 1/2
r+ if you fix it. Now you need another 1/2 from other reviewer since this adds
new API.
--
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