Bug 131121

Summary: Remove code duplications when initializing InspectorServer (EFL and GTK)
Product: WebKit Reporter: Laszlo Vidacs <lvidacs.u-szeged>
Component: WebKit2Assignee: Laszlo Vidacs <lvidacs.u-szeged>
Status: NEW ---    
Severity: Normal CC: bunhere, cdumez, cgarcia, commit-queue, gns, gyuyoung.kim, lvidacs.u-szeged, ossy, sergio
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch mcatanzaro: review+, mcatanzaro: commit-queue-

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.