[WTF] Add environment variable helpers
authorross.kirsling@sony.com <ross.kirsling@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Feb 2019 20:03:28 +0000 (20:03 +0000)
committerross.kirsling@sony.com <ross.kirsling@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Feb 2019 20:03:28 +0000 (20:03 +0000)
commit6b676045e165e197de5a82341f6570c79222d9a9
tree894288407dc282f9cfd9853a0fe6f943fa2a58cd
parentabf53dd8a8bb79ab6b57f5627a6a085dfade1102
[WTF] Add environment variable helpers
https://bugs.webkit.org/show_bug.cgi?id=192405

Reviewed by Michael Catanzaro.

Source/JavaScriptCore:

* inspector/remote/glib/RemoteInspectorGlib.cpp:
(Inspector::RemoteInspector::RemoteInspector):
(Inspector::RemoteInspector::start):
* jsc.cpp:
(startTimeoutThreadIfNeeded):
* runtime/Options.cpp:
(JSC::overrideOptionWithHeuristic):
(JSC::Options::overrideAliasedOptionWithHeuristic):
(JSC::Options::initialize):
* runtime/VM.cpp:
(JSC::enableAssembler):
(JSC::VM::VM):
* tools/CodeProfiling.cpp:
(JSC::CodeProfiling::notifyAllocator):
Utilize WTF::Environment where possible.

Source/WebCore:

* platform/NotImplemented.h:
* platform/cocoa/SystemVersion.mm:
(WebCore::createSystemMarketingVersion):
* platform/graphics/gstreamer/GStreamerCommon.cpp:
(WebCore::initializeGStreamer):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
* platform/graphics/nicosia/NicosiaPaintingEngine.cpp:
(Nicosia::PaintingEngine::create):
* platform/graphics/texmap/TextureMapperFPSCounter.cpp:
(WebCore::TextureMapperFPSCounter::TextureMapperFPSCounter):
* platform/graphics/x11/PlatformDisplayX11.cpp:
(WebCore::PlatformDisplayX11::create):
* platform/gtk/RenderThemeWidget.cpp:
(WebCore::RenderThemeScrollbar::RenderThemeScrollbar):
* platform/gtk/ScrollbarThemeGtk.cpp:
(WebCore::ScrollbarThemeGtk::ScrollbarThemeGtk):
* platform/network/curl/CurlContext.cpp:
(WebCore::CurlContext::CurlContext):
(WebCore::EnvironmentVariableReader::read): Deleted.
(WebCore::EnvironmentVariableReader::defined): Deleted.
(WebCore::EnvironmentVariableReader::readAs): Deleted.
(WebCore::EnvironmentVariableReader::sscanTemplate): Deleted.
(WebCore::EnvironmentVariableReader::sscanTemplate<signed>): Deleted.
(WebCore::EnvironmentVariableReader::sscanTemplate<unsigned>): Deleted.
* platform/network/curl/NetworkStorageSessionCurl.cpp:
(WebCore::defaultCookieJarPath):
* platform/network/playstation/CurlSSLHandlePlayStation.cpp:
(WebCore::getCACertPathEnv):
* platform/network/win/CurlSSLHandleWin.cpp:
(WebCore::getCACertPathEnv):
* platform/text/hyphen/HyphenationLibHyphen.cpp:
(WebCore::topLevelPath):
(WebCore::webkitBuildDirectory):
* platform/unix/LoggingUnix.cpp:
(WebCore::logLevelString):
* platform/win/LoggingWin.cpp:
(WebCore::logLevelString):
Utilize WTF::Environment where possible.

Source/WebCore/PAL:

* pal/unix/LoggingUnix.cpp:
(PAL::logLevelString):
* pal/win/LoggingWin.cpp:
(PAL::logLevelString):
Utilize WTF::Environment where possible.

Source/WebKit:

* NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp:
(main):
* Platform/unix/EnvironmentUtilities.cpp:
(WebKit::EnvironmentUtilities::stripValuesEndingWithString):
* Platform/unix/LoggingUnix.cpp:
(WebKit::logLevelString):
* Platform/win/LoggingWin.cpp:
(WebKit::logLevelString):
* PluginProcess/mac/PluginProcessMac.mm:
(WebKit::shouldCallRealDebugger):
* Shared/Plugins/unix/PluginSearchPath.cpp:
(WebKit::pluginsDirectories):
* Shared/glib/ProcessExecutablePathGLib.cpp:
(WebKit::findWebKitProcess):
* UIProcess/API/glib/WebKitSettings.cpp:
(webKitSettingsConstructed):
(webKitSettingsSetProperty):
* UIProcess/API/glib/WebKitWebContext.cpp:
(injectedBundleDirectory):
(webkitWebContextConstructed):
* UIProcess/API/gtk/WebKitWebViewGtk.cpp:
(webkitWebViewMaximizeWindow):
(webkitWebViewRestoreWindow):
* UIProcess/API/wpe/WPEView.cpp:
(WKWPE::m_backend):
* UIProcess/AuxiliaryProcessProxy.cpp:
(WebKit::AuxiliaryProcessProxy::getLaunchOptions):
* UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
(WebKit::XDGDBusProxyLauncher::launch):
(WebKit::bindDBusSession):
(WebKit::bindX11):
(WebKit::bindWayland):
(WebKit::bindPulse):
(WebKit::bindPathVar):
(WebKit::bindGStreamerData):
(WebKit::bubblewrapSpawn):
* UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
(WebKit::ProcessLauncher::launchProcess):
* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::systemDirectoryPath):
(WebKit::ProcessLauncher::launchProcess):
* UIProcess/glib/WebProcessPoolGLib.cpp:
(WebKit::memoryPressureMonitorDisabled):
(WebKit::WebProcessPool::platformInitialize):
(WebKit::WebProcessPool::platformInitializeWebProcess):
* UIProcess/gtk/HardwareAccelerationManager.cpp:
(WebKit::HardwareAccelerationManager::HardwareAccelerationManager):
* WebProcess/EntryPoint/unix/WebProcessMain.cpp:
(main):
* WebProcess/gtk/WebProcessMainGtk.cpp:
* WebProcess/wpe/WebProcessMainWPE.cpp:
Utilize WTF::Environment where possible.

