haikuwebkit/Source/WTF/wtf/PlatformFTW.cmake

62 lines
1.3 KiB
CMake
Raw Permalink Normal View History

list(APPEND WTF_PUBLIC_HEADERS
text/win/WCharStringExtras.h
win/DbgHelperWin.h
win/GDIObject.h
win/SoftLinking.h
win/Win32Handle.h
)
list(APPEND WTF_PRIVATE_LIBRARIES
Dbghelp # For symbol handling <dbghelp.h>
Shlwapi # For file system operations <shlwapi.h>
)
list(APPEND WTF_LIBRARIES
Winmm # For multimedia functions, also used in <timeapi.h>
)
list(APPEND WTF_SOURCES
text/win/StringWin.cpp
text/win/TextBreakIteratorInternalICUWin.cpp
win/CPUTimeWin.cpp
win/DbgHelperWin.cpp
win/FileSystemWin.cpp
win/LanguageWin.cpp
Support WTF logging channels https://bugs.webkit.org/show_bug.cgi?id=228768 Source/WebKit: Reviewed by Fujii Hironori. No new tests because there is no behavior change. * GPUProcess/GPUProcess.cpp: (WebKit::GPUProcess::initializeGPUProcess): * GPUProcess/GPUProcessCreationParameters.cpp: (WebKit::GPUProcessCreationParameters::encode const): (WebKit::GPUProcessCreationParameters::decode): * GPUProcess/GPUProcessCreationParameters.h: * Shared/AuxiliaryProcess.cpp: (WebKit::AuxiliaryProcess::initialize): * Shared/WebKit2Initialize.cpp: (WebKit::InitializeWebKit2): * Shared/WebProcessCreationParameters.cpp: (WebKit::WebProcessCreationParameters::encode const): (WebKit::WebProcessCreationParameters::decode): * Shared/WebProcessCreationParameters.h: * UIProcess/Cocoa/GPUProcessProxyCocoa.mm: (WebKit::GPUProcessProxy::platformInitializeGPUProcessParameters): * UIProcess/Cocoa/WebProcessPoolCocoa.mm: (WebKit::WebProcessPool::platformInitializeWebProcess): * UIProcess/GPU/GPUProcessProxy.cpp: (WebKit::GPUProcessProxy::platformInitializeGPUProcessParameters): * UIProcess/WebProcessPool.cpp: * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): Source/WebKitLegacy/mac: Reviewed by Fujii Hironori. * WebView/WebView.mm: (-[WebView _commonInitializationWithFrameName:groupName:]): Source/WTF: This patch builds on top of https://bugs.webkit.org/show_bug.cgi?id=228809, which added shared infrastructure for logging. This patch simply triggers that shared infrastructure for WTF. There is no change in behavior - the existing WTF logging channels currently are all implemented independently in custom ways, so this patch just migrates them over to use the shared infrastructure. Reviewed by Fujii Hironori. * WTF.xcodeproj/project.pbxproj: * wtf/Assertions.h: * wtf/CMakeLists.txt: * wtf/LogInitialization.cpp: Added. (WTF::logChannels): * wtf/LogInitialization.h: Added. * wtf/Logging.cpp: Added. * wtf/Logging.h: Added. * wtf/MemoryPressureHandler.cpp: (WTF::MemoryPressureHandler::singleton): * wtf/MemoryPressureHandler.h: * wtf/PlatformFTW.cmake: * wtf/PlatformGTK.cmake: * wtf/PlatformJSCOnly.cmake: * wtf/PlatformMac.cmake: * wtf/PlatformPlayStation.cmake: * wtf/PlatformWPE.cmake: * wtf/PlatformWin.cmake: * wtf/RefCountedLeakCounter.cpp: * wtf/cocoa/LoggingCocoa.mm: Copied from Source/WebKit/UIProcess/Cocoa/GPUProcessProxyCocoa.mm. (WTF::logLevelString): * wtf/cocoa/MachSendRight.cpp: * wtf/cocoa/MainThreadCocoa.mm: * wtf/cocoa/MemoryPressureHandlerCocoa.mm: * wtf/unix/LoggingUnix.cpp: Added. (WTF::logLevelString): * wtf/win/LoggingWin.cpp: Added. (WTF::logLevelString): Canonical link: https://commits.webkit.org/240373@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280795 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-08-09 21:14:53 +00:00
win/LoggingWin.cpp
win/MainThreadWin.cpp
win/MemoryFootprintWin.cpp
win/MemoryPressureHandlerWin.cpp
win/OSAllocatorWin.cpp
win/PathWalker.cpp
win/RunLoopWin.cpp
win/ThreadingWin.cpp
win/WorkQueueWin.cpp
)
if (USE_CF)
list(APPEND WTF_PUBLIC_HEADERS
cf/CFURLExtras.h
cf/SpanCF.h
cf/TypeCastsCF.h
Move CFStringRef and NSString support from StringBuilder into StringConcatenateCF https://bugs.webkit.org/show_bug.cgi?id=225839 Reviewed by Sam Weinig. Source/JavaScriptCore: * inspector/ConsoleMessage.cpp: (Inspector::ConsoleMessage::ConsoleMessage): Use StringBuilder::clear instead of StringBuilder::resize; no advantage to the latter after calling StringBuilder::toString. * runtime/JSONObject.cpp: (JSC::Stringifier::Holder::appendNextProperty): Update for name change of StringBuilder::resize to StringBuilder::shrink. * runtime/TypeSet.cpp: (JSC::StructureShape::stringRepresentation): Ditto. Source/WebCore: * Modules/airplay/WebMediaSessionManager.cpp: (WebCore::mediaProducerStateString): Use StringBuilder exclusively instead of mixing it with makeString. Also updated for StringBuilder::shrink name. * html/HTMLTextFormControlElement.cpp: (WebCore::stripTrailingNewline): Updated for StringBuilder::shrink name. * page/CaptionUserPreferencesMediaAF.cpp: (WebCore::CaptionUserPreferencesMediaAF::captionsTextColor const): Tweaked coding style a bit. (WebCore::appendCSS): Use variadic StringBuilder::append instead of many separate calls. (WebCore::CaptionUserPreferencesMediaAF::captionsDefaultFontCSS const): Tweaked coding style a bit, and use variadic StrinBuilder::append calls to reduce the number of calls and streamline the code. (WebCore::CaptionUserPreferencesMediaAF::captionsStyleSheetOverride const): Ditto. Also removed unnecessary checks that strings are empty before appending. * page/scrolling/ScrollingCoordinator.cpp: (WebCore::ScrollingCoordinator::synchronousScrollingReasonsAsText): Updated for StringBuilder::shrink name. * platform/LayoutUnit.h: Updated for saturatedSum/Difference names. * platform/network/cocoa/NetworkStorageSessionCocoa.mm: (WebCore::NetworkStorageSession::cookiesForSession const): Tweaked codin style a bit, and use variadic StrinBuilder::append calls to reduce the number of calls and streamline the code. * rendering/RenderCounter.cpp: (WebCore::planCounter): Updated for saturatedSum name. * style/StyleBuilderCustom.h: (WebCore::Style::BuilderCustom::applyValueCounter): Ditto. * svg/SVGPathStringBuilder.cpp: (WebCore::SVGPathStringBuilder::result): Updated for StringBuilder::shrink name. * testing/Internals.cpp: (WebCore::Internals::pageMediaState): Ditto. * xml/XSLTProcessorLibxslt.cpp: (WebCore::saveResultToString): Ditto. Source/WebKit: * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::platformSetNetworkParameters): Use makeString instead of StringBuilder. Source/WTF: The new header makes CFStringRef and NSString work with string concatenation, which means it now works with the variadic StringBuilder::append and makeString, and still works with the single-argument StringBuilder::append. More efficient that the old version because it does not allocate a temporary WTF::String for the 16-bit character path. Also made many other small improvements to the StringBuilder implementation. * WTF.xcodeproj/project.pbxproj: Added StringConcatenateCF.h. * wtf/CheckedArithmetic.h: Removed ConditionalCrashOnOverflow, which was only here for use by StringBuilder, which does not use CheckedArithmetic any more. * wtf/PlatformFTW.cmake: Added StringConcatenateCF.h.. * wtf/PlatformMac.cmake: Ditto. * wtf/PlatformWin.cmake: Ditto. * wtf/SaturatedArithmetic.h: Moved the contents of this file inside the WTF namespace. (WTF::signedAddInt32Overflows): Renamed this function. The type here is important, and we are not doing anything to prevent type conversion or create ambiguity, so it's good to be explicit in the function name. (WTF::saturatedSum<int32_t>): Renamed this from saturatedAddition for clarity. The function returns a sum, so that's a better name than calling it "addition". Also, it's clearer to be explicit about the return type. (WTF::signedSubtractInt32Overflows): Renamed. Same reason as above. (WTF::saturatedDifference<int32_t>): Ditto. (WTF::saturatedSum): Added. Does unsigned integer saturated addition. This one can be written in a portable manner and still get really efficient code on at least Intel and ARM64. (WTF::saturatedSum): Added a function template that lets callers pass larger number of arguments to saturatedSum, rather than exactly two. * wtf/text/StringBuilder.cpp: (WTF::expandedCapacity): Renamed to use the term capacity rather than length for the new required capacity. (WTF::StringBuilder::didOverflow): Implement the new approach to overflow, meaning we need to write the CRASH() here explicitly and in the non-crashing mode, set m_length. (WTF::StringBuilder::reifyString const): Changed the overflow check into a RELEASE_ASSERT. This is now responsible for doing the check that callers were doing earlier, so we want it in production builds. Also simplified this since our m_length member is a simple integer now, and removed the unused m_isReified. (WTF::StringBuilder::shrink): Renamed this to shrink to match the Vector::shrink function, since this has never supported making the builder larger. Removed unnecessary overflow checks, since shrinking cannot cause overflow. (WTF::StringBuilder::allocateBuffer): Replaced two separate functions with a single simpler function template. Removed extra overflow checks because the StringImpl::tryCreateUninitialized function already does the only overflow check we need. Also move to StringImpl::copyCharacters for copying characters rather than using std::memcpy directly. Removed code to set m_is8Bit and m_bufferCharacters. (WTF::StringBuilder::reallocateBuffer): Replaced two separate functions with a function template and a cover that calls the appropriate instance of the template for places where we aren't already in character-type-specific code paths. This version now supports allocating a buffer for the first time in cases where we have m_string and not m_buffer, which used to be handled at the higher level. Removed code to set m_bufferCharacters. (WTF::StringBuilder::reserveCapacity): Rewrote for simplicity. By relying on the overflow checking inside reallocateBuffer and allocateBuffer we no longer need checking of the passed-in value at this level. (WTF::StringBuilder::extendBufferForAppending): Removed the version of this that takes additionalLength since it's potentially confusing to have a family of functions that have the same name and take the same type of argument, but interpret it subtly differently. Streamlined the code using std::exchange. This function now also includes the logic from the function named extendBufferForAppendingWithoutOverflowCheck, which was subtly misnamed since that was not the only semantic difference. Also removed the ALWAYS_INLINE because the compiler will do the right thing without such heavy handed advice. (WTF::StringBuilder::extendBufferForAppendingSlowCase): Streamlined this by using std::exchange and removed additional overflow checks at this level since reallocateBuffer already does them. Also added a check for the case where the new total length is 0, which would not be handled correctly and efficiently by reallocateBuffer. (WTF::StringBuilder::extendBufferForAppendingLChar): Renamed this from extendBufferForAppending8, since it's now identical to calling extendBufferForAppending<LChar>, except for inlining and linkage. (WTF::StringBuilder::extendBufferForAppendingWithUpconvert): Renamed this from extendBufferForAppending16. It is different from the other extendBuffer functions because is supports upconverting from LChar to UChar. Like the others it relies on allocateBuffer for the overflow checking. (WTF::StringBuilder::appendCharacters): Removed an unnecessary assertion that the characters pointer is non-null; that will fail in an obvious way without an assertion. Simplified the logic and removed some invariant assertions that don't help us much. Changed overflow checking by using saturatedSum to compute the new length. In overflow cases, the new sum will be larger than the maximum string length, but will fit in an unsigned, so we can pass it down to lower levels and let functions like reallocateBuffer do the actual overflow checking. Also use StringImpl::copyCharacters. (WTF::StringBuilder::append): Removed the CFStringRef overload. (WTF::StringBuilder::shouldShrinkToFit const): Rename this from canShrink. Simplify the function a bit and remove the vague FIXME that says "this should be tuned". That may be so, but the FIXME is not really driving us to action. (WTF::StringBuilder::shrinkToFit): Simplify by using the new reallocateBuffer and std::exchange. Removed unneeded assertion about overflow that doesn't help us maintain the invariant. (WTF::StringBuilder::isAllASCII const): Was tempted to remove this function, but for now just made it use the StringView version for brevity. * wtf/text/StringBuilder.h: Removed many unneeded includes, and notably included SaturatedArithmetic.h instead of CheckedArithmetic.h because we now use the former instead of the latter. Changed the overflow checking implementation to work more simply based on saturated addition rather than Checked. This allowed us to get rid of dependency on our own unique mode for Checked, called ConditionalCrashOnOverflow. Removed a comment about making a templatized version of StringBuilder. We can do it if we like, but does not seem urgent. Moved fucntion bodies out of the class definition so it's easier to see what's going on in the class. Since m_length is now an ordinary integer, the check for overflowed simply checks to see if the length is larger than the maximum string length. When we encounter overflow that is not about length computation, we set the length to the maximum integer to indicate the failure. Deleted the append overloads for CFStringRef and NSString. Removed m_bufferCharacters, m_is8Bit, and m_isReified. (WTF::StringBuilder::StringBuilder): Simplified the constructor since we only have to initialize the m_shouldCrashOnOverflow member. (WTF::StringBuilder::clear): Fixed a mistake where this was not resetting the m_isReified flag. (WTF::StringBuilder::swap): Updated for changes in the data members. (WTF::StringBuilder::operator StringView const): Moved out of line. Made sure to call the length() function so we crash if this is called after overflow. (WTF::StringBuilder::append): Remove some of the unnecessary checks and special cases in the various versions of append. Most of the checking is done inside appendCharacters, with only a few exceptions. (WTF::StringBuilder::appendSubstring): Moved out of the class definition without making significant changes. (WTF::StringBuilder::appendCharacter): Ditto. (WTF::StringBuilder::toString): Greatly simplified this function by relying on overflow checking in the reifyString function instead of doing it here and removing unneeded invariant assertions. (WTF::StringBuilder::toStringPreserveCapacity const): Ditto. (WTF::StringBuilder::toAtomString const): Rewrote this to streamline, removing explicit overflow checks. (WTF::StringBuilder::length const): Moved out of the class definition without making significant changes. (WTF::StringBuilder::capacity const): Ditto. (WTF::StringBuilder::operator[] const): Ditto. (WTF::StringBuilder::characters const): Implemented this operation in the function template. Now rather than having this call the characters8 and characters16 functions, they can call it. (WTF::StringBuilder::getBufferCharacters<LChar>): Deleted. (WTF::StringBuilder::getBufferCharacters<UChar>): Deleted. (WTF::StringBuilder::appendFromAdapters): Use saturatedSum to compute the required length, which allows the extendBuffer functions to do overflow checking without having to take special checked integer types for arguments. (WTF::StringBuilder::equal): Implement using StringView. * wtf/text/StringBuilderJSON.cpp: (WTF::StringBuilder::appendQuotedJSONString): Simplified the checked arithmetic for computing the required capacity. Updated since we removed m_bufferCharacters and changed the type of m_length. * wtf/text/cf/StringConcatenateCF.h: Added. Specializes StringTypeAdapter for both CFStringRef and NSString *. If CFStringGetCStringPtr works for Latin-1, then does the 8-bit code path, otherwise the 16-bit. * wtf/text/cocoa/TextStreamCocoa.mm: Include StringConcatenateCF.h, since it's now needed to use CFStringRef with StringBuilder. Tools: * TestWebKitAPI/Tests/WTF/SaturatedArithmeticOperations.cpp: Updated tests for changes to SaturatedArithmetic.h. * TestWebKitAPI/Tests/WTF/StringBuilder.cpp: Updated tests for changes to StringBuilder. * TestWebKitAPI/Tests/WebKit/GetUserMedia.mm: (TestWebKitAPI::wkMediaCaptureStateString): Ditto. * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: Added include of StringConcatenateCF.h. Added StringTypeAdapter for WKStringRef. (WTR::styleDecToStr): Use ASCIILiteral instead of StringBuilder. (WTR::string): Removed unneeded toWTFString since the WKStringRef StringTypeAdapter takes care of it. (WTR::string): Renamed from frameToStr. Use makeString. (WTR::dumpResourceURL): Use append instead of appendLiteral. (WTR::dumpFrameDescriptionSuitableForTestResult): Deleted. (WTR::dumpLoadEvent): Use makeString. (WTR::string): Renamed from a longer name. Return a String instead of building in a StringBuilder. Use makeString. (WTR::string): Ditto. (WTR::dumpErrorDescriptionSuitableForTestResult): Removed unneeded toWTFString. (WTR::dumpFrameScrollPosition): Ditto. (WTR::dumpDescendantFramesText): Ditto. (WTR::InjectedBundlePage::dumpDOMAsWebArchive): Removed an unneeded local variable. (WTR::InjectedBundlePage::dump): Removed unneeded toWTFString. (WTR::InjectedBundlePage::didReceiveTitleForFrame): Ditto. (WTR::InjectedBundlePage::didFinishDocumentLoadForFrame): Updated for functon name change. (WTR::InjectedBundlePage::willSendRequestForFrame): Ditto. Also use variadic append. Also use makeString. (WTR::InjectedBundlePage::didReceiveResponseForResource): Ditto. (WTR::InjectedBundlePage::didFinishLoadForResource): Ditto. (WTR::InjectedBundlePage::didFailLoadForResource): Ditto. (WTR::InjectedBundlePage::decidePolicyForNavigationAction): Ditto. (WTR::InjectedBundlePage::decidePolicyForResponse): Ditto. (WTR::InjectedBundlePage::willAddMessageToConsole): Ditto. (WTR::InjectedBundlePage::willSetStatusbarText): Ditto. (WTR::InjectedBundlePage::willRunJavaScriptPrompt): Ditto. (WTR::InjectedBundlePage::didExceedDatabaseQuota): Ditto. (WTR::InjectedBundlePage::shouldInsertNode): Ditto. (WTR::InjectedBundlePage::shouldInsertText): Ditto. (WTR::InjectedBundlePage::shouldDeleteRange): Ditto. (WTR::InjectedBundlePage::shouldChangeSelectedRange): Ditto. (WTR::InjectedBundlePage::shouldApplyStyle): Ditto. (WTR::InjectedBundlePage::didBeginEditing): Ditto. (WTR::InjectedBundlePage::didEndEditing): Ditto. (WTR::InjectedBundlePage::didChange): Ditto. (WTR::InjectedBundlePage::didChangeSelection): Ditto. (WTR::InjectedBundlePage::dumpHistory): Ditto. Canonical link: https://commits.webkit.org/237916@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277744 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-19 19:37:21 +00:00
text/cf/StringConcatenateCF.h
text/cf/TextBreakIteratorCF.h
)
list(APPEND WTF_SOURCES
cf/CFURLExtras.cpp
cf/FileSystemCF.cpp
cf/URLCF.cpp
text/cf/AtomStringImplCF.cpp
text/cf/StringCF.cpp
text/cf/StringImplCF.cpp
text/cf/StringViewCF.cpp
)
list(APPEND WTF_LIBRARIES ${COREFOUNDATION_LIBRARY})
endif ()
set(WTF_OUTPUT_NAME WTF${DEBUG_SUFFIX})