[Webkit-unassigned] [Bug 210422] [GTK][WPE] Add API to expose UIClient::requestStorageAccessConfirm

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jun 15 08:12:51 PDT 2020


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

--- Comment #16 from Michael Catanzaro <mcatanzaro at gnome.org> ---
OK, tangent:

(In reply to Carlos Garcia Campos from comment #11)
> Headers include gtk so I guess we can use #if GTK_CHECK_VERSION. I still
> don't like condition compilation in public headers, though. What's exactly a
> control header?

Just some header that would define USE_GTK4 for us. Using GTK_CHECK_VERSION is a good idea, but then we still have to have separate headers for GTK and WPE.

I don't mind conditional compilation in public headers if it makes the headers more maintainable. Having two and now potentially three copies of every header that have to be updated in tandem is a shame.

> > Then, we only need to
> > duplicate the control header for GTK4, rather than every such header. In
> > fact, if we were able to use preprocessor guards we should be able to
> > eliminate duplication between WPE and GTK headers as well and just have one
> > header for WPE, GTK3, and GTK4. Is there any reason we cannot do that? (I
> > guess there is some reason I cannot think of, or you would have done this
> > already?)
> 
> I don't understand the proposal, TBH.

For instance:

#define WEBKIT_TYPE_WEBSITE_DATA_ACCESS_PERMISSION_REQUEST            (webkit_website_data_access_permission_request_get_type())

#if GTK_CHECK_VERSION(3, 90, 0)

G_DECLARE_FINAL_TYPE(WebKitWebsiteDataAccessPermissionRequest, webkit_website_data_access_permission_request, WEBKIT, WEBSITE_DATA_ACCESS_PERMISSION_REQUEST, WebKitPermissionRequest)

#else

#define WEBKIT_WEBSITE_DATA_ACCESS_PERMISSION_REQUEST(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_WEBSITE_DATA_ACCESS_PERMISSION_REQUEST, WebKitWebsiteDataAccessPermissionRequest))
#define WEBKIT_IS_WEBSITE_DATA_ACCESS_PERMISSION_REQUEST(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_WEBSITE_DATA_ACCESS_PERMISSION_REQUEST))
#define WEBKIT_WEBSITE_DATA_ACCESS_PERMISSION_REQUEST_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),  WEBKIT_TYPE_WEBSITE_DATA_ACCESS_PERMISSION_REQUEST, WebKitWebsiteDataAccessPermissionRequestClass))
#define WEBKIT_IS_WEBSITE_DATA_ACCESS_PERMISSION_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),  WEBKIT_TYPE_WEBSITE_DATA_ACCESS_PERMISSION_REQUEST))
#define WEBKIT_WEBSITE_DATA_ACCESS_PERMISSION_REQUEST_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),  WEBKIT_TYPE_WEBSITE_DATA_ACCESS_PERMISSION_REQUEST, WebKitWebsiteDataAccessPermissionRequestClass))

typedef struct _WebKitWebsiteDataAccessPermissionRequest        WebKitWebsiteDataAccessPermissionRequest;
typedef struct _WebKitWebsiteDataAccessPermissionRequestClass   WebKitWebsiteDataAccessPermissionRequestClass;
typedef struct _WebKitWebsiteDataAccessPermissionRequestPrivate WebKitWebsiteDataAccessPermissionRequestPrivate;

struct _WebKitWebsiteDataAccessPermissionRequest {
    GObject parent;

    /*< private >*/
    WebKitWebsiteDataAccessPermissionRequestPrivate *priv;
};

struct _WebKitWebsiteDataAccessPermissionRequestClass {
    GObjectClass parent_class;

    void (*_webkit_reserved0) (void);
    void (*_webkit_reserved1) (void);
    void (*_webkit_reserved2) (void);
    void (*_webkit_reserved3) (void);
};

#endif

Now, let's say we remove the GTK 3 API in 2025. Then that's a lot of boilerplate we can remove from the header files five years from now. But if we don't switch to G_DECLARE_[FINAL,DERIVABLE]_TYPE now, we're stuck with it.

Or, for something completely different... we could use it in WebKitWebContext.h to hide functions entirely from the GTK 4 API:

#if !GTK_CHECK_VERSION(3, 90, 0)
WEBKIT_API void
webkit_web_context_set_sandbox_enabled              (WebKitWebContext              *context,
                                                     gboolean                       enabled);

WEBKIT_API gboolean
webkit_web_context_get_sandbox_enabled              (WebKitWebContext              *context);
#endif

Or consider WebKitWebPage.h, it's not meaningful to create your own WebKitWebPage, so why should the class struct be declared in a public header? Ideally every single public header would change for GTK 4, but we don't really want to have three copies of each header.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20200615/50ba11b2/attachment.htm>


More information about the webkit-unassigned mailing list