Bug 131121 - Remove code duplications when initializing InspectorServer (EFL and GTK)
Summary: Remove code duplications when initializing InspectorServer (EFL and GTK)
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Laszlo Vidacs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-02 13:22 PDT by Laszlo Vidacs
Modified: 2016-01-15 07:14 PST (History)
9 users (show)

See Also:


Attachments
Patch (8.69 KB, patch)
2014-04-02 13:34 PDT, Laszlo Vidacs
mcatanzaro: review+
mcatanzaro: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Laszlo Vidacs 2014-04-02 13:22:52 PDT
WebContextEfl.cpp and WebContextGTK.cpp contains similar static functions to initialize InspectorServer (initializeInspectorServer() vs initInspectorServer()). Create a common method called from both places.
Comment 1 Laszlo Vidacs 2014-04-02 13:34:18 PDT
Created attachment 228423 [details]
Patch
Comment 2 Michael Catanzaro 2016-01-06 20:02:01 PST
Comment on attachment 228423 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=228423&action=review

Sorry for the late review. Thanks for this nice cleanup.

> Source/WebKit2/UIProcess/InspectorServer/WebInspectorServer.cpp:41
> +#if PLATFORM(GTK) || PLATFORM(EFL)

This should be #if ENABLE(INSPECTOR_SERVER). INSPECTOR_SERVER is only used by GTK and EFL.

> Source/WebKit2/UIProcess/InspectorServer/WebInspectorServer.h:45
> +#if PLATFORM(GTK) || PLATFORM(EFL)

Ditto.

> Source/WebKit2/UIProcess/InspectorServer/WebInspectorServer.h:69
> +    static bool initialized;

You'll want to split this out:

#if PLATFORM(GTK) || PLATFORM(EFL)
    void buildPageList(Vector<char>& data, String& contentType);
#endif
#if ENABLE(INSPECTOR_SERVER)
    static bool initialized;
#endif

The extra #ifdef is messier here, but I think it's better to use the feature-specific rather than platform-specific conditionals where possible.