Ignore:
Timestamp:
Feb 14, 2019, 12:03:28 PM (6 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/tools/CodeProfiling.cpp

    r239255 r241559  
    2929#include "CodeProfile.h"
    3030#include "MachineContext.h"
     31#include <wtf/Environment.h>
    3132#include <wtf/MetaAllocator.h>
    3233
     
    8687{
    8788    // Check for JSC_CODE_PROFILING.
    88     const char* codeProfilingMode = getenv("JSC_CODE_PROFILING");
     89    auto codeProfilingMode = Environment::getUInt("JSC_CODE_PROFILING");
    8990    if (!codeProfilingMode)
    9091        return;
    9192
    92     // Check for a valid mode, currently "1", "2", or "3".
    93     if (!codeProfilingMode[0] || codeProfilingMode[1])
    94         return;
     93    // Check for a valid mode, currently 1, 2, or 3.
    9594    switch (*codeProfilingMode) {
    96     case '1':
     95    case 1:
    9796        s_mode = Enabled;
    9897        break;
    99     case '2':
     98    case 2:
    10099        s_mode = Verbose;
    101100        break;
    102     case '3':
     101    case 3:
    103102        s_mode = VeryVerbose;
    104103        break;
Note: See TracChangeset for help on using the changeset viewer.