[Webkit-unassigned] [Bug 89719] [EFL][WK2] ProcessExecutablePath is required

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Jul 22 20:59:15 PDT 2012


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





--- Comment #12 from Raphael Kubo da Costa (rakuco) <rakuco at webkit.org>  2012-07-22 20:59:17 PST ---
(From update of attachment 153718)
View in context: https://bugs.webkit.org/attachment.cgi?id=153718&action=review

> Source/WebKit2/Shared/efl/ProcessExecutablePathEfl.cpp:33
> +static const char webKitWebProcessName[] = "WebProcess";
> +static const char webKitPluginProcessName[] = "PluginProcess";

The binary names are set in CMake, so hardcoding them here generates duplication and they may become out of sync in the future. These values should be passed directly from the build system.

> Source/WebKit2/Shared/efl/ProcessExecutablePathEfl.cpp:35
> +static String findWebKitProcess(const char* processName)

It probably makes sense to cache the return value so we do not need to perform the lookup every time this function is called.

> Source/WebKit2/Shared/efl/ProcessExecutablePathEfl.cpp:48
> +    ssize_t result = readlink("/proc/self/exe", readLinkBuffer, PATH_MAX);
> +    if (result > 0) {
> +        char* executablePathPtr = dirname(readLinkBuffer);
> +        String executablePath = WebCore::pathByAppendingComponent(String(executablePathPtr), processName);
> +
> +        // check whether process exist on the current path
> +        struct stat fileStat;
> +        if (!stat(executablePath.utf8().data(), &fileStat))
> +            return executablePath;
> +    }

With portability in mind, this implementation still does not look good, as it is very Linux-specific. GTK's own implementation in WTF at least performs a distinction between Linux and other Unices and has different code paths for them. Ideally, you should put this implementation within a #if OS(LINUX) check, have an #elif for OS(UNIX) and add a more generic implementation there which first checks if /proc/curproc/file exists and use that if it does (similar to what GTK does), and use argv[0]'s path otherwise. An #else might just include a notImplemented() call for Windows and the rest.

-- 
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