RESOLVED FIXED 126173
[GTK][WK2] Simplify ProcessExecutablePathGtk
https://bugs.webkit.org/show_bug.cgi?id=126173
Summary [GTK][WK2] Simplify ProcessExecutablePathGtk
Zan Dobersek
Reported 2013-12-23 12:03:22 PST
[GTK][WK2] Simplify ProcessExecutablePathGtk
Attachments
Patch (3.86 KB, patch)
2013-12-23 12:13 PST, Zan Dobersek
no flags
Patch (4.07 KB, patch)
2013-12-23 13:33 PST, Zan Dobersek
no flags
Initial patch (4.22 KB, patch)
2014-01-09 12:55 PST, Bear Travis
no flags
Zan Dobersek
Comment 1 2013-12-23 12:13:00 PST
Martin Robinson
Comment 2 2013-12-23 12:29:27 PST
Comment on attachment 219923 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=219923&action=review > Source/WebKit2/Shared/gtk/ProcessExecutablePathGtk.cpp:51 > + static CString executablePath = getCurrentExecutablePath(); > if (!executablePath.isNull()) { > - String processPath = pathByAppendingComponent(executablePath, processName); > + String processPath = pathByAppendingComponent(directoryName(filenameToString(executablePath.data())), processName); > if (fileExists(processPath)) > return processPath; This is a little slower, because directoryName and filenameToString runs for each path, but not much.
Zan Dobersek
Comment 3 2013-12-23 13:06:03 PST
Comment on attachment 219923 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=219923&action=review >> Source/WebKit2/Shared/gtk/ProcessExecutablePathGtk.cpp:51 >> return processPath; > > This is a little slower, because directoryName and filenameToString runs for each path, but not much. I can further store return values of findWebKitProcess in static variables in executablePathOf*Process. This would limit the number of times that findWebKitProcess is called to 3. If that sounds OK I can upload a new patch.
Martin Robinson
Comment 4 2013-12-23 13:10:36 PST
(In reply to comment #3) > (From update of attachment 219923 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=219923&action=review > > >> Source/WebKit2/Shared/gtk/ProcessExecutablePathGtk.cpp:51 > >> return processPath; > > > > This is a little slower, because directoryName and filenameToString runs for each path, but not much. > > I can further store return values of findWebKitProcess in static variables in executablePathOf*Process. This would limit the number of times that findWebKitProcess is called to 3. > > If that sounds OK I can upload a new patch. It seems simpler to cache the return value of directoryName(filenameToString(...)), but if this function is called only a few times, I don't think it's a big deal.
Zan Dobersek
Comment 5 2013-12-23 13:21:51 PST
Comment on attachment 219923 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=219923&action=review >>>> Source/WebKit2/Shared/gtk/ProcessExecutablePathGtk.cpp:51 >>>> return processPath; >>> >>> This is a little slower, because directoryName and filenameToString runs for each path, but not much. >> >> I can further store return values of findWebKitProcess in static variables in executablePathOf*Process. This would limit the number of times that findWebKitProcess is called to 3. >> >> If that sounds OK I can upload a new patch. > > It seems simpler to cache the return value of directoryName(filenameToString(...)), but if this function is called only a few times, I don't think it's a big deal. This will now be called whenever a new process is being created. It's unnecessary work, really. I can offload all of this (getCurrentExecutablePath, filenameToString and directoryName calls) into a small helper static function. Its return value would then be stored in the static variable, so it would only get called once.
Zan Dobersek
Comment 6 2013-12-23 13:33:30 PST
Zan Dobersek
Comment 7 2013-12-23 14:04:11 PST
Comment on attachment 219929 [details] Patch Clearing flags on attachment: 219929 Committed r161020: <http://trac.webkit.org/changeset/161020>
Zan Dobersek
Comment 8 2013-12-23 14:04:18 PST
All reviewed patches have been landed. Closing bug.
Bear Travis
Comment 9 2014-01-09 12:55:44 PST
Reopening to attach new patch.
Bear Travis
Comment 10 2014-01-09 12:55:45 PST
Created attachment 220760 [details] Initial patch
Martin Robinson
Comment 11 2014-01-09 13:14:15 PST
(In reply to comment #10) > Created an attachment (id=220760) [details] > Initial patch Wrong bug?
Bear Travis
Comment 12 2014-01-09 23:28:28 PST
Yes, apologies. Was wondering where webkit-patch sent this one.
Note You need to log in before you can comment on or make changes to this bug.