Source/WebKitLegacy/ios:

* Misc/WebUIKitSupport.mm:
(WebKitPlatformSystemRootDirectory):
Utilize WTF::Environment where possible.

Source/WebKitLegacy/mac:

* WebView/WebView.mm:
(-[WebView _initWithFrame:frameName:groupName:]):
Utilize WTF::Environment where possible.

Source/WTF:

Create a new Environment API as a platform-independent, thread-safe(r)
way to get and set environment variables.

* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/Environment.h: Added.
* wtf/PlatformGTK.cmake:
* wtf/PlatformJSCOnly.cmake:
* wtf/PlatformMac.cmake:
* wtf/PlatformPlayStation.cmake:
* wtf/PlatformWPE.cmake:
* wtf/PlatformWin.cmake:
* wtf/posix/EnvironmentPOSIX.cpp: Added.
* wtf/win/EnvironmentWin.cpp: Added.
Introduce WTF::Environment.

* wtf/Threading.cpp:
(WTF::threadingIsInitialized):
(WTF::initializeThreading):
* wtf/Threading.h:
Introduce WTF::threadingIsInitialized() so that we can ASSERT that it's
false before setting an environment variable through the new API.

* wtf/DataLog.cpp:
(WTF::initializeLogFileOnce):
* wtf/NumberOfCores.cpp:
(WTF::numberOfProcessorCores):
* wtf/posix/FileSystemPOSIX.cpp:
(WTF::FileSystemImpl::openTemporaryFile):
Utilize WTF::Environment where possible.

Tools:

