Ignore:
Timestamp:
Feb 14, 2019, 12:03:28 PM (7 years ago)
Author:
Ross Kirsling
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/VM.cpp

    r241557 r241559  
    150150#include "WebAssemblyFunction.h"
    151151#include "WebAssemblyWrapperFunction.h"
     152#include <wtf/Environment.h>
    152153#include <wtf/ProcessID.h>
    153154#include <wtf/ReadWriteLock.h>
     
    198199    }
    199200
    200     char* canUseJITString = getenv("JavaScriptCoreUseJIT");
    201     return !canUseJITString || atoi(canUseJITString);
     201    return !Environment::hasValue("JavaScriptCoreUseJIT", "0");
    202202}
    203203#endif // ENABLE(!ASSEMBLER)
     
    429429
    430430        StringPrintStream pathOut;
    431         const char* profilerPath = getenv("JSC_PROFILER_PATH");
    432         if (profilerPath)
     431        if (const char* profilerPath = Environment::getRaw("JSC_PROFILER_PATH"))
    433432            pathOut.print(profilerPath, "/");
    434433        pathOut.print("JSCProfile-", getCurrentProcessID(), "-", m_perBytecodeProfiler->databaseID(), ".json");
Note: See TracChangeset for help on using the changeset viewer.