Changeset 161020 in webkit
- Timestamp:
- Dec 23, 2013 2:07:40 PM (10 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r161018 r161020 1 2013-12-23 Zan Dobersek <zdobersek@igalia.com> 2 3 [GTK][WK2] Simplify ProcessExecutablePathGtk 4 https://bugs.webkit.org/show_bug.cgi?id=126173 5 6 Reviewed by Martin Robinson. 7 8 Don't store process name strings in global variables -- each of the names is only used in the relevant 9 function, so the string can be directly passed into the findWebKitProcess function call. 10 11 Simplify the findWebKitProcess function. Make the execDirectory variable static so that g_getenv is only 12 called once, as it's not expected for the WEBKIT_EXEC_PATH environment variable to change during the runtime. 13 14 Introduce the getExecutablePath helper function that gets the current executable path and, if non-null, returns 15 the directory path of that executable. The helper function preserves the small performance improvement of querying 16 and processing the executable path only once. 17 The return value of getExecutablePath is stored in a static variable and is used to construct the process path 18 if the executable path was successfully retrieved. 19 20 * Shared/gtk/ProcessExecutablePathGtk.cpp: 21 (WebKit::getExecutablePath): 22 (WebKit::findWebKitProcess): 23 (WebKit::executablePathOfWebProcess): 24 (WebKit::executablePathOfPluginProcess): 25 (WebKit::executablePathOfNetworkProcess): 26 1 27 2013-12-23 Zan Dobersek <zdobersek@igalia.com> 2 28 -
trunk/Source/WebKit2/Shared/gtk/ProcessExecutablePathGtk.cpp
r155934 r161020 36 36 namespace WebKit { 37 37 38 const char* gWebKitWebProcessName = "WebKitWebProcess"; 39 const char* gWebKitPluginProcessName = "WebKitPluginProcess"; 40 const char* gWebKitNetworkProcessName = "WebKitNetworkProcess"; 38 static String getExecutablePath() 39 { 40 CString executablePath = getCurrentExecutablePath(); 41 if (!executablePath.isNull()) 42 return directoryName(filenameToString(executablePath.data())); 43 return String(); 44 } 41 45 42 46 static String findWebKitProcess(const char* processName) 43 47 { 44 const char* execDirectory = g_getenv("WEBKIT_EXEC_PATH");48 static const char* execDirectory = g_getenv("WEBKIT_EXEC_PATH"); 45 49 if (execDirectory) { 46 50 String processPath = pathByAppendingComponent(filenameToString(execDirectory), processName); … … 49 53 } 50 54 51 static bool gotExecutablePath = false; 52 static String executablePath; 53 if (!gotExecutablePath) { 54 gotExecutablePath = true; 55 56 CString executableFile = getCurrentExecutablePath(); 57 if (!executableFile.isNull()) 58 executablePath = directoryName(filenameToString(executableFile.data())); 59 } 60 55 static String executablePath = getExecutablePath(); 61 56 if (!executablePath.isNull()) { 62 57 String processPath = pathByAppendingComponent(executablePath, processName); … … 70 65 String executablePathOfWebProcess() 71 66 { 72 return findWebKitProcess( gWebKitWebProcessName);67 return findWebKitProcess("WebKitWebProcess"); 73 68 } 74 69 75 70 String executablePathOfPluginProcess() 76 71 { 77 return findWebKitProcess( gWebKitPluginProcessName);72 return findWebKitProcess("WebKitPluginProcess"); 78 73 } 79 74 … … 81 76 String executablePathOfNetworkProcess() 82 77 { 83 return findWebKitProcess( gWebKitNetworkProcessName);78 return findWebKitProcess("WebKitNetworkProcess"); 84 79 } 85 80 #endif
Note: See TracChangeset
for help on using the changeset viewer.