* DumpRenderTree/mac/DumpRenderTree.mm:
(libraryPathForDumpRenderTree):
* DumpRenderTree/win/DumpRenderTree.cpp:
(libraryPathForDumpRenderTree):
* TestRunnerShared/IOSLayoutTestCommunication.cpp:
(setUpIOSLayoutTestCommunication):
* TestWebKitAPI/Tests/WebKit/EnvironmentUtilitiesTest.cpp:
(TestWebKitAPI::strip):
* TestWebKitAPI/Tests/WebKitGLib/TestAutomationSession.cpp:
(beforeAll):
* TestWebKitAPI/glib/WebKitGLib/TestMain.cpp:
(main):
* TestWebKitAPI/glib/WebKitGLib/WebKitTestBus.cpp:
(WebKitTestBus::run):
* WebKitTestRunner/InjectedBundle/gtk/ActivateFontsGtk.cpp:
(WTR::getOutputDir):
(WTR::initializeFontConfigSetting):
* WebKitTestRunner/InjectedBundle/gtk/InjectedBundleGtk.cpp:
(WTR::InjectedBundle::platformInitialize):
* WebKitTestRunner/InjectedBundle/gtk/InjectedBundleUtilities.cpp:
(WTR::topLevelPath):
* WebKitTestRunner/InjectedBundle/wpe/ActivateFontsWPE.cpp:
(WTR::topLevelPath):
(WTR::getOutputDir):
(WTR::activateFonts):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::libraryPathForTesting):
(WTR::TestController::generateContextConfiguration const):
(WTR::TestController::generatePageConfiguration):
(WTR::TestController::decideDestinationWithSuggestedFilename):
(WTR::TestController::platformAdjustContext):
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::cocoaPlatformInitialize):
(WTR::TestController::platformAdjustContext):
* WebKitTestRunner/gtk/main.cpp:
(main):
* WebKitTestRunner/mac/TestControllerMac.mm:
(WTR::TestController::configureContentExtensionForTest):
* WebKitTestRunner/wpe/main.cpp:
(main):
Utilize WTF::Environment where possible.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241559 268f45cc-cd09-0410-ab3c-d52691b4dbfc
86 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/inspector/remote/glib/RemoteInspectorGlib.cpp
Source/JavaScriptCore/jsc.cpp
Source/JavaScriptCore/runtime/Options.cpp
Source/JavaScriptCore/runtime/VM.cpp
Source/JavaScriptCore/tools/CodeProfiling.cpp
Source/WTF/ChangeLog
Source/WTF/WTF.xcodeproj/project.pbxproj
Source/WTF/wtf/CMakeLists.txt
Source/WTF/wtf/DataLog.cpp
Source/WTF/wtf/Environment.h [new file with mode: 0644]
Source/WTF/wtf/NumberOfCores.cpp
Source/WTF/wtf/PlatformGTK.cmake
Source/WTF/wtf/PlatformJSCOnly.cmake
Source/WTF/wtf/PlatformMac.cmake
Source/WTF/wtf/PlatformPlayStation.cmake
Source/WTF/wtf/PlatformWPE.cmake
Source/WTF/wtf/PlatformWin.cmake
Source/WTF/wtf/Threading.cpp
Source/WTF/wtf/Threading.h
Source/WTF/wtf/posix/EnvironmentPOSIX.cpp [new file with mode: 0644]
Source/WTF/wtf/posix/FileSystemPOSIX.cpp
Source/WTF/wtf/win/EnvironmentWin.cpp [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/PAL/ChangeLog
Source/WebCore/PAL/pal/unix/LoggingUnix.cpp
Source/WebCore/PAL/pal/win/LoggingWin.cpp
Source/WebCore/platform/NotImplemented.h
Source/WebCore/platform/cocoa/SystemVersion.mm
Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
Source/WebCore/platform/graphics/nicosia/NicosiaPaintingEngine.cpp
Source/WebCore/platform/graphics/texmap/TextureMapperFPSCounter.cpp
Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp
Source/WebCore/platform/gtk/RenderThemeWidget.cpp
Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp
Source/WebCore/platform/network/curl/CurlContext.cpp
Source/WebCore/platform/network/curl/NetworkStorageSessionCurl.cpp
Source/WebCore/platform/network/playstation/CurlSSLHandlePlayStation.cpp
Source/WebCore/platform/network/win/CurlSSLHandleWin.cpp
Source/WebCore/platform/text/hyphen/HyphenationLibHyphen.cpp
Source/WebCore/platform/unix/LoggingUnix.cpp
Source/WebCore/platform/win/LoggingWin.cpp
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp
Source/WebKit/Platform/unix/EnvironmentUtilities.cpp
Source/WebKit/Platform/unix/LoggingUnix.cpp
Source/WebKit/Platform/win/LoggingWin.cpp
Source/WebKit/PluginProcess/mac/PluginProcessMac.mm
Source/WebKit/Shared/Plugins/unix/PluginSearchPath.cpp
Source/WebKit/Shared/glib/ProcessExecutablePathGLib.cpp
Source/WebKit/UIProcess/API/glib/WebKitSettings.cpp
Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp
Source/WebKit/UIProcess/API/gtk/WebKitWebViewGtk.cpp
Source/WebKit/UIProcess/API/wpe/WPEView.cpp
Source/WebKit/UIProcess/AuxiliaryProcessProxy.cpp
Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp
Source/WebKit/UIProcess/Launcher/glib/ProcessLauncherGLib.cpp
Source/WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm
Source/WebKit/UIProcess/glib/WebProcessPoolGLib.cpp
Source/WebKit/UIProcess/gtk/HardwareAccelerationManager.cpp
Source/WebKit/WebProcess/EntryPoint/unix/WebProcessMain.cpp
Source/WebKit/WebProcess/gtk/WebProcessMainGtk.cpp
Source/WebKit/WebProcess/wpe/WebProcessMainWPE.cpp
Source/WebKitLegacy/ios/ChangeLog
Source/WebKitLegacy/ios/Misc/WebUIKitSupport.mm
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/WebView/WebView.mm
Tools/ChangeLog
Tools/DumpRenderTree/mac/DumpRenderTree.mm
Tools/DumpRenderTree/win/DumpRenderTree.cpp
Tools/TestRunnerShared/IOSLayoutTestCommunication.cpp
Tools/TestWebKitAPI/Tests/WebKit/EnvironmentUtilitiesTest.cpp
Tools/TestWebKitAPI/Tests/WebKitGLib/TestAutomationSession.cpp
Tools/TestWebKitAPI/glib/WebKitGLib/TestMain.cpp
Tools/TestWebKitAPI/glib/WebKitGLib/WebKitTestBus.cpp
Tools/WebKitTestRunner/InjectedBundle/gtk/ActivateFontsGtk.cpp
Tools/WebKitTestRunner/InjectedBundle/gtk/InjectedBundleGtk.cpp
Tools/WebKitTestRunner/InjectedBundle/gtk/InjectedBundleUtilities.cpp
Tools/WebKitTestRunner/InjectedBundle/wpe/ActivateFontsWPE.cpp
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/TestController.h
Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm
Tools/WebKitTestRunner/gtk/main.cpp
Tools/WebKitTestRunner/mac/TestControllerMac.mm
Tools/WebKitTestRunner/wpe/main.cpp