blob: c424fcf61b783af37b2772beb8501cab63327fa0 [file] [log] [blame]
2021-10-13 Megan Gardner <megan_gardner@apple.com>
Scroll To Text Fragment directive parsing
https://bugs.webkit.org/show_bug.cgi?id=231410
Reviewed by Chris Dumez.
Text directive parsing for
https://wicg.github.io/scroll-to-text-fragment/
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-10-13 Chris Dumez <cdumez@apple.com>
Drop makeWeakPtr() and use WeakPtr { } directly
https://bugs.webkit.org/show_bug.cgi?id=231679
Reviewed by Darin Adler.
* wtf/WeakHashMap.h:
* wtf/WeakHashSet.h:
(WTF::copyToVector):
* wtf/WeakPtr.h:
(WTF::makeWeakPtr): Deleted.
2021-10-13 Jean-Yves Avenard <jya@apple.com>
Clearly distinguish serial from concurrent WorkQueue
https://bugs.webkit.org/show_bug.cgi?id=231418
rdar://problem/84021977
Reviewed by Chris Dumez.
We split the WorkQueue code so that it becomes either a serial or concurrent one.
A concurrent WorkQueue doesn't guarantee the order in which the queued tasks will run.
That makes for a footgun if a consumer took a WorkQueue and was expecting
it to be a serial one.
WorkQueue (serial) and ConcurrentWorkQueue are made to both inherit from WorkQueueBase.
A class should inherit from either the WorkQueue or the ConcurrentWorkQueue class.
The Storage class present in NetworkCacheStore is the only code that was
using a WorkQueue that could be either. For this class we will pass a
WorkQueueBase; use of the base class directly is discouraged.
No change in observable behaviour.
* wtf/SuspendableWorkQueue.cpp:
(WTF::SuspendableWorkQueue::SuspendableWorkQueue):
* wtf/WorkQueue.cpp:
(WTF::WorkQueueBase::create): removed
(WTF::WorkQueueBase::WorkQueueBase):
(WTF::WorkQueueBase::~WorkQueueBase):
(WTF::WorkQueue::create):
(WTF::ConcurrentWorkQueue::create):
(WTF::WorkQueueBase::dispatchSync):
(WTF::ConcurrentWorkQueue:apply):
* wtf/WorkQueue.h:
(WTF::WorkQueueBase::dispatchQueue const):
(WTF::executeFunction): remove unused method declaration.
(WTF::WorkQueue::runLoop const):
(WTF::WorkQueue::WorkQueue):
(WTF::ConcurrentWorkQueue::ConcurrentWorkQueue):
* wtf/cocoa/WorkQueueCocoa.cpp:
(WTF::WorkQueueBase::dispatch):
(WTF::WorkQueueBase::dispatchAfter):
(WTF::WorkQueueBase::dispatchSync):
(WTF::WorkQueueBase::WorkQueueBase):
(WTF::WorkQueueBase::platformInitialize):
(WTF::WorkQueueBase::platformInvalidate):
(WTF::WorkQueue::WorkQueue):
(WTF::WorkQueue::constructMainWorkQueue):
(WTF::ConcurrentWorkQueue::apply):
* wtf/generic/WorkQueueGeneric.cpp:
(WorkQueue::WorkQueue):
(WorkQueueBase::WorkQueueBase):
(WorkQueueBase::platformInitialize):
(WorkQueueBase::platformInvalidate):
(WorkQueueBase::dispatch):
(WorkQueueBase::dispatchAfter):
2021-10-13 Sihui Liu <sihui_liu@apple.com>
Enable FileSystemAccess and AccessHandle by default
https://bugs.webkit.org/show_bug.cgi?id=231677
Reviewed by Youenn Fablet.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-10-13 Alex Christensen <achristensen@webkit.org>
Remove WTF::Variant and WTF::get
https://bugs.webkit.org/show_bug.cgi?id=231675
Reviewed by Chris Dumez.
* wtf/Variant.h:
(WTF::get): Deleted.
2021-10-13 Chris Dumez <cdumez@apple.com>
Stop using makeWeakPtr() in WebCore
https://bugs.webkit.org/show_bug.cgi?id=231651
Reviewed by Alex Christensen.
* wtf/WeakPtr.h:
(WTF::WeakPtr::WeakPtr):
(WTF::WeakPtr::implForObject):
2021-10-13 Philippe Normand <pnormand@igalia.com>
CLang build warning in CheckedPtr.h
https://bugs.webkit.org/show_bug.cgi?id=231672
Reviewed by Alex Christensen.
Assert on the wrapped pointer. Asserting on `this` always results to true, defeating the
purpose of the ASSERT.
* wtf/CheckedPtr.h:
(WTF::CheckedPtr::operator* const):
(WTF::CheckedPtr::operator*):
2021-10-12 Alex Christensen <achristensen@webkit.org>
Use std::variant instead of WTF::Variant
https://bugs.webkit.org/show_bug.cgi?id=231629
Reviewed by Chris Dumez.
* wtf/LikelyDenseUnsignedIntegerSet.h:
* wtf/SmallSet.h:
* wtf/text/TextBreakIterator.cpp:
(WTF::mapModeToBackingIterator):
* wtf/text/TextBreakIterator.h:
* wtf/text/cocoa/TextBreakIteratorInternalICUCocoa.cpp:
(WTF::mapModeToBackingIterator):
2021-10-12 Tim Horton <timothy_horton@apple.com>
Remove some unused UIKit SPI declarations
https://bugs.webkit.org/show_bug.cgi?id=231646
Reviewed by Wenson Hsieh.
* wtf/PlatformHave.h:
2021-10-12 Sihui Liu <sihui_liu@apple.com>
Implement FileSystemSyncAccessHandle read() and write()
https://bugs.webkit.org/show_bug.cgi?id=231466
<rdar://problem/84050394>
Reviewed by Youenn Fablet.
* wtf/PlatformHave.h:
2021-10-12 Chris Dumez <cdumez@apple.com>
Decrease use of makeWeakPtr()
https://bugs.webkit.org/show_bug.cgi?id=231615
Reviewed by Alex Christensen.
Decrease use of makeWeakPtr() and use WeakPtr { } directly instead.
* wtf/CancellableTask.h:
(WTF::TaskCancellationGroup::Handle::Handle):
* wtf/ListHashSet.h:
(WTF::ListHashSetConstIterator::ListHashSetConstIterator):
(WTF::ListHashSetConstIterator::operator++):
(WTF::ListHashSetConstIterator::operator--):
* wtf/WeakHashSet.h:
2021-10-12 David Kilzer <ddkilzer@apple.com>
Switch WTF::bridge_cast to use type traits
<https://webkit.org/b/231467>
<rdar://problem/84050614>
Reviewed by Darin Adler.
* wtf/cocoa/TollFreeBridging.h: Add.
(WTF::CFTollFreeBridgingTraits): Add.
(WTF::NSTollFreeBridgingTraits): Add.
- Define type traits for CF and NS classes with toll-free
bridging.
* wtf/cocoa/TypeCastsCocoa.h:
(WTF::bridge_cast):
- Make use of type traits in TollFreeBridging.h.
2021-10-12 Simon Fraser <simon.fraser@apple.com>
Add support for ScrollOptions' ScrollBehavior and CSS scroll-behavior properties
https://bugs.webkit.org/show_bug.cgi?id=188043
<rdar://48436802>
Reviewed by Myles C. Maxfield.
Enable CSS smooth scrolling by default.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-10-12 Alex Christensen <achristensen@webkit.org>
Use STL instead of WTF::get_if, WTF::Monostate, WTF::visit, and WTF::holds_alternative
https://bugs.webkit.org/show_bug.cgi?id=231582
Reviewed by Darin Adler.
* wtf/Variant.h:
(WTF::switchOn):
(): Deleted.
(WTF::visit): Deleted.
(WTF::get_if): Deleted.
2021-10-12 Chris Dumez <cdumez@apple.com>
Allow direct construction of WeakPtr without makeWeakPtr()
https://bugs.webkit.org/show_bug.cgi?id=231580
Reviewed by Darin Adler.
Allow direct construction of WeakPtr without makeWeakPtr(), and deprecate makeWeakPtr().
* wtf/WeakPtr.h:
(WTF::WeakPtr::WeakPtr):
(WTF::WeakPtr::implForObject):
(WTF::makeWeakPtr):
2021-10-12 Ross Kirsling <ross.kirsling@sony.com>
Unreviewed WinCairo build fix for r283943.
* wtf/JSONValues.h:
2021-10-12 Alex Christensen <achristensen@webkit.org>
Remove non-HAVE(CFNETWORK_NSURLSESSION_STRICTRUSTEVALUATE) code
https://bugs.webkit.org/show_bug.cgi?id=231579
Reviewed by Chris Dumez.
* wtf/PlatformHave.h:
This was incorrectly marked as not being available on watchOS and tvOS. It is.
2021-10-12 Alex Christensen <achristensen@webkit.org>
Begin migration from WTF::Variant to std::variant
https://bugs.webkit.org/show_bug.cgi?id=231086
Reviewed by Chris Dumez.
This is reasonably close to just changing the header and all the code stays the same until later.
Templates that were only used once like std::variant_size I just changed inline instead of adding a wrapper to Variant.h.
WTF::get still means something else, so I just changed the few that take a Variant parameter to std::get in the code.
WTF::in_place maps to std::in_place_type and std::in_place_index_t, so I just changed those in the code too.
There was also another visitor added since r283906 with different return types among the lambdas, so I just fixed it with the switch.
* wtf/Forward.h:
* wtf/Hasher.h:
(WTF::add):
* wtf/Variant.h:
(WTF::get):
(WTF::visit):
(WTF::get_if):
(WTF::in_place): Deleted.
(WTF::__throw_bad_variant_access): Deleted.
(WTF::=): Deleted.
(WTF::__variant_storage::__get): Deleted.
(WTF::__variant_storage::__get_rref): Deleted.
(WTF::__variant_storage::__destroy): Deleted.
(WTF::__storage_wrapper::__construct): Deleted.
(WTF::__storage_wrapper::__storage_wrapper): Deleted.
(WTF::__storage_wrapper::__get): Deleted.
(WTF::__storage_wrapper::__get const): Deleted.
(WTF::__storage_wrapper::__destroy): Deleted.
(WTF::__storage_wrapper<_Type::__storage_wrapper): Deleted.
(WTF::__storage_wrapper<_Type::__get): Deleted.
(WTF::__storage_wrapper<_Type::__get const): Deleted.
(WTF::__variant_base::~__variant_base): Deleted.
(WTF::__backup_storage_ops::__move_construct_func): Deleted.
(WTF::__backup_storage_ops::__destroy_func): Deleted.
(WTF::__backup_storage::__backup_storage): Deleted.
(WTF::__backup_storage::__destroy): Deleted.
(WTF::__backup_storage::~__backup_storage): Deleted.
(WTF::Variant<>::swap): Deleted.
(WTF::__NOEXCEPT_): Deleted.
(WTF::__variant_accessor::get): Deleted.
(WTF::__visitor_table::__trampoline_func): Deleted.
(WTF::__arg_selector): Deleted.
(WTF::__visit_helper2::__visit): Deleted.
(WTF::operator==): Deleted.
(WTF::operator!=): Deleted.
(WTF::operator<): Deleted.
(WTF::operator>): Deleted.
(WTF::operator>=): Deleted.
(WTF::operator<=): Deleted.
(WTF::__hash_visitor::operator()): Deleted.
2021-10-11 Alex Christensen <achristensen@webkit.org>
Only mark needed JSONImpl::ObjectBase functions with WTF_EXPORT_PRIVATE
https://bugs.webkit.org/show_bug.cgi?id=231521
Reviewed by Chris Dumez.
I'm trying some wild experiments with the linker, and when I do the weak symbol checker fails because
it is trying to export some of the inline functions at the bottom of JSONValues.h.
Moving WTF_EXPORT_PRIVATE from exporting the whole class to only exporting the non-inline functions fixes it.
* wtf/JSONValues.h:
2021-10-11 Dean Jackson <dino@apple.com>
Disable SystemPreview in WKContentProviderRegistry
https://bugs.webkit.org/show_bug.cgi?id=231538
rdar://84110761
Reviewed by Tim Horton.
Revert the change in r283811.
* wtf/PlatformUse.h:
2021-10-11 Alex Christensen <achristensen@webkit.org>
Prepare to switch from WTF::Variant to std::variant
https://bugs.webkit.org/show_bug.cgi?id=231239
Reviewed by Chris Dumez.
This is the pieces of bug 231086 that can be done without changing behavior.
1. It makes WTF::get_if look more like std::get_if by taking a pointer to a variant instead of a reference.
2. std::visit is pickier than WTF::visit. The former allows taking lambdas with different return types as long
as the return types can be converted to the overall desired return type. std::visit has a static_assert that the
return types of all the lambdas are all exactly the same type, so I explicitly declare the return type of many lambdas.
3. It also resolves some types that will become ambiguous by using WTF::in_place,
which will become wrapped by std::in_place_type then removed.
4. It adds a few explicit WTF:: and #include <wtf/Variant.h> that will be needed after removing Variant from Forward.h.
5. It removes the fast malloc check in the one place a Variant is dynamically allocated in KeyedDecoderGeneric.cpp
(which is for non-cocoa platforms) because std::variant isn't fast allocated.
* wtf/LikelyDenseUnsignedIntegerSet.h:
(WTF::LikelyDenseUnsignedIntegerSet::iterator::operator* const):
* wtf/Variant.h:
(WTF::get_if):
2021-10-08 Tim Horton <timothy_horton@apple.com>
defaultAlternateFormControlDesignEnabled() can't read UIUserInterfaceIdiom in the Web Content process
https://bugs.webkit.org/show_bug.cgi?id=231416
<rdar://problem/84009054>
Reviewed by Anders Carlsson.
* Scripts/Preferences/WebPreferences.yaml:
Remove the autogenerated default.
2021-10-08 Dean Jackson <dino@apple.com>
Disable SYSTEM_PREVIEW when UIKit internals is enabled
https://bugs.webkit.org/show_bug.cgi?id=231438
rdar://84019482
Reviewed by Tim Horton.
We're going to replace SystemPreview with the <model>
element, so disable it when UIKit internals are enabled.
* wtf/PlatformUse.h:
2021-10-08 Antti Koivisto <antti@apple.com>
Make WTF::IteratorRange reversible
https://bugs.webkit.org/show_bug.cgi?id=231415
Reviewed by Darin Adler.
Also export some names out of the WTF namespace.
* wtf/IteratorRange.h:
(WTF::IteratorRange::rbegin const):
(WTF::IteratorRange::rend const):
2021-10-07 Aditya Keerthi <akeerthi@apple.com>
[css-ui] Parsing support for accent-color
https://bugs.webkit.org/show_bug.cgi?id=231334
rdar://83955508
Reviewed by Antti Koivisto.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-10-07 Chris Dumez <cdumez@apple.com>
Add feature flag for COOP / COEP violation reporting and turn off by default
https://bugs.webkit.org/show_bug.cgi?id=231371
Reviewed by Youenn Fablet.
Add feature flag for COOP / COEP violation reporting and turn off by default since our
implementation doesn't match the latest specification.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-10-06 Sihui Liu <sihui_liu@apple.com>
Add support for FileSystemSyncAccessHandle
https://bugs.webkit.org/show_bug.cgi?id=231185
<rdar://problem/83847859>
Reviewed by Youenn Fablet.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
* wtf/FileSystem.h:
* wtf/glib/FileSystemGlib.cpp:
(WTF::FileSystemImpl::flushFile):
* wtf/posix/FileSystemPOSIX.cpp:
(WTF::FileSystemImpl::flushFile):
* wtf/win/FileSystemWin.cpp:
(WTF::FileSystemImpl::flushFile):
2021-10-06 Aditya Keerthi <akeerthi@apple.com>
Fix watchOS, tvOS, and macCatalyst builds after r283592
https://bugs.webkit.org/show_bug.cgi?id=231300
rdar://83936867
Reviewed by Wenson Hsieh.
* wtf/PlatformEnableCocoa.h:
* wtf/PlatformHave.h:
2021-10-06 Megan Gardner <megan_gardner@apple.com>
Allow text selection to flip.
https://bugs.webkit.org/show_bug.cgi?id=231234
rdar://83889188
Reviewed by Wenson Hsieh.
Add an internal flag to guard text selection flipping while
we test to make sure this is reasonable to turn on everywhere.
* Scripts/Preferences/WebPreferencesInternal.yaml:
2021-10-05 Tim Horton <timothy_horton@apple.com>
Add an alternate style for form controls, and implement it for checkboxes and radio buttons
https://bugs.webkit.org/show_bug.cgi?id=231160
Reviewed by Sam Weinig.
* Scripts/Preferences/WebPreferences.yaml:
2021-10-05 David Kilzer <ddkilzer@apple.com>
Follow-up #2: WTF::RetainPtr<> allows assignment of two pointer types that are not assignable
<https://webkit.org/b/230406>
<rdar://problem/83241893>
Unreviewed attempt to fix API tests.
* wtf/cocoa/TypeCastsCocoa.h:
(WTF::checked_objc_cast):
- Rename checked_objc_cast<> to checked_objc_castARC<> when
compiling with ARC enabled.
- Also mark as `inline` function to allow for optimization.
2021-10-05 Cameron McCormack <heycam@apple.com>
Enable 2D canvas color space support on Apple platforms
https://bugs.webkit.org/show_bug.cgi?id=231145
<rdar://82948394>
Reviewed by Simon Fraser.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-10-04 Chris Dumez <cdumez@apple.com>
Add SPI to launch a service service worker in a WKWebView and expose service worker to injected bundle
https://bugs.webkit.org/show_bug.cgi?id=231045
<rdar://problem/83744069>
Reviewed by Geoff Garen.
* wtf/URL.cpp:
(WTF::protocolHostAndPortAreEqual):
Fix issue where protocolHostAndPortAreEqual() was doing a case-sensitive check. My new service worker
API test was initially failing because of this since it is using an upper-case domain name.
2021-10-04 Sam Weinig <weinig@apple.com>
Split WebXR extension module IDLs into their own files and settings
https://bugs.webkit.org/show_bug.cgi?id=231149
Reviewed by Dean Jackson.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
Adds WebXRAugmentedRealityModuleEnabled and WebXRGamepadsModuleEnabled
to gate enabling the WebXR AR Module and the WebXR Gamepads Module on.
2021-10-03 David Kilzer <ddkilzer@apple.com>
WTF::RetainPtr<> allows assignment of two pointer types that are not assignable
<https://webkit.org/b/230406>
<rdar://problem/83241893>
Reviewed by Darin Adler.
* wtf/RetainPtr.h:
(WTF::RetainPtr::RetainPtr):
(WTF::RetainPtr::checkType): Add.
- Add type check for move constructor.
* wtf/cocoa/TypeCastsCocoa.h:
- Change #include to #import.
(WTF_CF_TO_NS_BRIDGE_TRANSFER): Add.
(WTF_CF_TO_NS_BRIDGE_TRANSFER): Add.
- Helper macros for bridge_cast() and bridge_id_cast().
(WTF_DECLARE_CF_NS_BRIDGE_CAST): Add.
- Macro used to define bridge_cast() functions for all known
toll-free-bridged types.
(WTF::bridge_cast): Add.
- Helper macro for toll-free-bridge casting from a known CF type
to and from their Objective-C NS type. Prevents ref churn for
rvale RetainPtr<> objects.
(WTF::bridge_id_cast): Add.
- Helper macro for casting from any CFTypeRef to id. Prevents
ref churn for rvalue RetainPtr<> objects.
(WTF::checked_objc_cast):
- Simplified to match dynamic_objc_cast<> implementation in
RetainPtr.h.
* wtf/cocoa/VectorCocoa.h:
(WTF::createNSArray):
- Change return type to match object.
2021-10-03 Basuke Suzuki <basuke.suzuki@sony.com>
Enable release log to stderr
https://bugs.webkit.org/show_bug.cgi?id=230725
<rdar://problem/83740529>
Reviewed by Michael Catanzaro.
Define new compiler definitions, USE_LOG_STDERR for release logging. We don't have
modern logging backend so that dumping out to stdout/stderr is still very valuable.
* wtf/Assertions.cpp:
* wtf/Assertions.h:
* wtf/Logger.h:
(WTF::Logger::log):
(WTF::Logger::logVerbose):
2021-10-02 Philippe Normand <pnormand@igalia.com>
[GLib] Media session manager unable to handle more than one session
https://bugs.webkit.org/show_bug.cgi?id=230250
Reviewed by Adrian Perez de Castro.
* wtf/glib/GRefPtr.h: Forward-declare GDBusConnection.
2021-10-01 Yusuke Suzuki <ysuzuki@apple.com>
Upgrade in-tree OSS ICU header to 64.2 because macOS Mojave build will be dropped
https://bugs.webkit.org/show_bug.cgi?id=231104
Reviewed by Myles C. Maxfield.
WebKit no longer supports macOS Mojave build. This means that we can upgrade in-tree ICU header,
which is only used when OSS WebKit is built. ICU 64.2 is ICU shipped in macOS Catalina.
* icu/LICENSE:
* icu/README:
* icu/unicode/alphaindex.h:
* icu/unicode/brkiter.h:
* icu/unicode/bytestream.h:
(StringByteSink::StringByteSink):
* icu/unicode/calendar.h:
* icu/unicode/caniter.h:
* icu/unicode/casemap.h:
* icu/unicode/char16ptr.h:
(Char16Ptr::Char16Ptr):
(Char16Ptr::~Char16Ptr):
(Char16Ptr::get const):
(ConstChar16Ptr::ConstChar16Ptr):
(ConstChar16Ptr::~ConstChar16Ptr):
(ConstChar16Ptr::get const):
(toUCharPtr):
(toOldUCharPtr):
* icu/unicode/coll.h:
* icu/unicode/compactdecimalformat.h:
* icu/unicode/currpinf.h:
(CurrencyPluralInfo::operator!= const):
* icu/unicode/currunit.h:
* icu/unicode/datefmt.h:
* icu/unicode/dcfmtsym.h:
* icu/unicode/decimfmt.h:
* icu/unicode/docmain.h:
* icu/unicode/dtintrv.h:
* icu/unicode/dtitvfmt.h:
* icu/unicode/dtitvinf.h:
* icu/unicode/dtptngen.h:
* icu/unicode/edits.h:
* icu/unicode/enumset.h:
* icu/unicode/filteredbrk.h:
* icu/unicode/fmtable.h:
* icu/unicode/formattedvalue.h: Added.
* icu/unicode/gender.h:
* icu/unicode/icuplug.h:
* icu/unicode/listformatter.h:
* icu/unicode/localebuilder.h: Added.
* icu/unicode/localpointer.h:
(LocalPointer::LocalPointer):
(LocalPointer::operator std::unique_ptr<T> ):
(LocalArray::LocalArray):
(LocalArray::operator std::unique_ptr<T[]> ):
* icu/unicode/locdspnm.h:
* icu/unicode/locid.h:
(Locale::toLanguageTag const):
(Locale::getKeywords const):
(Locale::getUnicodeKeywords const):
(Locale::getKeywordValue const):
(Locale::getUnicodeKeywordValue const):
* icu/unicode/measfmt.h:
* icu/unicode/measunit.h:
* icu/unicode/messagepattern.h:
* icu/unicode/msgfmt.h:
* icu/unicode/normalizer2.h:
* icu/unicode/nounit.h:
* icu/unicode/numberformatter.h:
* icu/unicode/numberrangeformatter.h: Added.
* icu/unicode/numfmt.h:
* icu/unicode/numsys.h:
* icu/unicode/parsepos.h:
* icu/unicode/platform.h:
* icu/unicode/plurfmt.h:
* icu/unicode/plurrule.h:
* icu/unicode/ptypes.h:
* icu/unicode/rbbi.h:
* icu/unicode/rbnf.h:
* icu/unicode/regex.h:
* icu/unicode/region.h:
* icu/unicode/reldatefmt.h:
* icu/unicode/simpleformatter.h:
* icu/unicode/smpdtfmt.h:
* icu/unicode/stringoptions.h:
* icu/unicode/stringtriebuilder.h:
* icu/unicode/timezone.h:
* icu/unicode/translit.h:
* icu/unicode/tzfmt.h:
* icu/unicode/ubidi.h:
* icu/unicode/ubiditransform.h:
* icu/unicode/ucal.h:
* icu/unicode/uchar.h:
* icu/unicode/ucnv.h:
* icu/unicode/ucol.h:
* icu/unicode/uconfig.h:
* icu/unicode/ucpmap.h: Added.
* icu/unicode/ucptrie.h: Added.
* icu/unicode/ucurr.h:
* icu/unicode/udat.h:
* icu/unicode/udateintervalformat.h:
* icu/unicode/udatpg.h:
* icu/unicode/uenum.h:
* icu/unicode/uformattedvalue.h: Added.
* icu/unicode/ugender.h:
* icu/unicode/ulistformatter.h:
* icu/unicode/umachine.h:
* icu/unicode/umutablecptrie.h: Added.
* icu/unicode/uniset.h:
* icu/unicode/unistr.h:
* icu/unicode/unum.h:
* icu/unicode/unumberformatter.h:
* icu/unicode/unumsys.h:
* icu/unicode/uobject.h:
* icu/unicode/upluralrules.h:
* icu/unicode/uregex.h:
* icu/unicode/ureldatefmt.h:
* icu/unicode/urename.h:
* icu/unicode/ures.h:
* icu/unicode/uscript.h:
* icu/unicode/usearch.h:
* icu/unicode/uset.h:
* icu/unicode/uspoof.h:
* icu/unicode/ustring.h:
* icu/unicode/utext.h:
* icu/unicode/utf16.h:
* icu/unicode/utf8.h:
* icu/unicode/utypes.h:
* icu/unicode/uvernum.h:
2021-10-01 Chris Dumez <cdumez@apple.com>
Drop support for macOS < 10.15
https://bugs.webkit.org/show_bug.cgi?id=231085
Reviewed by Darin Adler.
* wtf/PlatformEnableCocoa.h:
* wtf/PlatformHave.h:
* wtf/PlatformUse.h:
2021-10-01 Youenn Fablet <youenn@apple.com>
Add support for PushEvent
https://bugs.webkit.org/show_bug.cgi?id=231007
<rdar://problem/83707470>
Reviewed by Chris Dumez.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-10-01 Chris Dumez <cdumez@apple.com>
Drop legacy USE(LEGACY_CFNETWORK_DOWNLOADS) code paths
https://bugs.webkit.org/show_bug.cgi?id=231081
Reviewed by Alex Christensen.
Drop legacy USE(LEGACY_CFNETWORK_DOWNLOADS) code paths, as we no longer support Mac OS 14 Mojave.
* wtf/PlatformUse.h:
2021-09-30 Sihui Liu <sihui_liu@apple.com>
Make File System Access API available in Worker
https://bugs.webkit.org/show_bug.cgi?id=230805
<rdar://problem/83552511>
Reviewed by Youenn Fablet.
* wtf/CrossThreadCopier.h:
2021-09-30 Eddy Wong <eddy_wong@apple.com>
Adopt presentationSceneIdentifierForPaymentAuthorizationController delegate call from PassKit
https://bugs.webkit.org/show_bug.cgi?id=230874
Reviewed by Devin Rousso.
* wtf/PlatformEnableCocoa.h: Defines new flag ENABLE_APPLE_PAY_REMOTE_UI_USES_SCENE
2021-09-30 Darin Adler <darin@apple.com>
Add StdLibExtras.h include to a file that uses bitwise_cast without including it
https://bugs.webkit.org/show_bug.cgi?id=231027
Reviewed by Yusuke Suzuki.
* wtf/RawPtrTraits.h: Include StdLibExtras.h.
2021-09-29 Fujii Hironori <Hironori.Fujii@sony.com>
[WinCairo] REGRESSION(r280726): registry keys enabling GPU process mode don't work
https://bugs.webkit.org/show_bug.cgi?id=230871
Reviewed by Don Olmstead.
* wtf/PlatformHave.h: r270175 defined HAVE_SYSTEM_FEATURE_FLAGS
for Windows to use WebKit::isFeatureFlagEnabled. But, it is no
longer needed.
2021-09-29 Kiet Ho <tho22@apple.com>
Implement the 'ic' unit from CSS Values 4
https://bugs.webkit.org/show_bug.cgi?id=204276
<rdar://problem/57256127>
Reviewed by Myles C. Maxfield.
* wtf/unicode/CharacterNames.h: add CJK water glyph (U+6C34) constant.
2021-09-29 Antti Koivisto <antti@apple.com>
[CSS Cascade Layers] Enable by default
https://bugs.webkit.org/show_bug.cgi?id=230948
Reviewed by Simon Fraser.
Flip the switch.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-09-28 Yusuke Suzuki <ysuzuki@apple.com>
iOS simulator build should use PTHREAD_JIT_PERMISSIONS_API
https://bugs.webkit.org/show_bug.cgi?id=230920
rdar://77494871
Reviewed by Filip Pizlo.
In AppleSilicon macOS, we should use PTHREAD_JIT_PERMISSIONS_API for OSS build.
However, we are not enabling that for iOS simulator build. This patch enables that.
This API exists after iOS 14.0 SDK.
* wtf/PlatformUse.h:
2021-09-28 Alex Christensen <achristensen@webkit.org>
Mostly fix Mac CMake build
https://bugs.webkit.org/show_bug.cgi?id=230868
Reviewed by Don Olmstead.
* wtf/PlatformMac.cmake:
2021-09-28 Yusuke Suzuki <ysuzuki@apple.com>
Unreviewed, fix Windows build
https://bugs.webkit.org/show_bug.cgi?id=230876
* wtf/GenericTimeMixin.h:
(WTF::GenericTimeMixin::operator+=):
(WTF::GenericTimeMixin::operator-=):
2021-09-27 Yusuke Suzuki <ysuzuki@apple.com>
[WTF] Add ApproximateTime
https://bugs.webkit.org/show_bug.cgi?id=230876
Reviewed by Filip Pizlo.
* WTF.xcodeproj/project.pbxproj:
* wtf/ApproximateTime.cpp: Copied from Source/WTF/wtf/ClockType.cpp.
(WTF::ApproximateTime::approximateWallTime const):
(WTF::ApproximateTime::approximateMonotonicTime const):
(WTF::ApproximateTime::dump const):
* wtf/ApproximateTime.h: Copied from Source/WTF/wtf/MonotonicTime.h.
(WTF::ApproximateTime::MarkableTraits::isEmptyValue):
(WTF::ApproximateTime::MarkableTraits::emptyValue):
(std::isnan):
(std::isinf):
(std::isfinite):
* wtf/CMakeLists.txt:
* wtf/ClockType.cpp:
(WTF::printInternal):
* wtf/ClockType.h:
* wtf/CurrentTime.cpp:
(WTF::MonotonicTime::fromMachAbsoluteTime):
(WTF::MonotonicTime::toMachAbsoluteTime const):
(WTF::ApproximateTime::fromMachApproximateTime):
(WTF::ApproximateTime::toMachApproximateTime const):
(WTF::ApproximateTime::now):
* wtf/MonotonicTime.h:
* wtf/Seconds.cpp:
(WTF::Seconds::operator+ const):
(WTF::Seconds::operator- const):
* wtf/Seconds.h:
* wtf/TimeWithDynamicClockType.cpp:
(WTF::TimeWithDynamicClockType::now):
(WTF::TimeWithDynamicClockType::approximateTime const):
(WTF::TimeWithDynamicClockType::approximateWallTime const):
(WTF::TimeWithDynamicClockType::approximateMonotonicTime const):
* wtf/TimeWithDynamicClockType.h:
* wtf/WallTime.h:
2021-09-27 Antti Koivisto <antti@apple.com>
[LFC] Use CheckedRef/Ptr instead of WeakPtr
https://bugs.webkit.org/show_bug.cgi?id=230821
Reviewed by Alan Bujtas.
* wtf/CheckedRef.h:
(WTF::CanMakeCheckedPtrBase::incrementPtrCount const):
(WTF::CanMakeCheckedPtrBase::decrementPtrCount const):
(WTF::CanMakeCheckedPtrBase::incrementPtrCount): Deleted.
(WTF::CanMakeCheckedPtrBase::decrementPtrCount): Deleted.
Make const so CheckedPtr<const Foo> works.
2021-09-27 Jean-Yves Avenard <jya@apple.com>
Vorbis decoder can't be instantiated - Remove workaround added in bug 228139
https://bugs.webkit.org/show_bug.cgi?id=230742
rdar://83484414
Reviewed by Eric Carlson.
* wtf/PlatformUse.h: Add USE_VORBIS_AUDIOCOMPONENT_WORKAROUND
2021-09-27 Saam Barati <sbarati@apple.com>
Build an unlinked baseline JIT
https://bugs.webkit.org/show_bug.cgi?id=229223
<rdar://problem/82321772>
Reviewed by Yusuke Suzuki.
* wtf/Bag.h:
* wtf/Packed.h:
(WTF::PackedAlignedPtr::operator* const):
2021-09-27 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r283102, r283103 and r283104.
https://bugs.webkit.org/show_bug.cgi?id=230854
It regresses JetStream2 on iOS devices
Reverted changesets:
"Build an unlinked baseline JIT"
https://bugs.webkit.org/show_bug.cgi?id=229223
https://commits.webkit.org/r283102
"Unreviewed, fix CLoop build"
https://bugs.webkit.org/show_bug.cgi?id=229223
https://commits.webkit.org/r283103
"Unreviewed, fix CLoop build part 2"
https://bugs.webkit.org/show_bug.cgi?id=229223
https://commits.webkit.org/r283104
2021-09-27 Saam Barati <sbarati@apple.com>
Build an unlinked baseline JIT
https://bugs.webkit.org/show_bug.cgi?id=229223
<rdar://problem/82321772>
Reviewed by Yusuke Suzuki.
* wtf/Bag.h:
* wtf/Packed.h:
(WTF::PackedAlignedPtr::operator* const):
2021-09-26 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r283083 and r283088.
https://bugs.webkit.org/show_bug.cgi?id=230806
Windows pors are crashing
Reverted changesets:
"Build an unlinked baseline JIT"
https://bugs.webkit.org/show_bug.cgi?id=229223
https://commits.webkit.org/r283083
"Make byte codes with arithmetic profiles switch to using an
index instead of a pointer in metadata"
https://bugs.webkit.org/show_bug.cgi?id=230798
https://commits.webkit.org/r283088
2021-09-25 Saam Barati <sbarati@apple.com>
Build an unlinked baseline JIT
https://bugs.webkit.org/show_bug.cgi?id=229223
<rdar://problem/82321772>
Reviewed by Yusuke Suzuki.
* wtf/Bag.h:
* wtf/Packed.h:
(WTF::PackedAlignedPtr::operator* const):
2021-09-24 Devin Rousso <drousso@apple.com>
Add typechecking `is` overloads for `std::unique_ptr`, `WTF::UniqueRef`, and `WTF::WeakPtr`
https://bugs.webkit.org/show_bug.cgi?id=230734
Reviewed by Chris Dumez.
* wtf/StdLibExtras.h:
* wtf/TypeCasts.h:
(WTF::is):
* wtf/UniqueRef.h:
(WTF::GetPtrHelper<UniqueRef<T>>::getPtr): Added.
(WTF::is): Added.
* wtf/WeakPtr.h:
(WTF::is): Added.
2021-09-24 Jonathan Bedard <jbedard@apple.com>
[iOS 15] Support building WebKit (Part 3)
https://bugs.webkit.org/show_bug.cgi?id=227002
<rdar://problem/79316598>
Reviewed by Ryan Haddad.
* wtf/spi/darwin/XPCSPI.h: Import NSError header.
2021-09-23 Tim Horton <timothy_horton@apple.com>
Move more linked-on-or-after checks to WebCore::linkedOnOrAfter()
https://bugs.webkit.org/show_bug.cgi?id=230694
Reviewed by Wenson Hsieh.
* wtf/spi/darwin/dyldSPI.h:
2021-09-23 Jean-Yves Avenard <jya@apple.com>
Opus and Vorbis codecs aren't available on iPad.
https://bugs.webkit.org/show_bug.cgi?id=230595
rdar://problem/83382734
Vorbis and Opus are usable on platforms other than macOS and are being checked
at runtime already.
Reviewed by Eric Carlson.
* wtf/PlatformEnableCocoa.h:
2021-09-22 Chris Dumez <cdumez@apple.com>
Drop makeRef() and use Ref { } instead
https://bugs.webkit.org/show_bug.cgi?id=230626
Reviewed by Alex Christensen.
* wtf/Ref.h:
2021-09-22 Brady Eidson <beidson@apple.com>
Disable FTP.
<rdar://81193860> and https://bugs.webkit.org/show_bug.cgi?id=230477
Reviewed by Geoff Garen.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
* wtf/URL.cpp:
(WTF::URL::protocolIsInFTPFamily const):
(WTF::protocolIsInFTPFamily):
* wtf/URL.h:
2021-09-22 Simon Fraser <simon.fraser@apple.com>
Remove ENABLE(SMOOTH_SCROLLING)
https://bugs.webkit.org/show_bug.cgi?id=230587
Reviewed by Tim Horton.
ENABLE(SMOOTH_SCROLLING) was always enabled on macOS, so remove it. The pref defaults
to true on macOS, and false elsewhere.
* Scripts/Preferences/WebPreferences.yaml:
* wtf/PlatformEnable.h:
* wtf/PlatformEnableCocoa.h:
2021-09-21 Simon Fraser <simon.fraser@apple.com>
Change from ENABLE(RUBBER_BANDING) to HAVE(RUBBER_BANDING)
https://bugs.webkit.org/show_bug.cgi?id=230583
Reviewed by Tim Horton.
RUBBER_BANDING is not a feature we'll ever turn off on macOS, and it was only ever enabled
for that platform. However, it's also used in some cross-platform code, so
HAVE(RUBBER_BANDING) makes more sense for that use.
Also remove ENABLE(RUBBER_BANDING) #ifdefs from inside PLATFORM(MAC) code.
* Scripts/Preferences/WebPreferences.yaml:
* wtf/PlatformHave.h:
2021-09-21 Chris Dumez <cdumez@apple.com>
Reduce use of makeRef() and use Ref { } instead
https://bugs.webkit.org/show_bug.cgi?id=230585
Reviewed by Alex Christensen.
* wtf/WeakPtr.h:
(WTF::WeakPtrFactory::createWeakPtr const):
2021-09-21 Yusuke Suzuki <ysuzuki@apple.com>
[WTF] Use Int128 in MediaTime
https://bugs.webkit.org/show_bug.cgi?id=230575
Reviewed by Eric Carlson.
Previously, __int128_t exists only in 64bit clang and GCC environments. But now
we always have Int128. Int128 is __int128_t in 64bit clang and GCC, and Int128 library
implementation in the other environments. So we always use Int128 code in MediaTime.
* wtf/MediaTime.cpp:
(WTF::MediaTime::setTimeScale):
2021-09-21 Chris Dumez <cdumez@apple.com>
Drop makeRefPtr() and use RefPtr { } directly instead
https://bugs.webkit.org/show_bug.cgi?id=230564
Reviewed by Alex Christensen.
* wtf/RefPtr.h:
2021-09-21 David Kilzer <ddkilzer@apple.com>
Rename {checked,dynamic}_ns_cast<> to {checked,dynamic}_objc_cast<>
<https://webkit.org/b/230508>
<rdar://problem/83323145>
Reviewed by Brent Fulgham.
* WTF.xcodeproj/project.pbxproj:
* wtf/PlatformMac.cmake:
- Update for rename of TypeCastsNS.h to TypeCastsCocoa.h.
* wtf/RetainPtr.h:
(WTF::dynamic_objc_cast):
- Move dynamic_ns_cast<> from TypeCastsNS.h to here.
- Remove `using` statements to limit Objective-C types without
asterisks to match RetainPtr<>.
* wtf/cocoa/TypeCastsCocoa.h: Rename from TypeCastsNS.h.
(WTF::checked_objc_cast):
(WTF::dynamic_objc_cast):
- Do the rename.
- Remove "using WTF::dynamic_ns_cast;" instead of renaming it
since this is already in RetainPtr.h.
2021-09-21 Jer Noble <jer.noble@apple.com>
[iOS] Enable MSE in WKWebViews by default on iPad
https://bugs.webkit.org/show_bug.cgi?id=230426
Reviewed by Tim Horton.
Give a default value getter for the MediaSourceEnabled preference.
* Scripts/Preferences/WebPreferences.yaml:
2021-09-21 Philip Chimento <philip.chimento@gmail.com>
Add LLVM/FLang's int128_t implementation to WTF
https://bugs.webkit.org/show_bug.cgi?id=230437
Added int128_t implementation from LLVM, and its dependency
LeadingZeroBitCount.h. Both reformatted according to WebKit style.
Reviewed by Yusuke Suzuki.
* LICENSE-LLVM.txt: Added.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/Int128.h: Added.
(WTF::Int128Impl::Int128Impl):
(WTF::Int128Impl::operator+ const):
(WTF::Int128Impl::operator~ const):
(WTF::Int128Impl::operator- const):
(WTF::Int128Impl::operator! const):
(WTF::Int128Impl::operator bool const):
(WTF::Int128Impl::operator std::uint64_t const):
(WTF::Int128Impl::operator std::int64_t const):
(WTF::Int128Impl::operator int const):
(WTF::Int128Impl::high const):
(WTF::Int128Impl::low const):
(WTF::Int128Impl::operator++):
(WTF::Int128Impl::operator--):
(WTF::Int128Impl::operator& const):
(WTF::Int128Impl::operator | const):
(WTF::Int128Impl::operator^ const):
(WTF::Int128Impl::operator<< const):
(WTF::Int128Impl::operator>> const):
(WTF::Int128Impl::operator* const):
(WTF::Int128Impl::operator/ const):
(WTF::Int128Impl::operator% const):
(WTF::Int128Impl::operator< const):
(WTF::Int128Impl::operator<= const):
(WTF::Int128Impl::operator== const):
(WTF::Int128Impl::operator!= const):
(WTF::Int128Impl::operator>= const):
(WTF::Int128Impl::operator> const):
(WTF::Int128Impl::operator&=):
(WTF::Int128Impl::operator|=):
(WTF::Int128Impl::operator^=):
(WTF::Int128Impl::operator<<=):
(WTF::Int128Impl::operator>>=):
(WTF::Int128Impl::operator+=):
(WTF::Int128Impl::operator-=):
(WTF::Int128Impl::operator*=):
(WTF::Int128Impl::operator/=):
(WTF::Int128Impl::operator%=):
(WTF::Int128Impl::leadingZeroes const):
* wtf/LeadingZeroBitCount.cpp: Added.
* wtf/LeadingZeroBitCount.h: Added.
(WTF::leadingZeroBitCount):
(WTF::bitsNeededFor):
2021-09-20 Chris Dumez <cdumez@apple.com>
Reduce use of makeRefPtr() and use RefPtr { } directly
https://bugs.webkit.org/show_bug.cgi?id=230503
Reviewed by Geoffrey Garen.
* wtf/CrossThreadTask.h:
(WTF::createCrossThreadTask):
2021-09-20 Wenson Hsieh <wenson_hsieh@apple.com>
Refactor some code that controls Live Text selection behavior
https://bugs.webkit.org/show_bug.cgi?id=230482
rdar://83173597
Reviewed by Megan Gardner.
Add an (off-by-default) internal feature to enable certain enhancements to Live Text.
* Scripts/Preferences/WebPreferencesInternal.yaml:
2021-09-20 Brent Fulgham <bfulgham@apple.com>
Remove XSS Auditor: Part 1 (Turn off by default)
https://bugs.webkit.org/show_bug.cgi?id=230483
<rdar://problem/83310922>
Reviewed by Yusuke Suzuki.
As an initial step in removing the XSS Auditor, turn it off by default.
* Scripts/Preferences/WebPreferences.yaml:
2021-09-20 Chris Dumez <cdumez@apple.com>
Stop using makeRef(*this) / makeRefPtr(this)
https://bugs.webkit.org/show_bug.cgi?id=230464
Reviewed by Alex Christensen.
* wtf/cocoa/WorkQueueCocoa.cpp:
(WTF::WorkQueue::dispatch):
(WTF::WorkQueue::dispatchAfter):
* wtf/glib/SocketConnection.cpp:
(WTF::SocketConnection::SocketConnection):
(WTF::SocketConnection::waitForSocketWritability):
2021-09-20 Jer Noble <jer.noble@apple.com>
[Cocoa] Make AVSampleBufferVideoOutput support an Experimental Feature
https://bugs.webkit.org/show_bug.cgi?id=230424
Reviewed by Eric Carlson.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
* wtf/PlatformHave.h:
2021-09-18 Myles C. Maxfield <mmaxfield@apple.com>
[iOS Family] Delete letterpress support
https://bugs.webkit.org/show_bug.cgi?id=230441
Reviewed by Tim Horton.
* wtf/PlatformEnable.h:
* wtf/PlatformEnableCocoa.h:
2021-09-17 David Kilzer <ddkilzer@apple.com>
Build fix: WebKit::WebProcessPool should use a weak observer with CFNotificationCenter
<https://webkit.org/b/230227>
<rdar://problem/83067708>
* wtf/spi/cocoa/NSObjCRuntimeSPI.h:
- Fix internal Catalina builds by including
NSObjCRuntime_Private.h, but falling through to define
NS_DIRECT and NS_DIRECT_MEMBERS if they weren't defined in the
private header.
2021-09-17 Tim Horton <timothy_horton@apple.com>
Enable UseCGDisplayListsForDOMRendering by default where it is available
https://bugs.webkit.org/show_bug.cgi?id=230387
Reviewed by Dean Jackson.
* Scripts/Preferences/WebPreferencesInternal.yaml:
2021-09-17 Cameron McCormack <heycam@apple.com>
Preserve color space when creating ImageBuffers for ImageBitmaps
https://bugs.webkit.org/show_bug.cgi?id=229022
<rdar://problem/81828459>
Reviewed by Sam Weinig.
* wtf/PlatformHave.h:
2021-09-17 Simon Fraser <simon.fraser@apple.com>
Convert usesMockScrollAnimator from a DeprecatedGlobalSettings to a WebPreference
https://bugs.webkit.org/show_bug.cgi?id=230371
Reviewed by Tim Horton.
Add a MockScrollAnimatorEnabled setting.
* Scripts/Preferences/WebPreferences.yaml:
2021-09-17 Carlos Garcia Campos <cgarcia@igalia.com>
[GTK][a11y] Add a build option to enable ATSPI
https://bugs.webkit.org/show_bug.cgi?id=230254
Reviewed by Adrian Perez de Castro.
Enable isolated tree when building with ATSPI.
* Scripts/Preferences/WebPreferences.yaml:
2021-09-16 David Kilzer <ddkilzer@apple.com>
WebKit::WebProcessPool should use a weak observer with CFNotificationCenter
<https://webkit.org/b/230227>
<rdar://problem/83067708>
Reviewed by Darin Adler.
Tests (API):
TestWTF.TypeCastsNS.checked_ns_cast
TestWTF.TypeCastsNS.dynamic_ns_cast
TestWTF.TypeCastsNS.dynamic_ns_cast_RetainPtr
* WTF.xcodeproj/project.pbxproj:
* wtf/PlatformMac.cmake:
- Add new header files to the project.
* wtf/cocoa/TypeCastsNS.h: Add.
(WTF::checked_ns_cast):
(WTF::dynamic_ns_cast):
- Add casts for NS objects similar to TypeCastsCF.h.
* wtf/PlatformHave.h:
(HAVE_NS_DIRECT_SUPPORT): Add.
- Note that clang for macOS 11 Big Sur claims to know about the
attributes, but will fail to compile if they are actually
used.
* wtf/spi/cocoa/NSObjCRuntimeSPI.h: Add.
(NS_DIRECT):
(NS_DIRECT_MEMBERS):
- Define compiler attributes for direct dispatch of Objective-C
methods.
2021-09-16 Philip Chimento <pchimento@igalia.com>
Fixes for build-webkit --minimal
https://bugs.webkit.org/show_bug.cgi?id=229780
Reviewed by Fujii Hironori.
Remove ENABLE_RESIZE_OBSERVER build-time option. This option is
quite broken if you try to disable it.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
* wtf/PlatformEnableCocoa.h:
2021-09-16 Tim Horton <timothy_horton@apple.com>
Adjust ARKIT_INLINE_PREVIEW* compile time flags
https://bugs.webkit.org/show_bug.cgi?id=230332
Reviewed by Sam Weinig.
* wtf/PlatformEnableCocoa.h:
Make these ENABLE()s instead of HAVE()s (as they control a WebKit feature).
Also, disable the ASVInlinePreview version if WKSeparatedModelView is enabled,
we don't need both, and we currently always make a WKSeparatedModelView
in that case anyway.
* wtf/PlatformHave.h:
Stop using __has_include in favor of version checks, now that
the header has been around for a while.
2021-09-16 Youenn Fablet <youenn@apple.com>
Enable RTCRtpScriptTransform by default
https://bugs.webkit.org/show_bug.cgi?id=230220
Reviewed by Eric Carlson.
Splitting WebRTCInsertableStreamsEnabled to WebRTCEncodedTransformEnabled and WebRTCSFrameTransformEnabled.
Keeping WebRTCSFrameTransformEnabled as off by default until SFrame solidifies and mark WebRTCEncodedTransformEnabled as on by default.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-09-16 Cameron McCormack <heycam@apple.com>
Disable display-p3 canvas and ImageData on platforms other than Monterey+ and iOS 15+
https://bugs.webkit.org/show_bug.cgi?id=230139
<rdar://81828819>
Reviewed by Sam Weinig.
Add HAVE(CORE_ANIMATION_FIX_FOR_RADAR_78402035) to represent whether
CoreAnimation has a fix for a bug that prevents Display P3 canvas
rendering operations from behaving correctly.
Add ENABLE(PREDEFINED_COLOR_SPACE_DISPLAY_P3) to represent whether the
"display-p3" values of the PredefinedColorSpace IDL enum is enabled.
This in turn controls whether Display P3 canvases and ImageData objects
can be created. We turn this on only for platforms where
ENABLE(DESTINATION_COLOR_SPACE_DISPLAY_P3), since that is what the
canvas and ImageData backing stores use, and only if
HAVE(CORE_ANIMATION_FIX_FOR_RADAR_78402035). The result is that these
features are only enabled on macOS Monterey+ and iOS 15+.
* wtf/PlatformEnable.h:
* wtf/PlatformEnableCocoa.h:
* wtf/PlatformHave.h:
2021-09-15 Philip Chimento <pchimento@igalia.com>
Fixes for build-webkit --minimal
https://bugs.webkit.org/show_bug.cgi?id=229780
Reviewed by Fujii Hironori.
Remove ENABLE_INTERSECTION_OBSERVER build-time option. This option is
quite broken if you try to disable it.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
* wtf/PlatformEnableCocoa.h:
2021-09-15 Alex Christensen <achristensen@webkit.org>
Add IDL skeleton for SharedWorker
https://bugs.webkit.org/show_bug.cgi?id=230293
Reviewed by Geoff Garen.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-09-14 John Wilander <wilander@apple.com>
Rename RESOURCE_LOAD_STATISTICS to INTELLIGENT_TRACKING_PREVENTION
https://bugs.webkit.org/show_bug.cgi?id=230279
<rdar://problem/83118683>
Reviewed by Darin Adler.
* wtf/PlatformEnableCocoa.h:
2021-09-14 Chris Dumez <cdumez@apple.com>
Enable BroadcastChannel for modern WebKit
https://bugs.webkit.org/show_bug.cgi?id=230235
Reviewed by Geoffrey Garen.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-09-14 Ryan Haddad <ryanhaddad@apple.com>
Unreviewed, reverting r282408.
Breaks internal builds.
Reverted changeset:
"Enable RTCRtpScriptTransform by default"
https://bugs.webkit.org/show_bug.cgi?id=230220
https://commits.webkit.org/r282408
2021-09-14 Myles C. Maxfield <mmaxfield@apple.com>
CSSFontFaceSrcValue.cssText should be quoted consistently with other browsers
https://bugs.webkit.org/show_bug.cgi?id=230273
<rdar://problem/79644124>
Reviewed by Darin Adler.
* wtf/unicode/CharacterNames.h:
2021-09-14 Youenn Fablet <youenn@apple.com>
Enable RTCRtpScriptTransform by default
https://bugs.webkit.org/show_bug.cgi?id=230220
Reviewed by Eric Carlson.
Splitting WebRTCInsertableStreamsEnabled to WebRTCEncodedTransformEnabled and WebRTCSFrameTransformEnabled.
Keeping WebRTCSFrameTransformEnabled as off by default until SFrame solidifies and mark WebRTCEncodedTransformEnabled as on by default.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-09-14 Fujii Hironori <Hironori.Fujii@sony.com>
StackTrace outputs a garbage prefix because WTF::StackTrace::m_prefix is filled with the stack content
https://bugs.webkit.org/show_bug.cgi?id=230207
Reviewed by Yusuke Suzuki.
r278474 (Bug 226390) added a new member m_prefix to StackTrace at
the bottom of the structure. However, StackTrace isn't a normal
structure. The members are filled with the stack content.
* wtf/StackTrace.h: Moved the m_prefix to the top of the members.
2021-09-14 Kate Cheney <katherine_cheney@apple.com>
Followup to https://bugs.webkit.org/show_bug.cgi?id=217784
Reviewed by Wenson Hsieh.
Update platform name for watchOS.
* Scripts/Preferences/WebPreferences.yaml:
2021-09-14 Myles C. Maxfield <mmaxfield@apple.com>
[Cocoa] Migrate to CTFontHasTable() from CTFontCopyAvailableTables()
https://bugs.webkit.org/show_bug.cgi?id=230248
Reviewed by Anders Carlsson.
* wtf/PlatformUse.h:
2021-09-13 Alex Christensen <achristensen@webkit.org>
Add unit test that uses PCM daemon
https://bugs.webkit.org/show_bug.cgi?id=230191
Reviewed by Chris Dumez.
* wtf/PlatformHave.h:
* wtf/spi/darwin/XPCSPI.h:
2021-09-13 Sihui Liu <sihui_liu@apple.com>
Add stub for File System Access API
https://bugs.webkit.org/show_bug.cgi?id=230101
Reviewed by Youenn Fablet.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-09-13 Sam Sneddon <gsnedders@apple.com>
Move ENABLE_RESOLUTION_MEDIA_QUERY to a runtime flag, start running tests again
https://bugs.webkit.org/show_bug.cgi?id=229776
Reviewed by Simon Fraser.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
Add ResolutionMediaFeatureEnabled
2021-09-13 Youenn Fablet <youenn@apple.com>
Remove WritableStream runtime flag
https://bugs.webkit.org/show_bug.cgi?id=230148
Reviewed by Sihui Liu.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-09-11 Philippe Normand <pnormand@igalia.com>
[GLIB] MediaSession is not enabled
https://bugs.webkit.org/show_bug.cgi?id=217991
<rdar://problem/70740119>
Reviewed by Michael Catanzaro.
GRefPtr template specialization for GDBusNodeInfo.
* wtf/glib/GRefPtr.cpp:
(WTF::refGPtr):
(WTF::derefGPtr):
* wtf/glib/GRefPtr.h:
2021-09-10 Alex Christensen <achristensen@webkit.org>
Use std::not_fn instead of lambda in URLParser
https://bugs.webkit.org/show_bug.cgi?id=230058
Reviewed by Darin Adler.
Since the return type of std::not_fn is not specified, it can't be converted to a bool(*)(UChar).
This necessitates the templatizing of CodeUnitMatchFunction to be anything that is invocable with a UChar
and returns a type that is convertable to a bool.
* wtf/URLParser.cpp:
(WTF::dnsNameEndsInNumber):
* wtf/text/StringCommon.h:
* wtf/text/StringImpl.h:
(WTF::find): Deleted.
* wtf/text/StringView.h:
* wtf/text/WTFString.h:
2021-09-09 Chris Dumez <cdumez@apple.com>
Unreviewed follow-up to r282105.
Add description for "BroadcastChannel Origin Partitioning" experimental feature.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-09-09 Chris Dumez <cdumez@apple.com>
Unreviewed, follow-up after r282007
Somehow, the wrong settings got enabled by the patch landed.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-09-09 Darin Adler <darin@apple.com>
Improve performance by using StringView, not "const StringView&"
https://bugs.webkit.org/show_bug.cgi?id=229834
Reviewed by Anders Carlsson.
Since StringView is a small structure that fits into two registers, it's not
good to pass a pointer to it; better performance to pass it by value. Note
that this is for release builds, not debug builds where StringView has
significant additional overhead when copying.
* wtf/PrintStream.cpp:
(WTF::printInternal):
* wtf/PrintStream.h:
* wtf/text/StringConcatenate.h:
* wtf/text/StringView.cpp:
(WTF::StringView::containsIgnoringASCIICase const):
(WTF::StringView::findIgnoringASCIICase const):
(WTF::StringView::startsWith const):
(WTF::StringView::startsWithIgnoringASCIICase const):
(WTF::StringView::endsWith const):
(WTF::StringView::endsWithIgnoringASCIICase const):
(WTF::StringView::GraphemeClusters::Iterator::Impl::Impl):
(WTF::StringView::GraphemeClusters::Iterator::Iterator):
* wtf/text/StringView.h:
* wtf/text/WTFString.h:
Use StringView, not const StringView&.
2021-09-09 Alex Christensen <achristensen@webkit.org>
Add PrivateClickMeasurement daemon
https://bugs.webkit.org/show_bug.cgi?id=230052
Reviewed by Chris Dumez.
* wtf/spi/darwin/XPCSPI.h:
2021-09-09 Patrick Angle <pangle@apple.com>
run-webkit-archive crashes with dyld error
https://bugs.webkit.org/show_bug.cgi?id=228060
Reviewed by Alex Christensen.
Bump the maximum macOS version that `HAVE_SAFARI_FOR_WEBKIT_DEVELOPMENT_REQUIRING_EXTRA_SYMBOLS` will be enabled
to provide compatibility with changes made in macOS 12.
* wtf/PlatformHave.h:
2021-09-08 Jean-Yves Avenard <jya@apple.com>
Safari TP 131 audio canPlayType() reports false negatives
https://bugs.webkit.org/show_bug.cgi?id=229799
rdar://problem/82776747
Reviewed by Youenn Fablet.
* Scripts/Preferences/WebPreferencesExperimental.yaml: Remove preference.
2021-09-07 Sihui Liu <sihui_liu@apple.com>
Add basic support for Storage API
https://bugs.webkit.org/show_bug.cgi?id=229925
Reviewed by Darin Adler.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-09-07 Yusuke Suzuki <ysuzuki@apple.com>
[JSC] Implement Temporal.PlainTime
https://bugs.webkit.org/show_bug.cgi?id=229892
Reviewed by Darin Adler.
* wtf/text/IntegerToStringConversion.h:
* wtf/text/StringParsingBuffer.h:
2021-09-07 Cameron McCormack <heycam@apple.com>
Add an IPCMessages channel to log all IPC messages
https://bugs.webkit.org/show_bug.cgi?id=229664
<rdar://problem/82511640>
Reviewed by Alex Christensen.
Two changes to TextStream in this patch.
The first is a new argument to the constructor to allow limiting
the number of elements in a container when appending it to a
TextStream. This is intended to be used when the output is for
human consumption and could potentially be uselessly large.
The second is a value adapter ValueOrEllipsis. This allows appending
a value to a TextStream even if it doesn't have an
operator<<(TextStream&) defined. If it doesn't, then the fallback
value "..." is used instead.
An implementation detail of ValueOrEllipsis is a new type trait
supports_text_stream_insertion, which detects at compile time whether
a given type can be appended to a TextStream. It works by using
"expression SFINAE" and partial template specialization.
The base, unspecialized version of the template inherits from
std::false_type, and is selected for all types by default.
A partial specialization that uses decltype() to check whether a
`TextStream() << value` expression would compile inherits from
std::true_type.
Sadly, C++ SFINAE has a limitation that means template definitions
that would be instantiated inside the decltype() are not checked
to ensure they would compile. This would mean container types whose
elements are types that don't have an operator<< defined would still
report true from supports_text_stream_insertion. We work around this
by having more specific partial specializations for all of the container
types we have operator<< definitions for, which defer to the
supports_text_stream_insertion value for the element type(s).
If an operator<< is added for a new container type without a
corresponding supports_text_stream_insertion specialization, and that
type is used with ValueOrEllipsis, it will cause a compile error.
The supports_text_stream_insertion template takes six template
arguments, which looks odd, but is needed because all specializations
must have the same number (and kind) of template arguments. The six
include five type template arguments (which is how many HashMap has)
plus a size_t value template argument (for Vector's inlineCapacity
argument).
* wtf/text/TextStream.h:
(WTF::TextStream::TextStream):
(WTF::TextStream::containerSizeLimit const):
(WTF::operator<<):
(WTF::ValueOrEllipsis::ValueOrEllipsis):
2021-09-07 Chris Dumez <cdumez@apple.com>
Implement origin partitioning (top-origin/frame-origin) for BroadcastChannel
https://bugs.webkit.org/show_bug.cgi?id=229814
Reviewed by Alex Christensen.
Add experimental preference for BroadcastChannel origin partitioning. This is useful because we currently
disable this when running web-platform-tests in WKTR / DRT for now.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-09-06 Dmitry Kalinkin <dmitry.kalinkin+webkit@gmail.com>
Fix WebKitGTK build on MacOS
https://bugs.webkit.org/show_bug.cgi?id=225850
Reviewed by Michael Catanzaro.
Define HAVE_AUDIT_TOKEN only for Cocoa backend.
* wtf/PlatformHave.h:
2021-09-03 Basuke Suzuki <basuke.suzuki@sony.com>
Use USE(SYSTEM_MALLOC) macro in all cases
https://bugs.webkit.org/show_bug.cgi?id=229902
Reviewed by Yusuke Suzuki.
Convert old style macro check to USE() macro for USE_SYSTEM_MALLOC.
* wtf/FastMalloc.cpp:
* wtf/Gigacage.cpp:
* wtf/Gigacage.h:
* wtf/IsoMalloc.h:
* wtf/IsoMallocInlines.h:
* wtf/JSValueMalloc.cpp:
* wtf/PlatformUse.h:
* wtf/RAMSize.cpp:
* wtf/VMTags.h:
* wtf/WTFConfig.h:
2021-09-03 Yusuke Suzuki <ysuzuki@apple.com>
[JSC] Implement Temporal.TimeZone
https://bugs.webkit.org/show_bug.cgi?id=229703
Reviewed by Ross Kirsling.
* wtf/text/IntegerToStringConversion.h: Support integer serialization into Vector.
* wtf/text/StringConcatenate.h: Extends StringConcatenate feature for Vector with UChar/LChar + N size.
2021-09-03 Chris Dumez <cdumez@apple.com>
[WK2] Turn on support for Cross-Origin-Opener-Policy / Cross-Origin-Embedder-Policy
https://bugs.webkit.org/show_bug.cgi?id=229818
Reviewed by Sam Weinig.
Turn on support for Cross-Origin-Opener-Policy / Cross-Origin-Embedder-Policy on WebKit2 now that
the feature is complete and all known issues have been fixed.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-09-02 Alex Christensen <achristensen@webkit.org>
Reject non-IPv4 hostnames that end in numbers
https://bugs.webkit.org/show_bug.cgi?id=228826
Reviewed by Tim Horton.
This implements a recent change to the URL specification at https://github.com/whatwg/url/pull/619
Chrome has made the same change in https://crbug.com/1237032
Since there are no TLDs that are only numbers and some think it might be confusing to have a valid URL
like http://example.com.127.0.0.1/ we prevent URLs that end in a segment between dots that contains only
numbers from parsing successfully.
* wtf/URLParser.cpp:
(WTF::URLParser::parse):
(WTF::dnsNameEndsInNumber):
(WTF::URLParser::parseHostAndPort):
I give more information in the return type so one can tell what the code is doing.
We only check if it is valid or not, but for documentation purposes I think it's useful to return more information.
* wtf/URLParser.h:
2021-09-02 Mark Lam <mark.lam@apple.com>
Add more support for JIT operation validation testing.
https://bugs.webkit.org/show_bug.cgi?id=229534
rdar://81526335
Reviewed by Saam Barati.
* wtf/PlatformCallingConventions.h:
* wtf/PtrTag.h:
(WTF::PtrTagTraits::isTagged):
(WTF::isTaggedNativeCodePtrImpl):
(WTF::isTaggedWith):
(WTF::assertIsTaggedWith):
2021-08-26 Darin Adler <darin@apple.com>
Cut down on use of CFGetTypeID, using dynamic_cf_cast instead; related streamlining
https://bugs.webkit.org/show_bug.cgi?id=229414
Reviewed by Tim Horton.
* wtf/cf/TypeCastsCF.h: Added WTF_DECLARE_CF_TYPE_TRAIT(CFURL). Added a
dynamic_cf_cast overload that converts from one RetainPtr type to another
and avoids reference count churn. Tweaked comments.
* wtf/cocoa/Entitlements.mm:
(WTF::hasEntitlement): Use kCFBooleanTrue instead of CFBooleanGetValue.
* wtf/text/cocoa/TextBreakIteratorInternalICUCocoa.cpp:
(WTF::textBreakLocalePreference): Use dynamic_cf_cast.
2021-08-30 Yusuke Suzuki <ysuzuki@apple.com>
[JSC] Implement Temporal.Calendar
https://bugs.webkit.org/show_bug.cgi?id=229651
Reviewed by Ross Kirsling.
Add UChar version of createStaticStringImpl to make immortal thread-safe StringImpl with UChar.
* wtf/text/StringImpl.cpp:
(WTF::StringImpl::createStaticStringImpl):
* wtf/text/StringImpl.h:
(WTF::StringImpl::createStaticStringImpl):
2021-08-30 Sihui Liu <sihui_liu@apple.com>
Add stubs for Permissions API
https://bugs.webkit.org/show_bug.cgi?id=229339
<rdar://problem/82442205>
Reviewed by Chris Dumez.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-08-30 Zan Dobersek <zdobersek@igalia.com>
RISCV64 support in LLInt
https://bugs.webkit.org/show_bug.cgi?id=229035
<rdar://problem/82120908>
Reviewed by Yusuke Suzuki.
* wtf/PlatformEnable.h:
Define ENABLE_LLINT_EMBEDDED_OPCODE_ID to 1 for CPU(RISCV64).
2021-08-28 Cameron McCormack <heycam@apple.com>
Miscellaneous typo fixes
https://bugs.webkit.org/show_bug.cgi?id=229642
Reviewed by Fujii Hironori.
* wtf/CrossThreadTask.h:
(WTF::callMemberFunctionForCrossThreadTask):
* wtf/text/StringImpl.h:
(WTF::StringImpl::createSubstringSharingImpl):
2021-08-28 David Kilzer <ddkilzer@apple.com>
[WTF] Fix static analyzer warnings about nullptr derefs in StringImpl::copyCharacters() and tryMakeStringFromAdapters()
<https://webkit.org/b/229461>
<rdar://problem/82303279>
Reviewed by Darin Adler.
* wtf/text/StringConcatenate.h:
(WTF::tryMakeStringFromAdapters):
- Add nullptr checks for `buffer` since it makes no sense to
call stringTypeAdapterAccumulator() with a nullptr argument,
and it fixes static analyzer warnings about dereferencing
nullptr.
* wtf/text/StringImpl.h:
(WTF::StringImpl::copyCharacters):
- Add `ASSERT(destination || !numCharacters)` statement to
describe an invariant when calling this method. This stops
the static analyzer from emitting false positive warnings
about `destination` being nullptr.
2021-08-27 Simon Fraser <simon.fraser@apple.com>
Define ENABLE_CONTENT_CHANGE_OBSERVER for IOS_FAMILY and use it to wrap content observation code
https://bugs.webkit.org/show_bug.cgi?id=229624
Reviewed by Alan Bujtas.
Deploy ENABLE(CONTENT_CHANGE_OBSERVER).
* Scripts/Preferences/WebPreferences.yaml:
* wtf/PlatformEnable.h:
* wtf/PlatformEnableCocoa.h:
2021-08-27 Eric Carlson <eric.carlson@apple.com>
[ Catalina EWS ] media/track/track-disabled-addcue.html is flaky crashing
https://bugs.webkit.org/show_bug.cgi?id=229462
<rdar://problem/82302915>
Reviewed by Darin Adler.
* wtf/SetForScope.h:
(WTF::SetForScope::SetForScope): Add a constructor that takes the value to set
on scope exit.
2021-08-27 Russell Epstein <repstein@apple.com>
Land Windows build fixes from safari-612.1.29.14-branch
https://bugs.webkit.org/show_bug.cgi?id=229627
Reviewed by Per Arne Vollan.
* WTF.vcxproj/WTF.proj:
2021-08-27 Antti Koivisto <antti@apple.com>
[CSS Cascade Layers] Initial support
https://bugs.webkit.org/show_bug.cgi?id=229542
Reviewed by Simon Fraser.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-08-27 Mikhail R. Gadelha <mikhail@igalia.com>
Avoid increasing required alignment of target type warning on ARM 32 bits
https://bugs.webkit.org/show_bug.cgi?id=229151
Reviewed by Mark Lam.
Same approach as https://bugs.webkit.org/show_bug.cgi?id=38045
cast pointers to void* to bypass warning about increasing pointer
alingment. reinterpret_cast_ptr has custom behaviour only on ARM and
MIPS 32 bits, and doesn't change the behaviour in 64 bits archs
(reinterpret_cast_ptr is preprocessed to reinterpret_cast in 64 bits
archs)
* wtf/BloomFilter.h:
(WTF::BloomFilter<keyBits>::keysFromHash):
* wtf/FileSystem.cpp:
(WTF::FileSystemImpl::makeSalt):
2021-08-26 Risul Islam <risul_islam@apple.com>
Add new experimental feature flag for sanitizing links
https://bugs.webkit.org/show_bug.cgi?id=229451
Reviewed by Kate Cheney.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-08-25 Wenson Hsieh <wenson_hsieh@apple.com>
Remove some iOS-specific compile-time guards that are no longer needed
https://bugs.webkit.org/show_bug.cgi?id=229500
Reviewed by Tim Horton.
Remove the feature flags. See WebKit/ChangeLog for more details.
* wtf/PlatformHave.h:
* wtf/PlatformUse.h:
2021-08-24 Yusuke Suzuki <ysuzuki@apple.com>
[JSC] Add Intl Enumeration APIs
https://bugs.webkit.org/show_bug.cgi?id=214795
Reviewed by Ross Kirsling.
* wtf/text/StringImpl.cpp:
(WTF::StringImpl::createFromLiteral):
* wtf/text/StringImpl.h:
2021-08-24 Tim Nguyen <ntim@apple.com>
Implement inert attribute behind feature flag
https://bugs.webkit.org/show_bug.cgi?id=165279
Reviewed by Chris Dumez.
Add runtime InertAttributeEnabled feature flag disabled by default.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-08-21 Myles C. Maxfield <mmaxfield@apple.com>
overwriteCodePoint() in createAndFillGlyphPage() is wrong
https://bugs.webkit.org/show_bug.cgi?id=215643
<rdar://problem/67430461>
Reviewed by Alan Bujtas.
* wtf/unicode/CharacterNames.h:
2021-08-21 Sihui Liu <sihui_liu@apple.com>
IndexedDB: crash when triggering IDBOpenRequest completion back on a worker thread
https://bugs.webkit.org/show_bug.cgi?id=229375
Protect callee in CrossThreadTask if it inherits from ThreadSafeRefCounted<T>.
Reviewed by Brady Eidson.
* wtf/CrossThreadTask.h:
2021-08-20 Mark Lam <mark.lam@apple.com>
Make ptrTagName and tagForPtr WTF_EXPORT_PRIVATE.
https://bugs.webkit.org/show_bug.cgi?id=229328
Reviewed by Yusuke Suzuki.
If ptrTagName and tagForPtr are defined, make them WTF_EXPORT_PRIVATE instead of
static functions. This allows us to call them from the debugger during
interactive debugging sessions.
* wtf/PtrTag.cpp:
(WTF::tagForPtr):
(WTF::ptrTagName):
* wtf/PtrTag.h:
2021-08-20 Mark Lam <mark.lam@apple.com>
Remove assertIsTagged and assertIsNullOrTagged.
https://bugs.webkit.org/show_bug.cgi?id=229329
rdar://82162851
Reviewed by Yusuke Suzuki.
These assertion utility functions rely on tagged pointers always having non-zero
PAC bits. This is an incorrect assumption. A tagged pointer can have PAC bits
that are completely zero. Hence, these assert functions cannot be made to work
reliably. We should remove them to prevent them from being used, and potentially
resulting in flaky assertion failures that will be hard to debug later.
Note: assertIsNotTagged is fine to keep. It asserts that PAC bits of a pointer
are all 0. As a result, this assertion can have false positives where it may think
a tagged pointer is an untagged pointer. However, this is rare because it is not
common to have 0 PAC bits in tagged pointers. False positives on this assertion
won't result in flaky test failures that will waste our time later. Hence,
keeping the assertion will do more good (it will tend to help us find bugs) than
bad (it will rarely let false positives thru). As a result, I'm opting to not
remove it.
* wtf/PtrTag.h:
(WTF::assertIsTagged): Deleted.
(WTF::assertIsNullOrTagged): Deleted.
2021-08-19 Antti Koivisto <antti@apple.com>
[:has() pseudo-class] Basic support
https://bugs.webkit.org/show_bug.cgi?id=228894
Reviewed by Simon Fraser.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
Add off-by-default HasPseudoClassEnabled preference value.
2021-08-19 Myles C. Maxfield <mmaxfield@apple.com>
[Cocoa] Stop treating the system font as a non-variable font
https://bugs.webkit.org/show_bug.cgi?id=228176
Reviewed by Sam Weinig.
* wtf/PlatformUse.h:
2021-08-19 Aditya Keerthi <akeerthi@apple.com>
Remove __has_include guard for _UIDatePickerOverlayPresentation
https://bugs.webkit.org/show_bug.cgi?id=227298
rdar://79970171
Reviewed by Tim Horton.
* wtf/PlatformHave.h:
2021-08-19 David Kilzer <ddkilzer@apple.com>
[WTF] Fix static analyzer warnings for clang tidy bugprone-move-forwarding-reference checker
<https://webkit.org/b/229114>
Reviewed by Darin Adler.
* wtf/Deque.h:
(WTF::inlineCapacity>::appendAndBubble):
* wtf/Scope.h:
(WTF::ScopeExit::ScopeExit):
* wtf/ScopedLambda.h:
(WTF::scopedLambda):
* wtf/SharedTask.h:
(WTF::createSharedTask):
- Replace WTFMove() with std::forward<>().
2021-08-19 Alex Christensen <achristensen@webkit.org>
Remove more non-inclusive language from Source
https://bugs.webkit.org/show_bug.cgi?id=229230
Reviewed by Myles C. Maxfield.
* icu/unicode/uspoof.h:
This comment change comes from upstream ICU.
* wtf/URL.h:
2021-08-18 Ryosuke Niwa <rniwa@webkit.org>
[ iOS Debug ] 12 TestWebKitAPI.WebKitLegacy. tests are crashing
https://bugs.webkit.org/show_bug.cgi?id=229250
Reviewed by Wenson Hsieh.
Disable the assertion when Web Thread is enabled for now.
* wtf/CheckedRef.h:
(WTF::SingleThreadIntegralWrapper::assertThread const):
2021-08-18 Megan Gardner <megan_gardner@apple.com>
Remove unneeded UIKitSPI declarations
https://bugs.webkit.org/show_bug.cgi?id=210075
Reviewed by Wenson Hsieh.
Remove unneeded feature define.
* wtf/PlatformHave.h:
2021-08-18 Xabier Rodriguez Calvar <calvaris@igalia.com>
[GStreamer][EME] Try to parse XML init datas that could possibly come from MPD manifests
https://bugs.webkit.org/show_bug.cgi?id=229145
Reviewed by Alicia Boya Garcia.
* wtf/glib/GUniquePtr.h: Added deleter for GMarkupParseContext.
2021-08-16 Alex Christensen <achristensen@webkit.org>
Enable PerformanceNavigationAPI by default
https://bugs.webkit.org/show_bug.cgi?id=227336
Reviewed by Chris Dumez.
It passes WPT tests except the following:
navigation-timing/nav2_test_redirect_chain_xserver_partial_opt_in.html and navigation-timing/nav2_test_redirect_xserver.html pass when run from wpt.live,
and other browsers also don't pass when run from our local hosting infrastructure, which doesn't have a good cross-domain redirect.
nav2_test_attributes_values.html fails in Chrome and Firefox. There's something wrong with the port detection in the test.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-08-16 Ryosuke Niwa <rniwa@webkit.org>
Add thread safe version of CanMakeCheckedPtr
https://bugs.webkit.org/show_bug.cgi?id=229018
Reviewed by Geoffrey Garen.
Introduce CanMakeThreadSafeCheckedPtr which is a thread safe version of CanMakeCheckedPtr.
* wtf/CheckedRef.h:
(WTF::CanMakeCheckedPtrBase): Extracted from CanMakeCheckedPtr.
(WTF::CanMakeCheckedPtrBase::~CanMakeCheckedPtrBase):
(WTF::CanMakeCheckedPtrBase::ptrCount const):
(WTF::SingleThreadIntegralWrapper): Added.
(WTF::SingleThreadIntegralWrapper::SingleThreadIntegralWrapper):
(WTF::SingleThreadIntegralWrapper::operator IntegralType const):
(WTF::SingleThreadIntegralWrapper::operator! const):
(WTF::SingleThreadIntegralWrapper::operator++):
(WTF::SingleThreadIntegralWrapper::operator--):
(WTF::SingleThreadIntegralWrapper::assertThread const):
(WTF::CanMakeCheckedPtr): Redefined using CanMakeCheckedPtrBase and SimpleNonAtomicType.
(WTF::CanMakeThreadSafeCheckedPtr): Added.
2021-08-16 David Kilzer <ddkilzer@apple.com>
ThreadSanitizer: ignore uninteresting data races for reference counting of static WTF::StringImpl objects
<https://webkit.org/b/229113>
Reviewed by Chris Dumez.
* wtf/text/StringImpl.h:
(WTF::StringImpl::isStatic const):
- Add SUPPRESS_TSAN attribute since the 0x1 bit is set at
construction and refcounting occurs in increments of 0x2, so
the static bit never changes.
(WTF::StringImpl::ref):
(WTF::StringImpl::deref):
- Return early for static WTF::StringImpl objects to prevent
TSan from reporting data races for m_refCount.
2021-08-15 Miguel Gomez <magomez@igalia.com>
[GTK][WPE] Add API to pass WebKitMemoryPressureHandler parameters to the network processes
https://bugs.webkit.org/show_bug.cgi?id=228227
Reviewed by Carlos Garcia Campos.
Added a new method to MemoryPressureHandler to set the configuration by copying the parameter
instead of moving it.
* wtf/MemoryPressureHandler.h:
(WTF::MemoryPressureHandler::setConfiguration):
2021-08-11 Chris Dumez <cdumez@apple.com>
Add initial support for Cross-Origin-Embedder-Policy (COEP)
https://bugs.webkit.org/show_bug.cgi?id=228754
Reviewed by Alex Christensen.
Add experimental feature flag for Cross-Origin-Embedder-Policy (COEP), off by default.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-08-11 Darin Adler <darin@apple.com>
Add deduction guide to RetainPtr, use constexpr a bit more, and streamline the implementation
https://bugs.webkit.org/show_bug.cgi?id=228852
Reviewed by Sam Weinig.
* wtf/RetainPtr.h: Sort includes. Made many functions constexpr including the move
constructors and adoptCF. Use using instead of typedef in most places. Use
remove_pointer_t, conditional_t, is_convertible_v, is_same_v, and other such templates
to simplify expressions. Initialize the m_ptr data member and use the default constructor.
Removed unneeded StorageType synonym for CFTypeRef. Move some inline function bodies out
of the class template definition. Use if constexpr to get rid of the need for the overloaded
autoreleaseHelper function. Added a deduction guide so we can use expressions with the
type RetainPtr on the left side, and an Objective-C pointer or CFTypeRef on the right side,
and have the appropriate RetainPtr type deduced.
2021-08-11 Sihui Liu <sihui_liu@apple.com>
Suspend WorkQueue of ResourceLoadStatistics and LocalStorage sooner
https://bugs.webkit.org/show_bug.cgi?id=228748
<rdar://problem/81626714>
Reviewed by Chris Dumez.
Add SuspendableWorkQueue that would perform suspend check before each task.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/Forward.h:
* wtf/SuspendableWorkQueue.cpp: Added.
(WTF::SuspendableWorkQueue::create):
(WTF::SuspendableWorkQueue::SuspendableWorkQueue):
(WTF::SuspendableWorkQueue::suspend):
(WTF::SuspendableWorkQueue::resume):
(WTF::SuspendableWorkQueue::dispatch):
(WTF::SuspendableWorkQueue::dispatchAfter):
(WTF::SuspendableWorkQueue::dispatchSync):
(WTF::SuspendableWorkQueue::invokeAllSuspensionCompletionHandlers):
(WTF::SuspendableWorkQueue::suspendIfNeeded):
* wtf/SuspendableWorkQueue.h: Added.
* wtf/WorkQueue.h:
(): Deleted.
2021-08-11 Youenn Fablet <youenn@apple.com>
Enable WebRTC relay by default
https://bugs.webkit.org/show_bug.cgi?id=229000
<rdar://78767922>
Reviewed by Eric Carlson.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-08-10 Peng Liu <peng.liu6@apple.com>
Disable SYSTEM_FEATURE_FLAGS on iOS 14
https://bugs.webkit.org/show_bug.cgi?id=228979
<rdar://problem/81764452>
Reviewed by Tim Horton.
Stop using feature flags mechanism on iOS 14 to avoid some issues on iOS simulators.
* wtf/PlatformHave.h:
2021-08-10 Stephan Szabo <stephan.szabo@sony.com>
[WTF][PlayStation] REGRESSION(r280795) error: undefined symbol: WTF::logLevelString()
https://bugs.webkit.org/show_bug.cgi?id=228959
Reviewed by Fujii Hironori.
As per followup win fix, for declspec platforms, LoggingUnix needs
to include LogInitialization to get the export declaration.
* wtf/unix/LoggingUnix.cpp:
2021-08-10 Keith Miller <keith_miller@apple.com>
CallFrame::returnPC should untag the return address before passing it to ReturnAddressPtr
https://bugs.webkit.org/show_bug.cgi?id=228931
Reviewed by Mark Lam.
Add a new helper to untag the return pc from a stack frame.
* wtf/PtrTag.h:
(WTF::untagReturnPC):
2021-08-09 Fujii Hironori <Hironori.Fujii@sony.com>
[GTK][WPE] REGRESSION(r280795): MemoryPressureHandlerUnix.cpp:45:28: error: ‘LogMemoryPressure’ was not declared in this scope
https://bugs.webkit.org/show_bug.cgi?id=228938
Unreviewed build fix.
* wtf/unix/MemoryPressureHandlerUnix.cpp:
2021-08-09 Fujii Hironori <Hironori.Fujii@sony.com>
[WTF][Win] REGRESSION(r280795) error LNK2019: unresolved external symbol "class WTF::String __cdecl WTF::logLevelString(void)"
https://bugs.webkit.org/show_bug.cgi?id=228937
<rdar://problem/81722757>
Unresolved build fix.
The previous attempt (r280819) didn't actually fix the build
error. LoggingWin.cpp has to include LogInitialization.h.
* wtf/win/LoggingWin.cpp:
2021-08-09 Fujii Hironori <Hironori.Fujii@sony.com>
[WTF][Win] REGRESSION(r280795) error LNK2019: unresolved external symbol "class WTF::String __cdecl WTF::logLevelString(void)"
https://bugs.webkit.org/show_bug.cgi?id=228937
Unreviewed build fix.
> error LNK2019: unresolved external symbol "class WTF::String __cdecl WTF::logLevelString(void)" (?logLevelString@WTF@@YA?AVString@1@XZ)
> referenced in function "private: void __cdecl WebKit::GPUProcessProxy::platformInitializeGPUProcessParameters(struct WebKit::GPUProcessCreationParameters &)"
> (?platformInitializeGPUProcessParameters@GPUProcessProxy@WebKit@@AEAAXAEAUGPUProcessCreationParameters@2@@Z)
> bin64\WebKit2.dll : fatal error LNK1120: 1 unresolved externals
* wtf/LogInitialization.h: Added WTF_EXPORT_PRIVATE for logLevelString.
2021-08-09 Myles C. Maxfield <mmaxfield@apple.com>
Create a Language log channel
https://bugs.webkit.org/show_bug.cgi?id=228764
Reviewed by Simon Fraser.
There have been a variety of bug reports over the past months/years about the procedure
by which we determine navigator.language. It's actually somewhat convoluted, so this
patch adds a (debug) log channel for it so we can follow what it's doing easily.
To enable all the logging, run these commands:
% defaults write com.apple.WebKit.WebContent.Development WTFLogging Language
% defaults write com.apple.WebKit.WebContent.Development WebKit2Logging Language
% defaults write com.apple.WebKit.WebContent WTFLogging Language
% defaults write com.apple.WebKit.WebContent WebKit2Logging Language
% defaults write -g WTFLogging Language
% defaults write -g WebKit2Logging Language
% defaults write /Users/$USER/Library/Containers/com.apple.Safari/Data/Library/Preferences/com.apple.Safari.plist WTFLogging Language
% defaults write /Users/$USER/Library/Containers/com.apple.Safari/Data/Library/Preferences/com.apple.Safari.plist WebKit2Logging Language
* wtf/Language.cpp:
(WTF::defaultLanguage):
(WTF::overrideUserPreferredLanguages):
(WTF::userPreferredLanguages):
* wtf/Logging.cpp:
* wtf/Logging.h:
* wtf/cf/LanguageCF.cpp:
(WTF::platformUserPreferredLanguages):
* wtf/cocoa/LanguageCocoa.mm:
(WTF::minimizedLanguagesFromLanguages):
2021-08-09 Myles C. Maxfield <mmaxfield@apple.com>
Support WTF logging channels
https://bugs.webkit.org/show_bug.cgi?id=228768
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):
2021-08-07 Myles C. Maxfield <mmaxfield@apple.com>
Deduplicate logging channel algorithms
https://bugs.webkit.org/show_bug.cgi?id=228809
Reviewed by Fujii Hironori.
The current infrastructure (before this patch) had the following duplicated for each framework:
- A .cpp file declared the list of logging channels for that framework
- The .cpp file also had algorithms to search, modify, and initialize these logging channels
Each framework's .cpp file had duplicate algorithms. (The initialization algorithm was even
duplicated 3 times!)
Because the algorithms directly name their specific list of logging channels, a naive deduplication
would have had to add new parameters to these algorithms to pass in the appropriate framework's
list. That's fine, but this is exactly the sort of thing classes were designed for - classes are
an association of algorithms and data. The algorithms are shared but the data isn't, which really
just means we should have 3 instances of a shared class - one for the 3 sets of data.
So, this patch creates the LogChannels class which contains the deduplicated algorithms, and each
framework has a NeverDestroyed singleton instance of that class. There is a single virtual method
in the class, so the appropriate "default write" variable can be queried for each framework.
The instances cannot be declared in the Logging.h files in the frameworks, because certain WebKit2
files want to initialize all 3 instances of LogChannels, but you can't #include multiple Logging.h
files at the same time because their LOG_CHANNEL_PREFIX #defines will collide with each other.
Luckily, LogInitialization.h files exist exactly to solve this purpose, so that's where the
LogChannels instances are declared in. After this change, the Logging.h files are just for the
declarations of the logging channels themselves, and the LogInitialization.h files are for the
LogChannels instances which contain the searching/modifying/initializing algorithms on the list of
logging channels. If you just want to LOG(...) something, #include the relevant Logging.h file, and
if you want to search/modify/initialize across the entire list of channels, then #include the
relevant LogInitialization.h file.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/LogChannels.cpp: Copied from Source/WebCore/platform/Logging.cpp.
(WTF::LogChannels::isLogChannelEnabled):
(WTF::LogChannels::setLogChannelToAccumulate):
(WTF::LogChannels::clearAllLogChannelsToAccumulate):
(WTF::LogChannels::initializeLogChannelsIfNecessary):
(WTF::LogChannels::getLogChannel):
* wtf/LogChannels.h: Copied from Source/WebCore/platform/LogInitialization.h.
2021-08-07 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r280756.
https://bugs.webkit.org/show_bug.cgi?id=228897
Broke gtk build
Reverted changeset:
"Deduplicate logging channel algorithms"
https://bugs.webkit.org/show_bug.cgi?id=228809
https://commits.webkit.org/r280756
2021-08-07 Myles C. Maxfield <mmaxfield@apple.com>
Deduplicate logging channel algorithms
https://bugs.webkit.org/show_bug.cgi?id=228809
Reviewed by Fujii Hironori.
The current infrastructure (before this patch) had the following duplicated for each framework:
- A .cpp file declared the list of logging channels for that framework
- The .cpp file also had algorithms to search, modify, and initialize these logging channels
Each framework's .cpp file had duplicate algorithms. (The initialization algorithm was even
duplicated 3 times!)
Because the algorithms directly name their specific list of logging channels, a naive deduplication
would have had to add new parameters to these algorithms to pass in the appropriate framework's
list. That's fine, but this is exactly the sort of thing classes were designed for - classes are
an association of algorithms and data. The algorithms are shared but the data isn't, which really
just means we should have 3 instances of a shared class - one for the 3 sets of data.
So, this patch creates the LogChannels class which contains the deduplicated algorithms, and each
framework has a NeverDestroyed singleton instance of that class. There is a single virtual method
in the class, so the appropriate "default write" variable can be queried for each framework.
The instances cannot be declared in the Logging.h files in the frameworks, because certain WebKit2
files want to initialize all 3 instances of LogChannels, but you can't #include multiple Logging.h
files at the same time because their LOG_CHANNEL_PREFIX #defines will collide with each other.
Luckily, LogInitialization.h files exist exactly to solve this purpose, so that's where the
LogChannels instances are declared in. After this change, the Logging.h files are just for the
declarations of the logging channels themselves, and the LogInitialization.h files are for the
LogChannels instances which contain the searching/modifying/initializing algorithms on the list of
logging channels. If you just want to LOG(...) something, #include the relevant Logging.h file, and
if you want to search/modify/initialize across the entire list of channels, then #include the
relevant LogInitialization.h file.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/LogChannels.cpp: Copied from Source/WebCore/platform/Logging.cpp.
(WTF::LogChannels::isLogChannelEnabled):
(WTF::LogChannels::setLogChannelToAccumulate):
(WTF::LogChannels::clearAllLogChannelsToAccumulate):
(WTF::LogChannels::initializeLogChannelsIfNecessary):
(WTF::LogChannels::getLogChannel):
* wtf/LogChannels.h: Copied from Source/WebCore/platform/LogInitialization.h.
2021-08-05 Michael Catanzaro <mcatanzaro@gnome.org>
GCC 11 builds should use -Wno-array-bounds, -Wno-nonnull
https://bugs.webkit.org/show_bug.cgi?id=228601
Reviewed by Carlos Garcia Campos.
* wtf/Bitmap.h:
(WTF::WordType>::clear):
* wtf/Compiler.h:
* wtf/Packed.h:
(WTF::PackedAlignedPtr::get const):
* wtf/RefPtr.h:
(WTF::DefaultRefDerefTraits::derefIfNotNull):
2021-08-05 Zan Dobersek <zdobersek@igalia.com>
Avoid reinterpret_cast alignment increase warnings with GCC on CPU(RISCV64)
https://bugs.webkit.org/show_bug.cgi?id=228818
Reviewed by Adrian Perez de Castro.
* wtf/StdLibExtras.h: As with 32-bit ARM and MIPS targets, RISC-V 64-bit
builds with GCC also spawn warnings when the use of reinterpret_cast
causes an increase in alignment. Workaround via reinterpret_cast_ptr is
thus required for CPU(RISCV64).
2021-08-03 Myles C. Maxfield <mmaxfield@apple.com>
[Cocoa] Tweak the formatting for passing NSArrays to TextStreams
https://bugs.webkit.org/show_bug.cgi?id=228766
Reviewed by Simon Fraser.
Instead of using -[NSArray description], which puts its output on multiple lines,
instead use the same formatting as WTF::Vector, which puts its output on a single line.
We can also use this opportunity to tweak the implementation of operator<<(id) to
allow it to be called with Core Foundation types in raw C++ code.
* wtf/text/TextStream.h:
* wtf/text/cocoa/TextStreamCocoa.mm:
(WTF::TextStream::operator<<):
2021-08-03 Risul Islam <risul_islam@apple.com>
Add functions for parsing URL query string
https://bugs.webkit.org/show_bug.cgi?id=228122
Reviewed by Darin Adler.
Added parsing of URL query strings.
* wtf/KeyValuePair.h:
(WTF::operator== const):
* wtf/URL.cpp:
(WTF::URL::differingQueryParameters):
(WTF::lengthOfURLIgnoringQueryAndFragments):
(WTF::URL::isEqualIgnoringQueryAndFragments):
(WTF::URL::removeQueryParameters):
* wtf/URL.h:
2021-08-03 Youenn Fablet <youenn@apple.com>
RealtimeMediaSource::audioSamplesAvailable is calling malloc as part of locking in audio thread
https://bugs.webkit.org/show_bug.cgi?id=228688
Reviewed by Eric Carlson.
Allow allocations in lockSlow since allocations might happen in rare case and not for each lockSlow call.
* wtf/Lock.cpp:
(WTF::Lock::lockSlow):
(WTF::Lock::unlockSlow):
(WTF::Lock::unlockFairlySlow):
2021-08-02 Ryosuke Niwa <rniwa@webkit.org>
Add CheckedRef
https://bugs.webkit.org/show_bug.cgi?id=227164
Reviewed by Geoffrey Garen.
Like r278344, this patch introduces a new type of smart pointer, CheckedRef,
which lets each object keep track of pointers pointing to the object.
As with CheckedPtr, the purpose of the internal counter for CheckedRef is
to release assert that there is no outstanding pointer at the time of destruction
instead of keeping the object alive when there is one.
This patch also removes makeCheckedPtr in favor of using CheckedPtr with
template argument deduction in C++17.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/CheckedPtr.h:
(WTF::CheckedPtr::CheckedPtr): Added variants which take CheckedRef as arguments.
(WTF::makeCheckedPtr): Deleted.
(WTF::CanMakeCheckedPtr): Moved to CheckedRef.h
* wtf/CheckedRef.h: Added.
(WTF::CheckedRef::~CheckedRef): Added.
(WTF::CheckedRef::CheckedRef): Added.
(WTF::CheckedRef::isHashTableDeletedValue const): Added.
(WTF::CheckedRef::isHashTableEmptyValue const): Added.
(WTF::CheckedRef::hashTableEmptyValue): Added.
(WTF::CheckedRef::ptrAllowingHashTableEmptyValue const): Added.
(WTF::CheckedRef::ptrAllowingHashTableEmptyValue): Added.
(WTF::CheckedRef::ptr const): Added.
(WTF::CheckedRef::ptr): Added.
(WTF::CheckedRef::get const): Added.
(WTF::CheckedRef::get): Added.
(WTF::CheckedRef::operator-> const): Added.
(WTF::CheckedRef::operator->): Added.
(WTF::CheckedRef::operator const T& const): Added.
(WTF::CheckedRef::operator T&): Added.
(WTF::CheckedRef::operator! const): Added.
(WTF::CheckedRef::operator=): Added.
(WTF::CheckedRef::releasePtr): Added. Returns m_ptr without calling decrementPtrCount.
This is equivalent of leakPtr in Ref but we don't call this that since CheckedRef or
CheckedPtr is generally not used to manage the object lifetime.
(WTF::CheckedRef::poison): Added.
(WTF::CheckedRef::unpoison): Added.
(WTF::is): Added.
(WTF::CheckedRefHashTraits): Added.
(WTF::CheckedRefHashTraits::emptyValue): Added.
(WTF::CheckedRefHashTraits::constructEmptyValue): Added.
(WTF::CheckedRefHashTraits::isEmptyValue): Added.
(WTF::CheckedRefHashTraits::peek): Added.
(WTF::CheckedRefHashTraits::take): Added.
(WTF::CanMakeCheckedPtr): Moved from CheckedPtr.h
* wtf/Forward.h:
2021-08-02 Devin Rousso <drousso@apple.com>
[Live Text] SPI for machine readable codes is only available on iOS
https://bugs.webkit.org/show_bug.cgi?id=228711
Reviewed by Tim Horton.
* wtf/PlatformEnableCocoa.h:
* wtf/PlatformHave.h:
2021-08-02 Youenn Fablet <youenn@apple.com>
Enable WebRTCPlatformUDPSocketsEnabled experimental feature by default
https://bugs.webkit.org/show_bug.cgi?id=228689
<rdar://problem/81383711>
Reviewed by Eric Carlson.
Enable WebRTCPlatformUDPSocketsEnabled experimental feature by default, WebRTC proxying being off by default for now.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-08-02 Yusuke Suzuki <ysuzuki@apple.com>
[JSC] Yarr should use Bitmap instead of ByteVector for BoyerMoore search
https://bugs.webkit.org/show_bug.cgi?id=228676
Reviewed by Saam Barati.
* wtf/Bitmap.h:
2021-08-01 Youenn Fablet <youenn@apple.com>
Introduce an experimental feature to toggle WebRTC socket proxying
https://bugs.webkit.org/show_bug.cgi?id=228681
Reviewed by Eric Carlson.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-07-31 Yusuke Suzuki <ysuzuki@apple.com>
[JSC] Move JIT_UNICODE_EXPRESSIONS to ENABLE(YARR_JIT_UNICODE_EXPRESSIONS) in PlatformEnable.h
https://bugs.webkit.org/show_bug.cgi?id=228669
Reviewed by Alexey Shvayka.
* wtf/PlatformEnable.h:
2021-07-30 Rob Buis <rbuis@igalia.com>
[css-overflow] Implement clip value for overflow
https://bugs.webkit.org/show_bug.cgi?id=198230
Reviewed by Simon Fraser.
Add preference for overflow: clip support.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-07-30 Chris Dumez <cdumez@apple.com>
Add initial support for 'Cross-Origin-Opener-Policy' HTTP header
https://bugs.webkit.org/show_bug.cgi?id=192193
<rdar://problem/42013525>
Reviewed by Geoff Garen.
Add experimental feature flag for 'Cross-Origin-Opener-Policy' HTTP header
support.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-07-29 Myles C. Maxfield <mmaxfield@apple.com>
Stop building WebGPU and the WHLSL compiler to decrease binary size
https://bugs.webkit.org/show_bug.cgi?id=228179
Reviewed by Dean Jackson, Robin Morisset, and Devin Rousso.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
* wtf/PlatformEnable.h:
* wtf/PlatformEnableCocoa.h:
2021-07-29 Devin Rousso <drousso@apple.com>
[Payment Request] `additionalShippingMethods` are not used if a `paymentMethodType` is provided
https://bugs.webkit.org/show_bug.cgi?id=228599
<rdar://problem/81190366>
Reviewed by Andy Estes.
r275169 made it so that `paymentMethodType` is no longer `required` so that `additionalShippingMethods`
can be specified without having to limit it to a specific payment method type. While this
works in theory, WebKit doesn't know about the user's selected payment method type until the
user actually selects a payment method, meaning that until then the `additionalShippingMethods`
are not used. Unfortunately (until now) `PKPaymentRequestPaymentMethodUpdate` did not
support providing a `NSArray<PKShippingMethod *> *`, so there was no way to update the list
of shipping methods when the user changed their selected payment method, meaning that WebKit
would have to wait/rely on the user to change their shipping address _after_ selecting a
payment method in order for `additionalShippingMethods` to take effect.
This also fixes an issue with WebKit's implementation of the W3C Payment Request API by
allowing any generic (i.e. things not specific to Apple Pay) `shippingOptions` provided in
`PaymentDetailsUpdate` to actually be used and update the Apple Pay sheet accordingly.
* wtf/PlatformHave.h:
* wtf/PlatformEnableCocoa.h:
Add new compile flags for PassKit supporting modifying shipping methods with any update.
2021-07-28 Yusuke Suzuki <ysuzuki@apple.com>
[JSC] Yarr should perform BoyerMoore search
https://bugs.webkit.org/show_bug.cgi?id=228301
Reviewed by Saam Barati.
* wtf/BitVector.cpp:
(WTF::BitVector::dump const):
* wtf/Bitmap.h:
(WTF::WordType>::dump const):
* wtf/UniqueRef.h:
(WTF::makeUniqueRefFromNonNullUniquePtr):
(WTF::UniqueRef::UniqueRef):
2021-07-29 Kate Cheney <katherine_cheney@apple.com>
REGRESSION (r278877) [Cocoa] WebAuthn stopped working for non-Safari browsers
https://bugs.webkit.org/show_bug.cgi?id=228116
<rdar://problem/80693607>
Patch by Brent Fulgham.
Reviewed by Per Arne Vollan.
Add new SPI header for code signing features.
* WTF.xcodeproj/project.pbxproj:
* wtf/spi/cocoa/SecuritySPI.h:
* wtf/spi/darwin/CodeSignSPI.h: Added.
2021-07-29 Eric Carlson <eric.carlson@apple.com>
[iOS] Don't set capture attribution dynamically in the simulator
https://bugs.webkit.org/show_bug.cgi?id=228596
rdar://81176531
Reviewed by Jer Noble.
* wtf/PlatformHave.h: Don't define HAVE_SYSTEM_STATUS for the simulator.
2021-07-29 Kate Cheney <katherine_cheney@apple.com>
GetIdentifierStringForPreferredVoiceInListWithLocale() is deprecated in Monterey
<https://webkit.org/b/228066>
<rdar://problem/80577312>
Patch by David Kilzer.
Reviewed by David Kilzer.
* wtf/PlatformHave.h:
- Add HAVE(SPEECHSYNTHESIS_MONTEREY_SPI).
2021-07-28 Jean-Yves Avenard <jya@apple.com>
[WebAudio] Add webm/opus container support
https://bugs.webkit.org/show_bug.cgi?id=227110
<rdar://problem/79437067>
Reviewed by Jer Noble.
Add WebMWebAudioEnabled preference to make canPlayType return probably for mimetype:
"audio/webm; codecs=opus"
Disabled by default.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-07-28 Ryosuke Niwa <rniwa@webkit.org>
makeWeakPtr should support Ref and RefPtr as the argument
https://bugs.webkit.org/show_bug.cgi?id=228574
Reviewed by Wenson Hsieh.
This patch adds variants of makeWeakPtr<T> which take Ref<T> and RefPtr<T>.
Tests: TestWebKitAPI.WTF_WeakPtr.MakeWeakPtrTakesRef
TestWebKitAPI.WTF_WeakPtr.MakeWeakPtrTakesRefPtr
* wtf/WeakPtr.h:
(WTF::makeWeakPtr):
2021-07-28 Myles C. Maxfield <mmaxfield@apple.com>
[Cocoa] macOS Monterey and parallel OSes no longer need r280103
https://bugs.webkit.org/show_bug.cgi?id=228539
Reviewed by Alan Bujtas.
Core Text's behavior changed on these OSes.
* wtf/PlatformUse.h:
2021-07-26 Yusuke Suzuki <ysuzuki@apple.com>
Unreviewed, speculative revert of r280193
https://bugs.webkit.org/show_bug.cgi?id=228142
* wtf/Vector.h:
(WTF::Malloc>::shrinkCapacity):
(WTF::Malloc>::shrinkToBestFit): Deleted.
* wtf/text/AtomStringImpl.cpp:
(WTF::UCharBufferTranslator::equal):
(WTF::LCharBufferTranslator::equal):
(WTF::BufferFromStaticDataTranslator::equal):
* wtf/text/StringView.h:
(WTF::StringView::stripLeadingMatchedCharacters): Deleted.
2021-07-26 Jer Noble <jer.noble@apple.com>
[Cocoa] WebKit is making GroupActivities API calls for all WebKit clients
https://bugs.webkit.org/show_bug.cgi?id=228299
<rdar://80802982>
Reviewed by Eric Carlson.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-07-26 Per Arne <pvollan@apple.com>
The layout test fast/images/heic-as-background-image.html is a constant failure
https://bugs.webkit.org/show_bug.cgi?id=228195
<rdar://80334724>
Reviewed by Said Abou-Hallawa.
Add HAVE macro for the system function CMPhotoIsTileDecoderAvailable.
* wtf/PlatformHave.h:
2021-07-26 Jer Noble <jer.noble@apple.com>
[iOS] All home screen web apps resume when any home screen web app is foregrounded
https://bugs.webkit.org/show_bug.cgi?id=228246
<rdar://72949281>
Reviewed by Eric Carlson.
* Scripts/Preferences/WebPreferences.yaml:
2021-07-23 Chris Dumez <cdumez@apple.com>
SharedBuffer::takeData() is a bit dangerous
https://bugs.webkit.org/show_bug.cgi?id=228161
Reviewed by Darin Adler.
Add Vector::uncheckedAppend() overload that takes in a Span.
* wtf/Vector.h:
(WTF::Vector::uncheckedAppend):
(WTF::Malloc>::uncheckedAppend):
2021-07-23 Robert Jenner <Jenner@apple.com>
Unreviewed, reverting r280205.
Broke multiple WebAuthn tests.
Reverted changeset:
"REGRESSION (r278877) [Cocoa] WebAuthn stopped working for
non-Safari browsers"
https://bugs.webkit.org/show_bug.cgi?id=228116
https://commits.webkit.org/r280205
2021-07-23 Philippe Normand <pnormand@igalia.com>
[GLib] Remove libportal dependency
https://bugs.webkit.org/show_bug.cgi?id=228056
Reviewed by Carlos Garcia Campos.
* Scripts/Preferences/WebPreferencesExperimental.yaml: Enable screen capture on GStreamer
ports. The PIPEWIRE ifdef is redundant.
2021-07-22 Brent Fulgham <bfulgham@apple.com>
REGRESSION (r278877) [Cocoa] WebAuthn stopped working for non-Safari browsers
https://bugs.webkit.org/show_bug.cgi?id=228116
<rdar://problem/80693607>
Reviewed by Per Arne Vollan.
Add new SPI header for code signing features.
* WTF.xcodeproj/project.pbxproj:
* wtf/spi/cocoa/SecuritySPI.h: Move some SecTask calls out of PLATFORM(MAC).
* wtf/spi/darwin/CodeSignSPI.h: Added.
2021-07-22 Saam Barati <sbarati@apple.com>
Fix uses of Dependency::fence with respect to the compiler outsmarting us
https://bugs.webkit.org/show_bug.cgi?id=227757
<rdar://problem/80280931>
Reviewed by Robin Morisset.
* wtf/Atomics.h:
(WTF::opaque):
(WTF::Dependency::loadAndFence):
2021-07-22 Yusuke Suzuki <ysuzuki@apple.com>
Unreviewed, follow-up after r280193
https://bugs.webkit.org/show_bug.cgi?id=228142
I accidentally reverted auto change when switching branches.
* wtf/text/AtomStringImpl.cpp:
(WTF::UCharBufferTranslator::equal):
(WTF::LCharBufferTranslator::equal):
(WTF::BufferFromStaticDataTranslator::equal):
2021-07-22 Yusuke Suzuki <ysuzuki@apple.com>
Micro-optimize innerHTML
https://bugs.webkit.org/show_bug.cgi?id=228142
Reviewed by Simon Fraser.
* wtf/Vector.h:
(WTF::Malloc>::shrinkToBestFit): This shrinks the backing storage to "appropriate for the living Vector".
* wtf/text/AtomStringImpl.cpp:
(WTF::UCharBufferTranslator::equal): WTF::equal for String does not check hash. This is because computing hash is expensive
and we would like to avoid that if it is not necessary. But when inserting string into AtomStringTable, we can use hash value
since they must be already computed because of HashMap's requirement. So let's use it before calling WTF::equal.
(WTF::LCharBufferTranslator::equal):
(WTF::BufferFromStaticDataTranslator::equal):
* wtf/text/StringView.h:
(WTF::StringView::stripLeadingMatchedCharacters): Add this and use it in HTMLTreeBuilder.
2021-07-22 Alex Christensen <achristensen@webkit.org>
XHR.send(Document) should replace mismatched surrogates with replacement character before sending
https://bugs.webkit.org/show_bug.cgi?id=228170
Reviewed by Chris Dumez.
* wtf/text/WTFString.cpp:
(WTF::replaceUnpairedSurrogatesWithReplacementCharacter):
* wtf/text/WTFString.h:
Move from WebCore, rename as suggested, update spec link to one that works.
2021-07-22 Zan Dobersek <zdobersek@igalia.com>
Add CPU(RISCV64)
https://bugs.webkit.org/show_bug.cgi?id=228178
Reviewed by Adrian Perez de Castro.
Detect when compiling for the RISC-V 64-bit architecture and define
the WTF_CPU_RISCV64 macro under that condition, enabling use of
CPU(RISCV64) build guards.
* wtf/PageBlock.h: Use 4 kB as the page size ceiling for CPU(RISCV64).
* wtf/PlatformCPU.h:
2021-07-21 Miguel Gomez <magomez@igalia.com>
[GTK][WPE] Allow the user to configure the MemoryPressureHandler inside the web process
https://bugs.webkit.org/show_bug.cgi?id=222738
Reviewed by Carlos Garcia Campos.
Add a configuration structure to MemoryPressureHandler, with the methods to encode/decode it. Also
add a method to set a configuration structure to a MemoryPressureHandler instance, and modify the
behavior so the the configuration is used when checking the memory used by the process.
* wtf/MemoryPressureHandler.cpp:
(WTF::MemoryPressureHandler::setShouldUsePeriodicMemoryMonitor):
(WTF::MemoryPressureHandler::thresholdForMemoryKill):
(WTF::MemoryPressureHandler::thresholdForPolicy):
(WTF::MemoryPressureHandler::policyForFootprint):
(WTF::MemoryPressureHandler::Configuration::Configuration):
* wtf/MemoryPressureHandler.h:
(WTF::MemoryPressureHandler::Configuration::encode const):
(WTF::MemoryPressureHandler::Configuration::decode):
(WTF::MemoryPressureHandler::setConfiguration):
2021-07-21 Chris Dumez <cdumez@apple.com>
Unreviewed, reverting r280129.
Broke the internal Monterey build bots
Reverted changeset:
"GetIdentifierStringForPreferredVoiceInListWithLocale() is
deprecated in Monterey"
https://bugs.webkit.org/show_bug.cgi?id=228066
https://commits.webkit.org/r280129
2021-07-21 David Kilzer <ddkilzer@apple.com>
GetIdentifierStringForPreferredVoiceInListWithLocale() is deprecated in Monterey
<https://webkit.org/b/228066>
<rdar://problem/80577312>
Reviewed by Alexey Proskuryakov.
* wtf/PlatformHave.h:
- Add HAVE(SPEECHSYNTHESIS_MONTEREY_SPI).
2021-07-20 Myles C. Maxfield <mmaxfield@apple.com>
r280103 is not necessary on all operating systems
https://bugs.webkit.org/show_bug.cgi?id=228136
Reviewed by Alan Bujtas.
* wtf/PlatformUse.h:
2021-07-16 Alexander Mikhaylenko <alexm@gnome.org>
[GTK][WPE] Support color-schemes CSS property
https://bugs.webkit.org/show_bug.cgi?id=208204
Reviewed by Adrian Perez de Castro.
* wtf/PlatformHave.h:
Enable HAVE_OS_DARK_MODE_SUPPORT for GTK and WPE.
2021-07-15 Jean-Yves Avenard <jya@apple.com>
[Wk1] media/media-source/media-webm-opus-partial.html is a consistent failure (Enable VP8/VP9/Vorbis/Opus in WebKitLegacy)
https://bugs.webkit.org/show_bug.cgi?id=228005
rdar://80346720
Reviewed by Jer Noble.
* Scripts/Preferences/WebPreferencesExperimental.yaml: Enable VP8/VP9/Vorbis/Opus
codecs for WebKitLegacy, no reasons they weren't already enabled.
2021-07-15 Joonghun Park <jh718.park@samsung.com>
Unreviewed. Fix the build warning below since r279895.
warning: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Wsign-compare]
* wtf/URL.cpp:
(WTF::URL::setPath):
2021-07-15 Chris Dumez <cdumez@apple.com>
Add initial support for BroadcastChannel behind a runtime flag
https://bugs.webkit.org/show_bug.cgi?id=227924
Reviewed by Sam Weinig.
Add experimental feature flag for BroadcastChannel, off by default.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-07-15 Philippe Normand <pnormand@igalia.com>
[GStreamer][Pipewire] Implement getDisplayMedia() backend
https://bugs.webkit.org/show_bug.cgi?id=210926
Reviewed by Xabier Rodriguez-Calvar.
* Scripts/Preferences/WebPreferencesExperimental.yaml: Enable screen-capture if libportal
was found.
2021-07-14 Jer Noble <jer.noble@apple.com>
Unreviewed build fix after r279912 (239661@main); Add a HAVE(SYSTEM_STATUS) macro.
* wtf/PlatformHave.h:
2021-07-13 Alex Christensen <achristensen@webkit.org>
Update and fix URL WPT tests
https://bugs.webkit.org/show_bug.cgi?id=227820
Reviewed by Chris Dumez.
There was an edge case where if we set a path to an empty string, it would add a slash. No more.
* wtf/URL.cpp:
(WTF::URL::setPath):
2021-07-13 Michael Catanzaro <mcatanzaro@gnome.org>
Remove USE_64KB_PAGE_BLOCK
https://bugs.webkit.org/show_bug.cgi?id=227905
Reviewed by Yusuke Suzuki.
* wtf/PageBlock.h:
2021-07-12 Filip Pizlo <fpizlo@apple.com> and Yusuke Suzuki <ysuzuki@apple.com>
New malloc algorithm
https://bugs.webkit.org/show_bug.cgi?id=226404
Reviewed by Yusuke Suzuki.
Introduce flags for using libpas as the ExecutableAllocator.
Explicitly ask for gigacage initialization, since libpas prefers it this way right now.
* wtf/FastTLS.h:
* wtf/PlatformUse.h:
* wtf/Threading.cpp:
(WTF::initialize):
2021-07-12 Wenson Hsieh <wenson_hsieh@apple.com>
[Cocoa] Turn on `USE(OS_STATE)` when building with a non-Apple-internal SDK
https://bugs.webkit.org/show_bug.cgi?id=227884
Reviewed by Tim Horton.
Enable the compile-time flag for all Cocoa builds.
* wtf/PlatformUse.h:
2021-07-12 Chris Fleizach <cfleizach@apple.com>
AX: Make WebKit observe spatial audio accessibility settings
https://bugs.webkit.org/show_bug.cgi?id=227848
Reviewed by Sam Weinig.
This flag was using the wrong format for a HAVE setting, so the code wasn't being compiled in.
* wtf/PlatformHave.h:
2021-07-12 Simon Fraser <simon.fraser@apple.com>
Add a StyleSheets log channel and some logging
https://bugs.webkit.org/show_bug.cgi?id=227880
Reviewed by Alan Bujtas.
Make it possible to feed Ref<> and RefPtr<> into TextStream.
* wtf/text/TextStream.h:
(WTF::operator<<):
2021-07-09 Jer Noble <jer.noble@apple.com>
[Cocoa] Make Coordinator playback commands more precise
https://bugs.webkit.org/show_bug.cgi?id=227756
Reviewed by Eric Carlson.
Add a method to convert from a MonotonicTime to a MachAbsoluteTime.
* wtf/CurrentTime.cpp:
(WTF::machTimebaseInfo):
(WTF::MonotonicTime::fromMachAbsoluteTime):
(WTF::MonotonicTime::toMachAbsoluteTime const):
* wtf/MonotonicTime.h:
* wtf/PlatformHave.h:
2021-07-08 Alex Christensen <achristensen@webkit.org>
Fix some whitespace handling issues in URL setters
https://bugs.webkit.org/show_bug.cgi?id=227806
Reviewed by Chris Dumez.
Setters should ignore tabs and newlines like the main parser does.
The protocol setter is problematic, which I reported in https://github.com/whatwg/url/issues/620
* wtf/URL.cpp:
(WTF::URL::setFragmentIdentifier):
* wtf/URLParser.cpp:
(WTF::URLParser::isSpecialScheme):
(WTF::URLParser::parse):
* wtf/URLParser.h:
The URL.hash setter should allow trailing C0 and control characters, which we would otherwise trim.
Rather than introduce a new parameter, use a sentinel value for when we need to do this.
2021-07-08 Brent Fulgham <bfulgham@apple.com>
[Cocoa] Expose SPI to opt out of Extensible SSO authentication
https://bugs.webkit.org/show_bug.cgi?id=227729
<rdar://problem/75647892>
Reviewed by Tim Horton.
Create new WKPreference to allow WebKit clients to opt out of Extensible SSO authentication.
* Scripts/Preferences/WebPreferences.yaml:
2021-07-07 Alex Christensen <achristensen@webkit.org>
URL host setter should pass host to URLParser instead of trying to encode it itself
https://bugs.webkit.org/show_bug.cgi?id=227749
Reviewed by Chris Dumez.
For non-special schemes, the host is percent-encoded instead of punycode-encoded.
Allowing the URL parser to handle all input directly does the right thing for non-special schemes.
* wtf/URL.cpp:
(WTF::URL::setHost):
(WTF::URL::setHostAndPort):
2021-07-07 Alex Christensen <achristensen@webkit.org>
URL path setter should add "./" before non-empty path and after empty host for URLs with non-special schemes
https://bugs.webkit.org/show_bug.cgi?id=227750
Reviewed by Chris Dumez.
This is related to r267837 but in the path setter, too.
This helps preserve idempotence in parsed URLs.
This is an edge case that will rarely be hit in practice, but now the path setter matches the parser.
* wtf/URL.cpp:
(WTF::URL::setPath):
2021-07-07 Christopher Reid <chris.reid@sony.com>
[PlayStation] Don't assume 4KB block size when estimating Network Cache disk usage
https://bugs.webkit.org/show_bug.cgi?id=227502
Reviewed by Chris Dumez.
Add getVolumeFileBlockSize to fetch the block size from the filesystem.
Currently only implemented for Windows and POSIX filesystems.
* wtf/FileSystem.cpp:
* wtf/FileSystem.h:
* wtf/playstation/FileSystemPlayStation.cpp:
2021-07-07 Alex Christensen <achristensen@webkit.org>
Use more Span
https://bugs.webkit.org/show_bug.cgi?id=227606
Reviewed by Darin Adler.
New is always better, right?
* wtf/FileSystem.cpp:
(WTF::FileSystemImpl::mapToFile):
* wtf/FileSystem.h:
* wtf/persistence/PersistentCoders.cpp:
(WTF::Persistence::Coder<CString>::encode):
(WTF::Persistence::Coder<CString>::decode):
(WTF::Persistence::Coder<String>::encode):
(WTF::Persistence::decodeStringText):
(WTF::Persistence::Coder<SHA1::Digest>::encode):
(WTF::Persistence::Coder<SHA1::Digest>::decode):
* wtf/persistence/PersistentCoders.h:
* wtf/persistence/PersistentDecoder.cpp:
(WTF::Persistence::Decoder::Decoder):
(WTF::Persistence::Decoder::bufferIsLargeEnoughToContain const):
(WTF::Persistence::Decoder::bufferPointerForDirectRead):
(WTF::Persistence::Decoder::decodeFixedLengthData):
(WTF::Persistence::Decoder::decodeNumber):
(WTF::Persistence::Decoder::verifyChecksum):
* wtf/persistence/PersistentDecoder.h:
(WTF::Persistence::Decoder::length const):
(WTF::Persistence::Decoder::currentOffset const):
* wtf/persistence/PersistentEncoder.cpp:
(WTF::Persistence::Encoder::updateChecksumForData):
(WTF::Persistence::Encoder::encodeFixedLengthData):
(WTF::Persistence::Encoder::encodeChecksum):
* wtf/persistence/PersistentEncoder.h:
2021-07-05 Yusuke Suzuki <ysuzuki@apple.com>
[JSC] Optimize Object.assign and putDirectInternal
https://bugs.webkit.org/show_bug.cgi?id=227677
Reviewed by Filip Pizlo.
* wtf/HashMap.h:
* wtf/HashSet.h:
* wtf/HashTable.h:
(WTF::HashTable::isNullStorage const):
2021-07-02 Brent Fulgham <bfulgham@apple.com>
[macOS] Only use WebGL on Metal by default on safe versions of macOS
https://bugs.webkit.org/show_bug.cgi?id=227633
<rdar://problem/78527887>
Reviewed by Dean Jackson.
Tested by WebGL test suite.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
* wtf/PlatformHave.h:
2021-07-01 Youenn Fablet <youenn@apple.com>
Disable relay for UDP sockets when not needed
https://bugs.webkit.org/show_bug.cgi?id=227253
<rdar://problem/79912154>
Reviewed by Eric Carlson.
* wtf/PlatformHave.h:
Add a macro for new NW methods.
2021-07-01 Antoine Quint <graouts@webkit.org>
[Model] Restrict IPC calls to ARKit SPI availability and runtime flag
https://bugs.webkit.org/show_bug.cgi?id=227581
Reviewed by Tim Horton.
Define a new compile-time flag when either of the iOS or macOS ARKit SPIs are available.
* wtf/PlatformHave.h:
2021-07-01 Aditya Keerthi <akeerthi@apple.com>
[iOS] <select> menus should scroll to the selected option
https://bugs.webkit.org/show_bug.cgi?id=227562
<rdar://problem/77887668>
Reviewed by Wenson Hsieh.
* wtf/PlatformHave.h:
Add HAVE(UIMENUOPTIONS_SINGLE_SELECTION).
2021-07-01 Youenn Fablet <youenn@apple.com>
[Cocoa] Migrate WebRTC UDP socket handling to NW API
https://bugs.webkit.org/show_bug.cgi?id=227210
Reviewed by Eric Carlson.
Add a new experimental flag for NW backed UDP sockets.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-07-01 Jer Noble <jer.noble@apple.com>
[Mac] (Re-)enable GroupActivities after upstreaming
https://bugs.webkit.org/show_bug.cgi?id=227546
Reviewed by Eric Carlson.
Add support for HAVE_GROUP_ACTIVITIES.
* wtf/PlatformHave.h:
2021-06-30 Antoine Quint <graouts@webkit.org>
[Model] [macOS] Add support for rendering model resources
https://bugs.webkit.org/show_bug.cgi?id=227530
<rdar://problem/79968206>
Reviewed by Dean Jackson.
Add a new compile-time flag indicating the availability of the ASVInlinePreview SPI on macOS.
We only define it when the header itself is present for now to avoid issues with older macOS
12 SDKs, but ultimately we will only use the macOS version check.
* wtf/PlatformHave.h:
2021-06-30 Megan Gardner <megan_gardner@apple.com>
Add ID and versioning support for AppHighlights
https://bugs.webkit.org/show_bug.cgi?id=227279
Reviewed by Tim Horton.
Allow PersistentDecoders to rewind, to help support v0 highlight data.
* wtf/persistence/PersistentDecoder.cpp:
(WTF::Persistence::Decoder::Decoder):
(WTF::Persistence::Decoder::rewind):
* wtf/persistence/PersistentDecoder.h:
2021-06-30 Ryosuke Niwa <rniwa@webkit.org>
Use WeakHashMap and WeakPtr with Node in more places
https://bugs.webkit.org/show_bug.cgi?id=227192
<rdar://problem/79828322>
Reviewed by Geoffrey Garen.
* wtf/WeakHashMap.h:
(WTF::WeakHashMap::WeakHashMapIteratorBase::makePeek): Fixed type mismatch errors.
(WTF::WeakHashMap::ensure): Made this function return AddResult like HashMap::ensure.
(WTF::WeakHashMap::take): Added.
(WTF::WeakHashMap::removeIf): Fixed the bug that the callback was called with the iterator
of m_impl and not WeakHashMapIterator.
* wtf/WeakHashSet.h:
(WTF::HashTraits<Ref<WeakPtrImpl<Counter>>>::isReleasedWeakValue): Moved to WeakPtr.h
* wtf/WeakPtr.h:
(WTF::HashTraits<Ref<WeakPtrImpl<Counter>>>::isReleasedWeakValue): Moved from WeakHashSet.h
2021-06-30 Truitt Savell <tsavell@apple.com>
Unreviewed, reverting r279405.
Casued 50+ webrtc crashes on Big Sur Debug
Reverted changeset:
"[Cocoa] Migrate WebRTC UDP socket handling to NW API"
https://bugs.webkit.org/show_bug.cgi?id=227210
https://commits.webkit.org/r279405
2021-06-30 Tim Horton <timothy_horton@apple.com>
Fix the build.
* wtf/PlatformHave.h:
This is not available on the simulator; disable it.
2021-06-30 Youenn Fablet <youenn@apple.com>
[Cocoa] Migrate WebRTC UDP socket handling to NW API
https://bugs.webkit.org/show_bug.cgi?id=227210
Reviewed by Eric Carlson.
Add a new experimental flag for NW backed UDP sockets.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-06-29 Antoine Quint <graouts@webkit.org>
WebKit_iosmac build failure: SystemPreviewSPI.h:29:9: fatal error: 'AssetViewer/ARQuickLookWebKitItem.h' file not found
https://bugs.webkit.org/show_bug.cgi?id=227507
<rdar://problem/79902043>
Reviewed by Dean Jackson.
When we added new SPIs in Source/WebCore/PAL/pal/spi/ios/SystemPreviewSPI.h as part of r279312 we also included this file
from a new file that is compiled on Catalyst. This revealed an issue where existing SPIs included in that file weren't
actually available on Catalyst. We now make sure we compile those out on Catalyst.
* wtf/PlatformHave.h:
2021-06-29 Antti Koivisto <antti@apple.com>
Enable Probabilistic Guard Malloc for RuleData and RuleFeature vectors
https://bugs.webkit.org/show_bug.cgi?id=227446
Reviewed by Geoffrey Garen.
Add SystemMalloc type that can be used with containers like Vector and
ProbabilisticGuardMalloc alias for it on Mac/iOS platforms.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/SystemMalloc.h: Added.
(WTF::SystemMalloc::malloc):
(WTF::SystemMalloc::tryMalloc):
(WTF::SystemMalloc::zeroedMalloc):
(WTF::SystemMalloc::tryZeroedMalloc):
(WTF::SystemMalloc::realloc):
(WTF::SystemMalloc::tryRealloc):
(WTF::SystemMalloc::free):
* wtf/Vector.h:
(WTF::Malloc>::appendVector):
Include all template parameters for the appendVector argument.
2021-06-28 Mikhail R. Gadelha <mikhail@igalia.com>
Prevent sign-extended casts for 32 bits arch
https://bugs.webkit.org/show_bug.cgi?id=227170
Reviewed by Yusuke Suzuki.
In a number of places, addresses are reinterpreted as uint64, which can
lead to wrong addresses in 32 bits arch.
* wtf/LoggerHelper.h:
(WTF::LoggerHelper::childLogIdentifier):
2021-06-28 Sam Weinig <weinig@apple.com>
Add helpers to create Spans from CFDataRef and NSData
https://bugs.webkit.org/show_bug.cgi?id=227217
Reviewed by Chris Dumez.
Add overloads of asBytes() for CFDataRef and NSData. This is going to
be a common enough pattern to warrent these helpers.
* WTF.xcodeproj/project.pbxproj:
* wtf/PlatformFTW.cmake:
* wtf/PlatformMac.cmake:
* wtf/PlatformWin.cmake:
* wtf/cf/SpanCF.h: Added.
(WTF::asBytes):
* wtf/cocoa/SpanCocoa.h: Added.
(WTF::asBytes):
2021-06-27 Antoine Quint <graouts@webkit.org>
[Model] [iOS] Add support for rendering model resources
https://bugs.webkit.org/show_bug.cgi?id=227392
<rdar://problem/79770136>
Reviewed by Tim Horton.
Add a new compile-time flag indicating the availability of the ASVInlinePreview SPI on iOS.
We only define it when the header itself is present for now to avoid issues with older iOS
15 SDKs, but ultimately we will only use the iOS version check.
* wtf/PlatformHave.h:
2021-06-25 Kenneth Russell <kbr@chromium.org>
Set ImageBitmap experimental feature flag to true
https://bugs.webkit.org/show_bug.cgi?id=227140
Reviewed by Dean Jackson.
Web developers - most recently Google's Meet team - have asked for
ImageBitmap support in WebKit. The implementation was
substantially upgraded during development of WebGL 2.0, and is
thoroughly tested on the EWS. Change the default value for
ImageBitmap's experimental flag to true; this can be removed
completely after one release cycle.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-06-24 Martin Robinson <mrobinson@webkit.org>
[css-scroll-snap] Remove ENABLE_SCROLL_SNAP compile-time option
https://bugs.webkit.org/show_bug.cgi?id=227067
Reviewed by Simon Fraser.
Remove compile-time ENABLE_SCROLL_SNAP configuration option.
* wtf/PlatformEnable.h: Remove the global feature definition.
2021-06-23 Mark Lam <mark.lam@apple.com>
Base Options::useWebAssemblyFastMemory's default value on Gigacage::hasCapacityToUseLargeGigacage.
https://bugs.webkit.org/show_bug.cgi?id=227328
Reviewed by Saam Barati.
Provide a Gigacage::hasCapacityToUseLargeGigacage value for when !GIGACAGE_ENABLED.
* wtf/Gigacage.h:
2021-06-23 Yijia Huang <yijia_huang@apple.com>
Add a new pattern to instruction selector to utilize UBFIZ supported by ARM64
https://bugs.webkit.org/show_bug.cgi?id=227204
Reviewed by Filip Pizlo.
Add functions to count the consecutive zero bits (trailing) on the
right with modulus division and lookup. Reference: Bit Twiddling Hacks.
* wtf/MathExtras.h:
(WTF::countTrailingZeros):
2021-06-23 Kate Cheney <katherine_cheney@apple.com>
Migrate App Privacy Report code from WebKitAdditions
https://bugs.webkit.org/show_bug.cgi?id=227045
<rdar://problem/74333287>
Reviewed by Alex Christensen.
Update compile flag naming to align with the App Privacy Report
feature. Added a new check for Symptoms for a simpler, more clear
check.
* wtf/PlatformEnableCocoa.h:
* wtf/PlatformHave.h:
2021-06-23 Aditya Keerthi <akeerthi@apple.com>
[iOS] Adopt new date picker presentation SPI
https://bugs.webkit.org/show_bug.cgi?id=227221
<rdar://problem/77930086>
Reviewed by Wenson Hsieh.
* wtf/PlatformHave.h:
Add HAVE(UIDATEPICKER_OVERLAY_PRESENTATION) and HAVE(UITOOLBAR_STANDARD_APPEARANCE).
2021-06-21 Darin Adler <darin@apple.com>
Improve more of the CSS list style implementations
https://bugs.webkit.org/show_bug.cgi?id=227206
Reviewed by Antti Koivisto.
* wtf/unicode/CharacterNames.h: Added blackDown/Left/RightPointingSmallTriangle.
2021-06-22 Wenson Hsieh <wenson_hsieh@apple.com>
[Live Text] [macOS] Add an internal option to disable inline text selection in images
https://bugs.webkit.org/show_bug.cgi?id=227265
rdar://79460142
Reviewed by Tim Horton.
Add a new internal feature flag. See WebKit ChangeLog for more details.
* Scripts/Preferences/WebPreferencesInternal.yaml:
2021-06-22 Fujii Hironori <Hironori.Fujii@sony.com>
[GLib] Rewrite NetworkCache::Data::adoptMap without FileSystem::MappedFileData::leakHandle and munmap
https://bugs.webkit.org/show_bug.cgi?id=227017
Reviewed by Carlos Garcia Campos.
* wtf/FileSystem.h: MappedFileData::leakHandle is used only if PLATFORM(COCOA) now.
2021-06-22 Saam Barati <sbarati@apple.com>
jitCompileAndSetHeuristics shouldn't return true when we fail to compile
https://bugs.webkit.org/show_bug.cgi?id=227155
Reviewed by Tadeu Zagallo.
* wtf/WeakRandom.h:
2021-06-22 Truitt Savell <tsavell@apple.com>
Unreviewed, reverting r279083.
Broke Mac Builds
Reverted changeset:
"Migrate App Privacy Report code from WebKitAdditions"
https://bugs.webkit.org/show_bug.cgi?id=227045
https://commits.webkit.org/r279083
2021-06-22 Kimmo Kinnunen <kkinnunen@apple.com>
Functions dispatched to WorkQueue are sometimes destroyed in the calling thread due to block refcounting
https://bugs.webkit.org/show_bug.cgi?id=227160
Reviewed by Antti Koivisto.
WorkQueue::dispatch Function bodies always execute in the thread of target
queue. However, sometimes the Function destruction would happen in the
dispatched-from thread. This is not what the WorkQueue::dispatch callers
expect.
Implement some of the WorkQueue::dispatch* in terms of dispatch_..._f()
variants which take a function and context pointer instead of a block.
Blocks are reference counted objects without the ability to pass the
ownership of the reference. For dispatch case, it means that caller will
need to hold the reference while dispatch_...() returns. In thread
contention cases the called block might complete and reference be
dropped in the thread of the queue before the dispatched-from thread
would drop its reference to the block. This would cause the dispatched
Function to be destroyed in the dispatched-from thread.
* wtf/cocoa/WorkQueueCocoa.cpp:
(WTF::dispatchWorkItem):
(WTF::WorkQueue::dispatch):
(WTF::WorkQueue::dispatchAfter):
(WTF::WorkQueue::dispatchSync):
2021-06-21 Chris Dumez <cdumez@apple.com>
Adjust `fetch` port blocking for ports 990, 989
https://bugs.webkit.org/show_bug.cgi?id=226971
<rdar://problem/79287147>
Reviewed by Geoffrey Garen.
Prevent connecting to ports 989 & 990 as per:
- https://github.com/whatwg/fetch/pull/1250
* wtf/URL.cpp:
(WTF::portAllowed):
2021-06-21 Fujii Hironori <Hironori.Fujii@sony.com>
[WinCairo] Turn ENABLE_SHAREABLE_RESOURCE on
https://bugs.webkit.org/show_bug.cgi?id=227011
Reviewed by Don Olmstead.
Added a new member m_fileMapping to MappedFileData to store a file
mapping object handle to create a SharedMemory from a
MappedFileData on Windows.
Conditioned out MappedFileData::leakHandle() if OS(WINDOWS). And,
removed unmapViewOfFile(). Destruction of MappedFileData should be
done by ~MappedFileData.
* wtf/FileSystem.cpp:
(WTF::FileSystemImpl::MappedFileData::~MappedFileData):
(WTF::FileSystemImpl::MappedFileData::mapFileHandle):
(WTF::FileSystemImpl::unmapViewOfFile): Deleted.
* wtf/FileSystem.h:
(WTF::FileSystemImpl::MappedFileData::fileMapping const):
(WTF::FileSystemImpl::MappedFileData::MappedFileData):
(WTF::FileSystemImpl::MappedFileData::operator=):
* wtf/win/FileSystemWin.cpp:
(WTF::FileSystemImpl::MappedFileData::~MappedFileData):
(WTF::FileSystemImpl::MappedFileData::mapFileHandle):
(WTF::FileSystemImpl::unmapViewOfFile): Deleted.
2021-06-21 Kate Cheney <katherine_cheney@apple.com>
Migrate App Privacy Report code from WebKitAdditions
https://bugs.webkit.org/show_bug.cgi?id=227045
<rdar://problem/74333287>
Reviewed by Alex Christensen.
Update compile flag naming to align with the App Privacy Report
feature.
* wtf/PlatformEnableCocoa.h:
2021-06-21 Kimmo Kinnunen <kkinnunen@apple.com>
makeUnique cannot be used to instantiate function-local classes
https://bugs.webkit.org/show_bug.cgi?id=227163
Reviewed by Antti Koivisto.
Make WTF_MAKE_FAST_ALLOCATED and similar macros work in function
local classes. Mark the typedef that is used to enforce semicolon
after the macro as unused to avoid unused typedef warning.
Fixes cases where the compiler is able to prove that it sees all the
use sites of the class and the typedef is not used.
* wtf/Compiler.h:
* wtf/FastMalloc.h:
2021-06-21 Philippe Normand <pnormand@igalia.com>
Unreviewed build fix after r279062
* wtf/Span.h:
(std::is_convertible_v<std::remove_pointer_t<decltype):
2021-06-20 Sam Weinig <weinig@apple.com>
Replace Span implementation with one from libc++, which is more spec complient
https://bugs.webkit.org/show_bug.cgi?id=227197
Reviewed by Darin Adler.
* wtf/Span.h:
The tcb span implementation had some SFINAE issues when converting containers
had data() and size() member functions but were not span compatible that were
causing failures. Rather than trying to fix those, this adopts a modified version
of the libc++ span implementation which is more up-to-date.
To fix MSVC compile issues, the as_bytes/as_writable_bytes functions have been
re-implemented to not work around a compile issue seen where using the dynamic_extent
specicialization from the static extent specicialization was failing to compile.
2021-06-20 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS] Rename WKVisualSearchPreviewController to WKQuickLookPreviewController
https://bugs.webkit.org/show_bug.cgi?id=227193
Reviewed by Sam Weinig.
Add some compile-time flags to guard QuickLook SPI declarations.
* wtf/PlatformHave.h:
2021-06-20 Sam Weinig <weinig@apple.com>
Adopt Span in SHA1.h
https://bugs.webkit.org/show_bug.cgi?id=227184
Reviewed by Chris Dumez.
Replaces overload of addBytes taking a Vector with ones taking
a Span and add overloads for Span<const std::byte> which all the
others are now implemented in terms of. This is useful since
any Span can be turned into one of type Span<const std::byte>
just by calling asBytes(existingSpan).
This leaves most of the existing overloads in place (though
simplifies them by implementing them as Span contructions),
though we should consider removing some in a separate pass.
* wtf/SHA1.cpp:
* wtf/SHA1.h:
2021-06-19 Sam Weinig <weinig@apple.com>
Adopt Span in Base64.h
https://bugs.webkit.org/show_bug.cgi?id=227132
Reviewed by Chris Dumez.
Replaces overloads taking Vectors with ones taking Spans
and add overloads for Span<const std::byte> which all the
others are now implemented in terms of. This is useful since
any Span can be turned into one of type Span<const std::byte>
just by calling asBytes(existingSpan).
This leaves most of the existing overloads in place (though
simplifies them by implementing them as Span contructions)
though we should consider removing some in a separate pass.
* wtf/Vector.h:
Add value_type typedef so that Vector<T> can be automatically
deduced as Span<T>.
* wtf/text/CString.h:
Add bytes() and bytesInludingNullTerminator() (only the former
is used in this patch, but the later will be needed shortly)
which return Span<const uint8_t> of the CString. I chose to use
an explicit function, rather than making it converible to Span
like Vector, because some callers will want the null terminator
and some will not.
* wtf/text/Base64.cpp:
* wtf/text/Base64.h:
Canonicalize all input buffers either as a Span<const std::byte> or
a StringView, making all the other overloads just forward to one of
those two (String -> StringView, everything else -> Span<const std::byte>).
Clean up the header a bit by putting all the declarations at the top of
the file.
2021-06-17 Said Abou-Hallawa <said@apple.com>
[Cocoa] Disable hardware decoding in the WebProcess
https://bugs.webkit.org/show_bug.cgi?id=226869
<rdar://77548905>
Reviewed by Per Arne Vollan and Simon Fraser.
Add have macros for using:
1. kCGImageSourceEnableRestrictedDecoding
2. VTRestrictVideoDecoders()
* wtf/PlatformHave.h:
2021-06-17 Mark Lam <mark.lam@apple.com>
Rename numberOfPACBits to maxNumberOfAllowedPACBits.
https://bugs.webkit.org/show_bug.cgi?id=227156
Reviewed by Saam Barati.
* wtf/CagedPtr.h:
2021-06-17 Mark Lam <mark.lam@apple.com>
Define MacroAssemblerARM64E::numberOfPACBits based on OS_CONSTANT(EFFECTIVE_ADDRESS_WIDTH).
https://bugs.webkit.org/show_bug.cgi?id=227147
rdar://78785309
Reviewed by Saam Barati.
For OS(DARWIN), define OS_CONSTANT(EFFECTIVE_ADDRESS_WIDTH) in terms of
MACH_VM_MAX_ADDRESS, which is provided by the SDK. This ensures that it is
correct for each target OS(DARWIN) platform.
Also update an assertion in WTFAssertions.cpp to verify that address bits are
less than 48. The purpose of this assertion is to ensure that our 64-bit NaN
boxing encoding for JSValues will work. Hence, we should use the encoding limit
for pointers of 48 bits. It no longer makes sense to assert based on
OS_CONSTANT(EFFECTIVE_ADDRESS_WIDTH), because OS_CONSTANT(EFFECTIVE_ADDRESS_WIDTH)
is defined in terms of MACH_VM_MAX_ADDRESS.
* wtf/CagedPtr.h:
* wtf/CompactPointerTuple.h:
* wtf/PlatformOS.h:
* wtf/WTFAssertions.cpp:
* wtf/threads/Signals.cpp:
2021-06-17 Fujii Hironori <Hironori.Fujii@sony.com>
[Win] WTF.ParseInteger and WTF.ParseIntegerAllowingTrailingJunk are failing
https://bugs.webkit.org/show_bug.cgi?id=227090
Reviewed by Yusuke Suzuki.
ArithmeticOperations::sub unexpectedly reported an overflow for
the result of std::numeric_limits<ResultType>::min() in MSVC code path.
For example, Checked<int, RecordOverflow>(INT_MIN + 1) - 1 was reported an overflow.
In the case of calculating (lhs - rhs), and lhs < 0 and rhs > 0,
the original code reported an overflow if (rhs > max() + lhs).
Mathematically, this condition checks (lhs - rhs < -max()).
It should use min() instead of max() in this case. It should be
(lhs - rhs < min()) mathematically.
* wtf/CheckedArithmetic.h:
2021-06-17 Alex Christensen <achristensen@webkit.org>
Add assertion in RunLoop::dispatch
https://bugs.webkit.org/show_bug.cgi?id=227154
<rdar://79243769>
Reviewed by Geoff Garen.
This should help us find what is scheduling null functions.
* wtf/RunLoop.cpp:
(WTF::RunLoop::dispatch):
(WTF::RunLoop::dispatchAfter):
2021-06-17 Ben Nham <nham@apple.com>
Remove Mac-specific CPUTime functions
https://bugs.webkit.org/show_bug.cgi?id=227109
Reviewed by Yusuke Suzuki.
There's no reason for the Mac-specific CPU time functions to exist, since getrusage and
clock_gettime work fine on Mac. It's actually slightly more efficient to use the POSIX calls
since getrusage returns CPU time for both current and terminated threads in a single
syscall, while using task_info requires two syscalls to do the same thing.
* WTF.xcodeproj/project.pbxproj:
* wtf/PlatformGTK.cmake:
* wtf/PlatformJSCOnly.cmake:
* wtf/PlatformPlayStation.cmake:
* wtf/PlatformWPE.cmake:
* wtf/cocoa/CPUTimeCocoa.cpp: Removed.
* wtf/posix/CPUTimePOSIX.cpp: Renamed from Source/WTF/wtf/unix/CPUTimeUnix.cpp.
2021-06-17 Tim Horton <timothy_horton@apple.com>
Adopt WKHoverGestureRecognizer
https://bugs.webkit.org/show_bug.cgi?id=227116
<rdar://79442027>
Reviewed by Wenson Hsieh.
* wtf/PlatformEnableCocoa.h:
2021-06-16 Yusuke Suzuki <ysuzuki@apple.com>
[JSC] Disable JITCage on macOS until we evaluate performance throughly
https://bugs.webkit.org/show_bug.cgi?id=227104
Reviewed by Mark Lam.
This patch disables JITCage on macOS until we evaluate performance throughly.
* wtf/PlatformEnable.h:
2021-06-16 Alicia Boya García <aboya@igalia.com>
[WTF] DataMutex: Assert on double locking on the same thread
https://bugs.webkit.org/show_bug.cgi?id=227069
Reviewed by Xabier Rodriguez-Calvar.
DataMutex used to use OwnerAwareLock to track what thread is holding
the mutex and emit assertion errors if a thread is found attempting to
lock a mutex held by that same thread. This turns deadlocks into
runtime errors.
OwnerAwareLock was removed when DataMutex got clang thread safety
annotations. This patch reintroduces the same logic, while keeping
thread-safety annotations.
This fixes WTF_DataMutex.DoubleLockDeathTest, which tested this
functionality and was previously regressed.
* wtf/DataMutex.h:
2021-06-06 Darin Adler <darin@apple.com>
Delete some recently-obsoleted files
https://bugs.webkit.org/show_bug.cgi?id=226705
Reviewed by Chris Dumez.
* wtf/CMakeLists.txt: Removed Optional.h.
* wtf/Optional.h: Removed.
2021-06-15 Alex Christensen <achristensen@webkit.org>
Check for "xn--" in any subdomain when parsing URL hosts
https://bugs.webkit.org/show_bug.cgi?id=226912
Reviewed by Darin Adler.
We have a fast path that doesn't call uidna_nameToASCII if the host is already ASCII.
We need to check if the host is properly-punycode-encoded if it starts with "xn--"
but we also need to check if any subdomain starts with "xn--" (not just the first one).
In order to not regress tests, I needed to also take the fix I did in r256629 and apply it to all use of uidna_nameToASCII.
* wtf/URL.cpp:
(WTF::appendEncodedHostname):
* wtf/URLHelpers.cpp:
(WTF::URLHelpers::mapHostName):
* wtf/URLParser.cpp:
(WTF::URLParser::domainToASCII):
(WTF::URLParser::subdomainStartsWithXNDashDash):
(WTF::URLParser::parseHostAndPort):
(WTF::URLParser::startsWithXNDashDash): Deleted.
* wtf/URLParser.h:
2021-06-15 Michael Catanzaro <mcatanzaro@gnome.org>
-Warray-bounds warning in Packed.h
https://bugs.webkit.org/show_bug.cgi?id=226557
<rdar://problem/79103658>
Reviewed by Darin Adler.
* wtf/Bitmap.h:
(WTF::WordType>::clear): Use the newly-introduced IGNORE_ARRAY_BOUNDS_WARNINGS macros
instead of vanilla IGNORE_WARNINGS.
* wtf/Compiler.h: Add new IGNORE_ARRAY_BOUNDS_WARNINGS_[BEGIN,END] macros, since this
warning is now suppressed in several different places.
* wtf/Packed.h: Suppress the warning. Also, add a static_assert for safety.
2021-06-15 Brent Fulgham <bfulgham@apple.com>
[Cocoa] Harden WebAuthn process by restricting to browser-entitled processes
https://bugs.webkit.org/show_bug.cgi?id=226772
<rdar://problem/74721877>
Reviewed by Darin Adler.
Add a new entitlement utility that returns the String value of a given entitlement for
the process with the provided audit token.
* wtf/cocoa/Entitlements.h:
* wtf/cocoa/Entitlements.mm:
(WTF::hasEntitlementValue):
* wtf/PlatformHave.h: Add item for PAC shared region feature.
2021-06-14 Per Arne <pvollan@apple.com>
[iOS] Sync Accessibility preferences
https://bugs.webkit.org/show_bug.cgi?id=226738
<rdar://77922839>
Reviewed by Brent Fulgham.
Enable Per-App Accessibility preferences on iOS.
* wtf/PlatformHave.h:
2021-06-12 Wenson Hsieh <wenson_hsieh@apple.com>
Number pad button is missing its image when tapping on <input type=tel> in watchOS 8
https://bugs.webkit.org/show_bug.cgi?id=226955
Reviewed by Darin Adler.
Add compile-time flags to guard the presence of `PUICQuickboardController` and `PUICButtonTypePill`.
* wtf/PlatformHave.h:
2021-06-11 Ryosuke Niwa <rniwa@webkit.org>
Add WeakHashMap
https://bugs.webkit.org/show_bug.cgi?id=226872
Reviewed by Geoffrey Garen.
Added WeakHashMap which deletes entries during rehashing and amortized over time (based on
the number of read & write accesses done on a given WeakHashMap instance).
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/WeakHashMap.h: Added.
(WTF::WeakHashMap): Added.
(WTF::WeakHashMap::PeekKeyValuePairTraits): Added.
(WTF::WeakHashMap::PeekType): Added.
(WTF::WeakHashMap::PeekPtrType): Added. Unlike a regular HashMap, we need to fake the iterator
pointer value with this struct since key-value pair doesn't exist in HashTable itself as it stores
Ref<WeakRefImpl> instead.
(WTF::WeakHashMap::WeakHashMapIteratorBase): Added. Has a bunch of helper functions so that
WeakHashMapIterator and WeakHashMapConstIterator can share the code.
(WTF::WeakHashMap::WeakHashMapIterator): Added.
(WTF::WeakHashMap::WeakHashMapConstIterator): Added.
(WTF::WeakHashMap::AddResult): Added.
(WTF::WeakHashMap::begin): Added.
(WTF::WeakHashMap::end): Added.
(WTF::WeakHashMap::add): Added.
(WTF::WeakHashMap::set): Added.
(WTF::WeakHashMap::find): Added.
(WTF::WeakHashMap::contains): Added.
(WTF::WeakHashMap::get): Added.
(WTF::WeakHashMap::remove): Added.
(WTF::WeakHashMap::removeIf): Added.
(WTF::WeakHashMap::clear): Added.
(WTF::WeakHashMap::capacity): Added.
(WTF::WeakHashMap::isEmptyIgnoringNullReferences): Added. This is akin to WeakHashSet::computesEmpty.
Per prior discussion, we intend to rename WeakHashSet's version to this name as well for clarity.
Note that this function will clear the hash table completely if the map is semantically empty
but HashTable contains null references as keys.
(WTF::WeakHashMap::hasNullReferences): Added. Triggers amortized cleanup based on the number
of iterations performed. If there are no null references, it resets m_operationCountSinceLastCleanup.
(WTF::WeakHashMap::computeSize): Added.
(WTF::WeakHashMap::removeNullReferences): Added. Since WeakHashMap doesn't eagerly delete the value
when the key goes away, this function should be called when values held onto by WeakRefImpl with
the nullptr back pointer should be deleted en masse.
(WTF::WeakHashMap::checkConsistency): Added.
(WTF::WeakHashMap::makeKeyImpl): Added.
(WTF::WeakHashMap::keyImplIfExists): Added.
* wtf/WeakPtr.h:
2021-06-11 Jonathan Bedard <jbedard@apple.com>
[Monterey] Support building WebKit
https://bugs.webkit.org/show_bug.cgi?id=226846
<rdar://problem/79095148>
Reviewed by Tim Horton.
* wtf/PlatformHave.h: Add HAVE(VK_IMAGE_ANALYSIS).
* wtf/spi/cocoa/SecuritySPI.h:
2021-06-09 Chris Dumez <cdumez@apple.com>
Avoid some calls to StringView::toString() / StringView::toStringWithoutCopying()
https://bugs.webkit.org/show_bug.cgi?id=226803
Reviewed by Darin Adler.
Add support to TextStream for printing a StringView directly, without having to convert
it to a String first.
* wtf/text/TextStream.cpp:
(WTF::TextStream::operator<<):
* wtf/text/TextStream.h:
2021-06-09 Alicia Boya García <aboya@igalia.com>
[WTF][GStreamer] Add RAII lockers for 3rd party locks
https://bugs.webkit.org/show_bug.cgi?id=225650
Reviewed by Xabier Rodriguez-Calvar.
This patch introduces WTF::ExternalLocker, which allows to lock 3rd
party mutexes in a RAII fashion, very similar to WTF::Locker.
This is used also in WebCore to provide RAII lockers for GStreamer.
* wtf/Locker.h:
(WTF::unlockFunction):
2021-06-08 Alex Christensen <achristensen@webkit.org>
Move PrivacyStance code from WebKitAdditions
https://bugs.webkit.org/show_bug.cgi?id=226774
Reviewed by Jer Noble.
* wtf/PlatformHave.h:
2021-06-08 Ben Nham <nham@apple.com>
Use access instead of stat in some filesystem functions
https://bugs.webkit.org/show_bug.cgi?id=226667
Reviewed by Chris Dumez.
We are spending a bit more time in WTF::FileSystemImpl functions after the move to
std::filesystem (https://bugs.webkit.org/show_bug.cgi?id=225255). In particular, several
std::filesystem functions (like the ones called by fileExists and makeAllDirectories) prefer
to use stat() over access() for file existence checks. Since our sandbox has a fast path for
access(path, F_OK) but not for stat, we ended up spending more time in sandbox evaluation in
the kernel after the move to std::filesystem.
Note that the two checks don't do exactly the same thing. access(path, F_OK) only checks for
path existence, while stat(path) additionally fetches metadata, which requires checking the
file-read-metadata permission. But in practice our code was written to be fine with just
checking for existence.
To work around this, I've re-introduced some of the old WTF::FileSystemImpl functions from
FileSystemPosix.cpp. They are the ones that are called by NetworkCache, which seems to be
the biggest consumer of these functions. The rest of the functions are still implemented
using std::filesystem.
* wtf/FileSystem.cpp:
(WTF::FileSystemImpl::fileExists):
(WTF::FileSystemImpl::deleteFile):
(WTF::FileSystemImpl::makeAllDirectories):
(WTF::FileSystemImpl::pathByAppendingComponent):
(WTF::FileSystemImpl::pathByAppendingComponents):
* wtf/PlatformEnableCocoa.h:
* wtf/posix/FileSystemPOSIX.cpp:
(WTF::FileSystemImpl::fileExists):
(WTF::FileSystemImpl::deleteFile):
(WTF::FileSystemImpl::makeAllDirectories):
(WTF::FileSystemImpl::pathByAppendingComponent):
(WTF::FileSystemImpl::pathByAppendingComponents):
2021-06-08 Devin Rousso <drousso@apple.com>
[Payment Request] upstream new features
https://bugs.webkit.org/show_bug.cgi?id=226740
<rdar://problem/78963132>
Reviewed by Andy Estes.
- recurring line items (`HAVE_PASSKIT_RECURRING_SUMMARY_ITEM` and `ENABLE_APPLE_PAY_RECURRING_LINE_ITEM`)
- deferred line items (`HAVE_PASSKIT_DEFERRED_SUMMARY_ITEM` and `ENABLE_APPLE_PAY_DEFERRED_LINE_ITEM`)
- estimated shipping dates (`HAVE_PASSKIT_SHIPPING_METHOD_DATE_COMPONENTS_RANGE` and `ENABLE_APPLE_PAY_SHIPPING_METHOD_DATE_COMPONENTS_RANGE`)
- coupon code entry (`HAVE_PASSKIT_COUPON_CODE` and `ENABLE_APPLE_PAY_COUPON_CODE`)
- shipped vs in-store pickup (`HAVE_PASSKIT_SHIPPING_CONTACT_EDITING_MODE` and `ENABLE_APPLE_PAY_SHIPPING_CONTACT_EDITING_MODE`)
* wtf/PlatformHave.h:
* wtf/PlatformEnableCocoa.h:
2021-06-08 Chris Dumez <cdumez@apple.com>
Reduce use of reinterpret_cast<> in the codebase
https://bugs.webkit.org/show_bug.cgi?id=226743
Reviewed by Darin Adler.
* wtf/CryptographicallyRandomNumber.cpp:
* wtf/FastMalloc.h:
(WTF::FastAllocator::allocate):
* wtf/SHA1.h:
(WTF::SHA1::addBytes):
* wtf/StackCheck.h:
(WTF::StackCheck::Scope::Scope):
(WTF::StackCheck::StackCheck):
* wtf/URLHelpers.cpp:
(WTF::URLHelpers::userVisibleURL):
* wtf/URLParser.cpp:
(WTF::URLParser::formURLDecode):
* wtf/cf/URLCF.cpp:
(WTF::URL::createCFURL const):
* wtf/cocoa/URLCocoa.mm:
(WTF::URL::createCFURL const):
* wtf/persistence/PersistentCoders.cpp:
(WTF::Persistence::Coder<CString>::encode):
(WTF::Persistence::Coder<String>::encode):
* wtf/text/CString.h:
* wtf/text/WTFString.cpp:
(WTF::String::latin1 const):
* wtf/text/cf/StringImplCF.cpp:
(WTF::StringImpl::createCFString):
2021-06-08 Devin Rousso <drousso@apple.com>
[Modern Media Controls] upstream new features
https://bugs.webkit.org/show_bug.cgi?id=226736
<rdar://problem/78957464>
Reviewed by Eric Carlson.
- bring the "Audio"/"Languages" tracks menu to iOS
- add a new "Playback Speed" menu on iOS and macOS in the overflow menu
- add support for showing the most relevant `<track kind="chapters">` in the overflow menu
* wtf/PlatformEnableCocoa.h:
2021-06-08 Sam Weinig <weinig@apple.com>
Add copy of std::span so that we can use it pre-moving to c++20
https://bugs.webkit.org/show_bug.cgi?id=226351
Reviewed by Alex Christensen.
Imports a copy of Tristan Brindle's Boost licensed implementation of std::span
from 5d8d366eca918d0ed3d2d196cbeae6abfd874736 of https://github.com/tcbrindle/span.
It has been further modified to rename tcb::span to WTF::Span.
* LICENSE_1_0-Boost.txt: Added.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/Span.h: Added.
2021-06-07 Alex Christensen <achristensen@webkit.org>
Adopt SecTrustGetCertificateAtIndex replacement where available
https://bugs.webkit.org/show_bug.cgi?id=225893
Reviewed by Chris Dumez.
rdar://74752046 introduced a new way to access the same thing.
* wtf/PlatformHave.h:
2021-06-07 Chris Dumez <cdumez@apple.com>
Drop legacy MainThreadTaskQueue & EventLoopTaskQueue classes
https://bugs.webkit.org/show_bug.cgi?id=226734
Reviewed by Ryosuke Niwa.
We recently introduced the WTF::CancellableTask in order to be able to cancel
a pending task in the event loop, and/or check if the task is still pending.
It worked great as a replacement for EventLoopDeferrableTask. However, it was
insufficient as a replacement for task queues (such as MainThreadTaskQueue &
EventLoopTaskQueue) since there was no convenient way to cancel a group of
tasks. To address this, I am introducing WTF::TaskCancellationGroup. Whenever one
needs to create a CancellableTask, it now needs to provide a TaskCancellationGroup.
Several CancellableTask objects can share the same TaskCancellationGroup. Code now
now schedule one or more CancellableTasks on the event loop and hold on
to a TaskCancellationGroup. If they need to cancel those tasks, they can simply
call cancel() on the TaskCancellationGroup. They can also check if previously
scheduled tasks are still pending via TaskCancellationGroup::hasPendingTask().
* wtf/CancellableTask.h:
(WTF::TaskCancellationGroup::TaskCancellationGroup):
(WTF::TaskCancellationGroup::cancel):
(WTF::TaskCancellationGroup::hasPendingTask const):
(WTF::TaskCancellationGroup::Impl::cancel):
(WTF::TaskCancellationGroup::Impl::hasPendingTask const):
(WTF::TaskCancellationGroup::Handle::isCancelled const):
(WTF::TaskCancellationGroup::Handle::Handle):
(WTF::TaskCancellationGroup::createHandle):
(WTF::CancellableTask::CancellableTask):
(WTF::CancellableTask::operator()):
* wtf/WeakPtr.h:
(WTF::WeakPtrFactory::weakPtrCount const):
2021-06-07 Wenson Hsieh <wenson_hsieh@apple.com>
Upstream WebKit support for Live Text
https://bugs.webkit.org/show_bug.cgi?id=226706
<rdar://problem/78933684>
Reviewed by Tim Horton.
* wtf/PlatformEnableCocoa.h:
Move the feature flag out of WebKitAdditions and into OpenSource as IMAGE_ANALYSIS.
2021-06-07 Alicia Boya García <aboya@igalia.com>
[WTF][GStreamer] Fix clang TSA warnings in WTF::DataMutex
https://bugs.webkit.org/show_bug.cgi?id=226719
Reviewed by Xabier Rodriguez-Calvar.
Fix the remaning clang thread safety warnings in WTF::DataMutex.
The goal of this patch is to reduce the number of warnings in the
GStreamer codebase. Whether DataMutex should be deprecated in favor of
Locker with the clang TSA annotations is outside of the scope of this
patch.
* wtf/DataMutex.h:
2021-06-07 Alicia Boya García <aboya@igalia.com>
[GStreamer] Remove spurious assert in WTF::DataMutex
https://bugs.webkit.org/show_bug.cgi?id=226714
Reviewed by Michael Catanzaro.
Remove DATA_MUTEX_CHECK(!mutex().isHeld()); from the DataMutexLocker
constructor, introduced in r278248.
Trying to lock a currently held mutex is not an error condition that
should crash the process, it will just wait for its turn to lock it.
* wtf/DataMutex.h:
2021-06-06 Chris Dumez <cdumez@apple.com>
Stop using legacy EventLoopDeferrableTask
https://bugs.webkit.org/show_bug.cgi?id=226700
Reviewed by Darin Adler.
Introduce new WTF::CancellableTask type which is a wrapper around a WTF::Function.
It can create a handle for the task and this handle can be used to check if the
task is still pending and to cancel it. This is useful when scheduling tasks in the
event loop for example as there are cases where we need to know if a task we
scheduled is still pending (to avoid double scheduling) or where we need to cancel
a previously scheduled task.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/CancellableTask.h: Added.
(WTF::CancellableTask::CancellableTask):
(WTF::CancellableTask::operator()):
(WTF::CancellableTask::isPending const):
(WTF::CancellableTask::cancel):
(WTF::CancellableTask::Handle::Handle):
(WTF::CancellableTask::Handle::isPending const):
(WTF::CancellableTask::Handle::cancel):
(WTF::CancellableTask::createHandle):
2021-06-04 Chris Dumez <cdumez@apple.com>
FileSystem::readFromFile() should return data as `void*`
https://bugs.webkit.org/show_bug.cgi?id=226671
Reviewed by Darin Adler.
FileSystem::readFromFile() should return data as `void*` instead of `char*`. This is more flexible and
consistent with FileSystem::writeToFile().
* wtf/FileSystem.cpp:
(WTF::FileSystemImpl::appendFileContentsToFileHandle):
(WTF::FileSystemImpl::readOrMakeSalt):
* wtf/FileSystem.h:
* wtf/glib/FileSystemGlib.cpp:
(WTF::FileSystemImpl::readFromFile):
* wtf/posix/FileSystemPOSIX.cpp:
(WTF::FileSystemImpl::readFromFile):
* wtf/win/FileSystemWin.cpp:
(WTF::FileSystemImpl::readFromFile):
2021-06-04 Alex Christensen <achristensen@webkit.org>
Implement off-by-default experimental feature for PerformanceResourceTiming.transferSize, encodedBodySize, and decodedBodySize
https://bugs.webkit.org/show_bug.cgi?id=226629
Reviewed by Brady Eidson.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-06-04 Devin Rousso <drousso@apple.com>
Add a way to prefix output of `WTFReportBacktrace` to make log filtering easier
https://bugs.webkit.org/show_bug.cgi?id=226390
Reviewed by Megan Gardner.
Often times while debugging I add `WTFLogAlways("<DR> ...")` to various places as indicators
that "logic has reached here". This is especially useful when debugging iOS as unlike macOS
there's no console output from `run-safari`, meaning that I have to use system logging,
which is often a deluge of unrelated information. Having "<DR>" as a prefix makes filtering
through the system logging trivial as I can ignore logs that don't have it. Unfortunately,
`WTFReportBacktrace` does not have a way to add this prefix, so it becomes much harder to
find in the logs. This patch enables adding a prefix to each line of `WTFReportBacktrace`
via a new function `WTFReportBactraceWithPrefix`.
* wtf/Assertions.h:
* wtf/Assertions.cpp:
(WTFReportBacktraceWithPrefix): Added.
(WTFPrintBacktraceWithPrefix): Added.
* wtf/StackTrace.h:
(WTF::StackTrace::StackTrace):
* wtf/StackTrace.cpp:
(WTF::StackTrace::dump const):
2021-06-04 Michael Catanzaro <mcatanzaro@gnome.org>
Fix more GCC warnings
https://bugs.webkit.org/show_bug.cgi?id=226193
Reviewed by Adrian Perez de Castro.
Add missing static_cast<void*> required to suppress GCC's -Wclass-memaccess warning when
intentionally not running constructors/destructors. There's already a static_assert to
ensure this is safe, which is better than usual for us.
* wtf/SmallSet.h:
2021-06-03 Chris Dumez <cdumez@apple.com>
Unreviewed build fix after r277881.
Fix warning about unused function.
* wtf/cocoa/FileSystemCocoa.mm:
2021-06-03 Michael Catanzaro <mcatanzaro@gnome.org>
REGRESSION(r277744): Broke build on s390x mainframes
https://bugs.webkit.org/show_bug.cgi?id=226497
Reviewed by Darin Adler.
The problem is we have a template defined in a C++ source file, used by multiple source
files. This is not valid C++, so let's split the templates defined in StringBuilder.cpp out
into a new StringBuilderInternals.h that we can #include in both StringBuilder.cpp and
StringBuilderJSON.cpp.
Ideally we would move the template defined in StringBuilderJSON.cpp as well, and then
eliminate StringBuilderJSON.cpp since there would only be one function left. But that file
has an MPL license. It's easier to leave it be to keep the license situation simpler.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/text/StringBuilder.cpp:
(WTF::StringBuilder::expandedCapacity):
(WTF::expandedCapacity): Deleted.
(WTF::StringBuilder::allocateBuffer): Deleted.
(WTF::StringBuilder::extendBufferForAppending): Deleted.
(WTF::StringBuilder::extendBufferForAppendingSlowCase): Deleted.
* wtf/text/StringBuilder.h:
* wtf/text/StringBuilderInternals.h: Added.
(WTF::StringBuilder::allocateBuffer):
(WTF::StringBuilder::reallocateBuffer):
(WTF::StringBuilder::extendBufferForAppending):
(WTF::StringBuilder::extendBufferForAppendingSlowCase):
* wtf/text/StringBuilderJSON.cpp:
2021-06-02 Chris Dumez <cdumez@apple.com>
Drop WTF::Vector overloads taking index as Checked<size_t>
https://bugs.webkit.org/show_bug.cgi?id=226553
Reviewed by Geoffrey Garen.
Drop WTF::Vector overloads taking index as Checked<size_t>. They are no longer needed now that
Checked<size_t> can implicitly get converted to size_t (r278338).
* wtf/Vector.h:
(WTF::Vector::at const):
(WTF::Vector::operator[] const):
2021-06-02 Chris Dumez <cdumez@apple.com>
Drop Checked::safeGet()
https://bugs.webkit.org/show_bug.cgi?id=226537
Reviewed by Geoffrey Garen.
Drop Checked::safeGet() and replace with uses of Checked::operator T() or Checked::value().
safeGet() is a bit akward, having both a return value and an out-parameter.
* wtf/CheckedArithmetic.h:
(WTF::Checked::value const):
(WTF::operator+):
(WTF::operator-):
(WTF::operator*):
(WTF::operator/):
2021-06-02 Antti Koivisto <antti@apple.com>
Style::Scope should use CheckedPtr
https://bugs.webkit.org/show_bug.cgi?id=226530
Reviewed by Sam Weinig.
* wtf/CMakeLists.txt:
2021-06-02 Chris Dumez <cdumez@apple.com>
Use Checked aliases instead of Checked<T, RecordOverflow>
https://bugs.webkit.org/show_bug.cgi?id=226535
Reviewed by Keith Miller.
* wtf/URLHelpers.cpp:
(WTF::URLHelpers::userVisibleURL):
* wtf/URLParser.cpp:
(WTF::URLParser::parseIPv4Piece):
* wtf/cocoa/NSURLExtras.mm:
(WTF::dataWithUserTypedString):
* wtf/glib/SocketConnection.cpp:
(WTF::SocketConnection::sendMessage):
2021-05-23 Ryosuke Niwa <rniwa@webkit.org>
Add CheckedPtr
https://bugs.webkit.org/show_bug.cgi?id=226158
Reviewed by Antti Koivisto.
This patch introduces a new type of smart pointer, CheckedPtr, which behaves like RefPtr and
let each object keep track of pointers pointing to the object. Unlike CheckedPtr, the purpose of
this internal counter is to release assert that there is no outstanding pointer at the time
of destruction instead of keeping the object alive when there is one.
* WTF.xcodeproj/project.pbxproj:
* wtf/CheckedPtr.h: Added.
(WTF::CheckedPtr): Added.
(WTF::CheckedPtr::CheckedPtr): Added.
(WTF::CheckedPtr::~CheckedPtr): Added.
(WTF::CheckedPtr::isHashTableDeletedValue const): Added.
(WTF::CheckedPtr::operator UnspecifiedBoolType const): Added.
(WTF::CheckedPtr::operator! const): Added.
(WTF::CheckedPtr::get const): Added.
(WTF::CheckedPtr::get): Added.
(WTF::CheckedPtr::operator* const): Added.
(WTF::CheckedPtr::operator*): Added.
(WTF::CheckedPtr::operator-> const): Added.
(WTF::CheckedPtr::operator->): Added.
(WTF::CheckedPtr::operator== const): Added.
(WTF::CheckedPtr::operator=): Added.
(WTF::CheckedPtr::unspecifiedBoolTypeInstance const): Added.
(WTF::CheckedPtr::refIfNotNull): Added.
(WTF::CheckedPtr::derefIfNotNull): Added.
(WTF::makeCheckedPtr): Added.
(WTF::is): Added.
(WTF::CanMakeCheckedPtr): Added.
(WTF::CanMakeCheckedPtr::~CanMakeCheckedPtr): Added. Release assert that m_ptrCount is 0.
(WTF::CanMakeCheckedPtr::ptrCount const): Added.
(WTF::CanMakeCheckedPtr::incrementPtrCount): Added.
(WTF::CanMakeCheckedPtr::decrementPtrCount): Added. Note that we don't do anything when m_ptrCount
becomes 0 unlike RefPtr.
(WTF::HashTraits<CheckedPtr<P>>): Added.
(WTF::HashTraits<CheckedPtr<P>>::emptyValue): Added.
(WTF::HashTraits<CheckedPtr<P>>::peek): Added.
(WTF::HashTraits<CheckedPtr<P>>::customDeleteBucket): Added.
2021-06-01 Darin Adler <darin@apple.com>
Remove <wtf/Optional.h>
https://bugs.webkit.org/show_bug.cgi?id=226437
Reviewed by Chris Dumez.
* <many files>: Removed include of <wtf/Optional.h>.
* WTF.xcodeproj/project.pbxproj: Removed Optional.h.
* wtf/Markable.h: Added include of <optional>.
* wtf/OptionSet.h: Ditto.
* wtf/Optional.h: Emptied this file. On the Windows build system, we can't
seem to build successfully without an empty file here. The copied forwarding
header seems to linger even if we remove the original. Until we fix the
Windows build system, if we want to support incremental builds, we need
to keep this empty file around.
* wtf/PrintStream.h: Added include of <optional>.
* wtf/Seconds.h: Ditto.
* wtf/StackTrace.h: Ditto.
* wtf/StdLibExtras.h: Moved the valueOrCompute function here from Optional.h.
Re-sorted the "using" at the bottom of the file.
* wtf/URLHelpers.h: Added include of <optional>.
* wtf/Vector.h: Ditto.
2021-06-01 Chris Dumez <cdumez@apple.com>
Rename Checked::unsafeGet() to Checked::value()
https://bugs.webkit.org/show_bug.cgi?id=226514
Reviewed by Darin Adler.
Rename Checked::unsafeGet() to Checked::value(). The "unsafeGet" naming is confusing as this
function isn't really unsafe since it will crash if the value has overflowed. Also add an
`operator T()` to implicitly convert a Checked to its underlying type without needing to
call value().
* wtf/CheckedArithmetic.h:
(WTF::Checked::operator! const):
(WTF::Checked::operator bool const):
(WTF::Checked::operator T const):
(WTF::Checked::value const):
(WTF::Checked::operator==):
(WTF::Checked::operator< const):
(WTF::Checked::operator<= const):
(WTF::Checked::operator> const):
(WTF::Checked::operator>= const):
* wtf/ConcurrentBuffer.h:
* wtf/FastMalloc.cpp:
(WTF::fastCalloc):
(WTF::tryFastCalloc):
* wtf/Gigacage.cpp:
(Gigacage::tryMallocArray):
* wtf/URLHelpers.cpp:
(WTF::URLHelpers::userVisibleURL):
* wtf/URLParser.cpp:
(WTF::URLParser::parseIPv4Piece):
* wtf/UniqueArray.h:
* wtf/cocoa/NSURLExtras.mm:
(WTF::dataWithUserTypedString):
* wtf/glib/SocketConnection.cpp:
(WTF::SocketConnection::readMessage):
(WTF::SocketConnection::sendMessage):
* wtf/text/CString.cpp:
(WTF::CStringBuffer::createUninitialized):
* wtf/text/StringBuffer.h:
(WTF::StringBuffer::StringBuffer):
* wtf/text/StringBuilderJSON.cpp:
(WTF::StringBuilder::appendQuotedJSONString):
* wtf/text/StringConcatenate.h:
(WTF::tryMakeStringFromAdapters):
* wtf/text/StringImpl.h:
(WTF::StringImpl::allocationSize):
* wtf/text/StringToIntegerConversion.h:
(WTF::parseInteger):
2021-06-01 Chris Dumez <cdumez@apple.com>
Unreviewed build fix after r277881.
Silence unused parameter warnings.
* wtf/cocoa/FileSystemCocoa.mm:
(WTF::FileSystemImpl::setAllowsMaterializingDatalessFiles):
(WTF::FileSystemImpl::allowsMaterializingDatalessFiles): Deleted.
(WTF::FileSystemImpl::isSafeToUseMemoryMapForPath): Deleted.
(WTF::FileSystemImpl::makeSafeToUseMemoryMapForPath): Deleted.
2021-06-01 Adrian Perez de Castro <aperez@igalia.com>
[WPE][GTK] Support building against uClibc
https://bugs.webkit.org/show_bug.cgi?id=226244
Reviewed by Michael Catanzaro.
* wtf/PlatformRegisters.h: Use the <sys/ucontext.h> header instead of
<ucontext.h>, which is enough to gain access to the type definitions
for CPU registers and is available on every libc. On the other hand,
uClibc does not have <ucontext.h>, so this fixes the build in that
case.
2021-05-30 Chris Dumez <cdumez@apple.com>
Drop UncheckedCondition / UncheckedLock
https://bugs.webkit.org/show_bug.cgi?id=226432
Reviewed by Darin Adler.
Drop UncheckedCondition / UncheckedLock now that the whole codebase has been ported to
Condition / Lock, which support Clang thread safety analysis.
* wtf/Condition.h:
* wtf/Forward.h:
* wtf/Lock.cpp:
(WTF::Lock::lockSlow):
(WTF::Lock::unlockSlow):
(WTF::Lock::unlockFairlySlow):
(WTF::Lock::safepointSlow):
* wtf/Lock.h:
(WTF::assertIsHeld):
(WTF::WTF_ASSERTS_ACQUIRED_LOCK):
2021-05-30 Darin Adler <darin@apple.com>
Remove WTF::Optional synonym for std::optional, using that class template directly instead
https://bugs.webkit.org/show_bug.cgi?id=226433
Reviewed by Chris Dumez.
* <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>.
* wtf/Optional.h: Remove WTF::Optional.
2021-05-29 Chris Dumez <cdumez@apple.com>
Stop using UncheckedLock in JSC::VMInspector
https://bugs.webkit.org/show_bug.cgi?id=226427
Reviewed by Mark Lam.
Add Lock::tryLockWithTimeout(), similar to tryLock() but gives up after a
specified timeout. This used to be implemented in VMInspector but I think
Lock is a better place for it.
* wtf/Lock.cpp:
(WTF::Lock::tryLockWithTimeout):
* wtf/Lock.h:
2021-05-29 Chris Dumez <cdumez@apple.com>
Adopt clang thread safety annotations in WTF::DataMutex
https://bugs.webkit.org/show_bug.cgi?id=226431
Reviewed by Darin Adler.
Adopt clang thread safety annotations in WTF::DataMutex. This allows us to
stop using UncheckedCondition in a few places.
* wtf/DataMutex.h:
(WTF::DataMutex::DataMutex):
2021-05-28 Darin Adler <darin@apple.com>
Clients of optional should use has_value instead of relying on hasValue macro
https://bugs.webkit.org/show_bug.cgi?id=226395
Reviewed by Chris Dumez.
* wtf/Hasher.h: Use has_value.
* wtf/Optional.h: Remove hasValue macro. Not needed any more, but also a bit
dangerous because of how widespread the use of hasValue is for things other
than WTF::Optional.
2021-05-28 Alex Christensen <achristensen@webkit.org>
Punycode encode U+0BE6 when not in context of other Tamil characters
https://bugs.webkit.org/show_bug.cgi?id=226409
<rdar://78160926>
Reviewed by Tim Horton.
It has quite legitimate use, so we don't want to always punycode encode it,
but when used in the context of non-Tamil characters we want to punycode encode it.
* wtf/URLHelpers.cpp:
(WTF::URLHelpers::isLookalikeCharacterOfScriptType<USCRIPT_ARMENIAN>):
(WTF::URLHelpers::isLookalikeCharacterOfScriptType<USCRIPT_TAMIL>):
(WTF::URLHelpers::isOfScriptType):
(WTF::URLHelpers::isLookalikeSequence):
(WTF::URLHelpers::isLookalikeCharacter):
(WTF::URLHelpers::isArmenianLookalikeCharacter): Deleted.
(WTF::URLHelpers::isArmenianScriptCharacter): Deleted.
(WTF::URLHelpers::isArmenianLookalikeSequence): Deleted.
2021-05-28 Chris Dumez <cdumez@apple.com>
Stop using UncheckedLock in WTF::MetaAllocator
https://bugs.webkit.org/show_bug.cgi?id=226396
Reviewed by Darin Adler.
Stop using UncheckedLock in WTF::MetaAllocator, as it is being phased out in favor on Lock,
which supports Clang thread safety analysis.
* wtf/MetaAllocator.cpp:
(WTF::MetaAllocator::release):
(WTF::MetaAllocator::MetaAllocator):
(WTF::MetaAllocator::allocate):
(WTF::MetaAllocator::currentStatistics):
* wtf/MetaAllocator.h:
2021-05-28 Robin Morisset <rmorisset@apple.com>
Fix LikelyDenseUnsignedIntegerSet::clear()
https://bugs.webkit.org/show_bug.cgi?id=226388
Reviewed by Mark Lam.
There are two problems with it:
1) It calls BitVector::clearAll(), which does not free any memory.
Instead, it should call BitVector::~BitVector(), then do a placement new of a fresh BitVector (to get it back to its inline condition)
2) More problematically, it changes m_size before calling isBitVector() which relies crucially on the value of m_size.
So it is going to believe that it is in BitVector mode even when it is actually in HashSet mode.
* wtf/LikelyDenseUnsignedIntegerSet.h:
(WTF::LikelyDenseUnsignedIntegerSet::clear):
2021-05-28 Sam Weinig <weinig@apple.com>
Add stub implementation of CA separated portal bits for GraphicsLayer
https://bugs.webkit.org/show_bug.cgi?id=226343
Reviewed by Simon Fraser.
* wtf/PlatformHave.h: Add HAVE_CORE_ANIMATION_SEPARATED_PORTALS.
2021-05-28 Chris Dumez <cdumez@apple.com>
Unreviewed build fix after r277881.
Deal with IOPOL_TYPE_VFS_MATERIALIZE_DATALESS_FILES potentially not being defined on
older OSes.
* wtf/cocoa/FileSystemCocoa.mm:
(WTF::FileSystemImpl::setAllowsMaterializingDatalessFiles):
(WTF::FileSystemImpl::allowsMaterializingDatalessFiles):
2021-05-28 Chris Dumez <cdumez@apple.com>
Unreviewed build fix after r277881.
Add missing header include.
* wtf/cocoa/FileSystemCocoa.mm:
2021-05-27 Said Abou-Hallawa <said@apple.com>
Values of keySplines control points must all be in the range 0 to 1
https://bugs.webkit.org/show_bug.cgi?id=226336
Reviewed by Sam Weinig.
* wtf/MathExtras.h:
(isInRange):
There are a least couple of implementations of this function in WebCore.
The next step is to remove the redundant code in WebCore and use this one.
2021-05-27 Robin Morisset <rmorisset@apple.com>
AirAllocateStackByGraphColoring should use the optimized interference graphs from AirAllocateRegistersByGraphColoring
https://bugs.webkit.org/show_bug.cgi?id=226258
Reviewed by Phil Pizlo.
I moved the interference graphs datastructures from AirAllocateRegistersByGraphColoring to their own wtf/InterferenceGraph.h file.
There are three of them:
- SmallInterferenceGraph, best for n < 400
- LargeInterferenceGraph, for n < 2**16
- HugeInterferenceGraph, for n up to 2**32
I also added "Iterable" versions of them, that have an operator[] method whose result you can iterate on to get all the indices which interfere with a given index.
SmallIterableInterferenceGraph is the same as the non-iterable version, but the Large and Huge versions are a bit slower than their counterparts and use 2x memory.
All of these were tested by running JetStream2 with the TEST_OPTIMIZED_INTERFERENCE_GRAPH set to 1.
This flag makes the optimized datastructures run in parallel with a reference implementation, and their results are checked for equality on every method call.
There is one small difference allowed: iteration is not guaranteed to go through elements in the same order.
I also added a clear() method to LikelyDenseUnsignedIntegerSet, and added the NotNull flag to its various uses of placement new.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/HashSet.h:
(WTF::W>::memoryUse const):
* wtf/InterferenceGraph.h: Added.
(WTF::InterferenceBitVector::contains):
(WTF::InterferenceBitVector::addAndReturnIsNewEntry):
(WTF::InterferenceBitVector::add):
(WTF::InterferenceBitVector::clear):
(WTF::InterferenceBitVector::mayClear):
(WTF::InterferenceBitVector::setMaxIndex):
(WTF::InterferenceBitVector::forEach):
(WTF::InterferenceBitVector::size const):
(WTF::InterferenceBitVector::memoryUse const):
(WTF::InterferenceBitVector::dumpMemoryUseInKB const):
(WTF::InterferenceBitVector::Iterable::iterator::operator++):
(WTF::InterferenceBitVector::Iterable::iterator::operator* const):
(WTF::InterferenceBitVector::Iterable::iterator::operator== const):
(WTF::InterferenceBitVector::Iterable::iterator::operator!= const):
(WTF::InterferenceBitVector::Iterable::begin const):
(WTF::InterferenceBitVector::Iterable::end const):
(WTF::InterferenceBitVector::operator[] const):
(WTF::InterferenceBitVector::index const):
(WTF::InterferenceVector::contains):
(WTF::InterferenceVector::addAndReturnIsNewEntry):
(WTF::InterferenceVector::add):
(WTF::InterferenceVector::clear):
(WTF::InterferenceVector::mayClear):
(WTF::InterferenceVector::setMaxIndex):
(WTF::InterferenceVector::forEach):
(WTF::InterferenceVector::size const):
(WTF::InterferenceVector::memoryUse const):
(WTF::InterferenceVector::dumpMemoryUseInKB const):
(WTF::InterferenceVector::Iterable::begin const):
(WTF::InterferenceVector::Iterable::end const):
(WTF::InterferenceVector::operator[] const):
(WTF::UndirectedEdgesDuplicatingAdapter::contains):
(WTF::UndirectedEdgesDuplicatingAdapter::addAndReturnIsNewEntry):
(WTF::UndirectedEdgesDuplicatingAdapter::add):
(WTF::UndirectedEdgesDuplicatingAdapter::clear):
(WTF::UndirectedEdgesDuplicatingAdapter::mayClear):
(WTF::UndirectedEdgesDuplicatingAdapter::setMaxIndex):
(WTF::UndirectedEdgesDuplicatingAdapter::forEach):
(WTF::UndirectedEdgesDuplicatingAdapter::size const):
(WTF::UndirectedEdgesDuplicatingAdapter::memoryUse const):
(WTF::UndirectedEdgesDuplicatingAdapter::dumpMemoryUseInKB const):
(WTF::UndirectedEdgesDuplicatingAdapter::operator[] const):
(WTF::UndirectedEdgesDedupAdapter::contains):
(WTF::UndirectedEdgesDedupAdapter::addAndReturnIsNewEntry):
(WTF::UndirectedEdgesDedupAdapter::add):
(WTF::UndirectedEdgesDedupAdapter::clear):
(WTF::UndirectedEdgesDedupAdapter::mayClear):
(WTF::UndirectedEdgesDedupAdapter::setMaxIndex):
(WTF::UndirectedEdgesDedupAdapter::forEach):
(WTF::UndirectedEdgesDedupAdapter::size const):
(WTF::UndirectedEdgesDedupAdapter::memoryUse const):
(WTF::UndirectedEdgesDedupAdapter::dumpMemoryUseInKB const):
(WTF::InterferenceHashSet::contains):
(WTF::InterferenceHashSet::addAndReturnIsNewEntry):
(WTF::InterferenceHashSet::add):
(WTF::InterferenceHashSet::clear):
(WTF::InterferenceHashSet::setMaxIndex):
(WTF::InterferenceHashSet::forEach):
(WTF::InterferenceHashSet::size const):
(WTF::InterferenceHashSet::memoryUse const):
(WTF::InterferenceHashSet::dumpMemoryUseInKB const):
(WTF::InstrumentedInterferenceGraph::contains):
(WTF::InstrumentedInterferenceGraph::addAndReturnIsNewEntry):
(WTF::InstrumentedInterferenceGraph::add):
(WTF::InstrumentedInterferenceGraph::clear):
(WTF::InstrumentedInterferenceGraph::mayClear):
(WTF::InstrumentedInterferenceGraph::setMaxIndex):
(WTF::InstrumentedInterferenceGraph::forEach):
(WTF::InstrumentedInterferenceGraph::size const):
(WTF::InstrumentedInterferenceGraph::memoryUse const):
(WTF::InstrumentedInterferenceGraph::dumpMemoryUseInKB const):
(WTF::InstrumentedIterableInterferenceGraph::Iterable::Iterable):
(WTF::InstrumentedIterableInterferenceGraph::Iterable::begin const):
(WTF::InstrumentedIterableInterferenceGraph::Iterable::end const):
(WTF::InstrumentedIterableInterferenceGraph::operator[] const):
* wtf/LikelyDenseUnsignedIntegerSet.h:
(WTF::LikelyDenseUnsignedIntegerSet::LikelyDenseUnsignedIntegerSet):
(WTF::LikelyDenseUnsignedIntegerSet::clear):
(WTF::LikelyDenseUnsignedIntegerSet::add):
(WTF::LikelyDenseUnsignedIntegerSet::estimateHashSetSize):
(WTF::LikelyDenseUnsignedIntegerSet::transitionToHashSet):
(WTF::LikelyDenseUnsignedIntegerSet::transitionToBitVector):
2021-05-27 Darin Adler <darin@apple.com>
Next step toward using std::optional directly instead of through WTF::Optional typedef
https://bugs.webkit.org/show_bug.cgi?id=226280
Reviewed by Chris Dumez.
* <many files>: Accept the renaming done by do-webcore-rename.
* wtf/Optional.h: Remove WTF::nullopt_t and WTF::makeOptional.
* wtf/URLHelpers.cpp:
(WTF::URLHelpers::mapHostName): Convert from nullopt to std::nullopt.
2021-05-27 Sihui Liu <sihui_liu@apple.com>
Abandon pending tasks on background thread when WebIDBServer is closed
https://bugs.webkit.org/show_bug.cgi?id=226295
Reviewed by Chris Dumez.
Make the wait end with either a new message or queue being killed.
* wtf/CrossThreadQueue.h:
(WTF::CrossThreadQueue<DataType>::waitForMessage):
* wtf/CrossThreadTask.h:
(WTF::CrossThreadTask::operator bool const):
* wtf/CrossThreadTaskHandler.cpp:
(WTF::CrossThreadTaskHandler::taskRunLoop):
2021-05-27 Don Olmstead <don.olmstead@sony.com>
[CMake] Add check for timingsafe_bcmp
https://bugs.webkit.org/show_bug.cgi?id=226347
Reviewed by Chris Dumez.
Use HAVE(TIMINGSAFE_BCMP) in CryptographicUtilities code. Set its value in PlatformHave for
platforms not using CMake.
* wtf/CryptographicUtilities.cpp:
* wtf/CryptographicUtilities.h:
* wtf/PlatformHave.h:
2021-05-27 Mikhail R. Gadelha <mikhail.ramalho@gmail.com>
Increase NumberToStringBuffer to account for negative number
https://bugs.webkit.org/show_bug.cgi?id=226014
Reviewed by Robin Morisset.
In r250389, NumberToStringBuffer length was increased from 96 to 123 because:
<21 digits> + decimal point + <100 digits> + null char = 123.
however,
a = -100000000000000000000
a.toFixed(100)
is a valid conversion and it is 124 chars long, because of the "-" sign.
So this patch increases the length of NumberToStringBuffer to 124 and adds new
test cases.
Reviewed by Ryosuke Niwa.
* wtf/dtoa.h:
2021-05-27 Alex Christensen <achristensen@webkit.org>
Revert r277344
https://bugs.webkit.org/show_bug.cgi?id=225602
<rdar://78411776>
* wtf/PlatformHave.h:
2021-05-27 Devin Rousso <drousso@apple.com>
Use `NSLocale` SPI for comparing language identifiers instead of string comparison
https://bugs.webkit.org/show_bug.cgi?id=226252
Reviewed by Wenson Hsieh.
The existing `indexOfBestMatchingLanguageInList` logic uses (sub)string comparison of BCP47
language tags (e.g. looking for a `'-'` and comparing the substring before and after in the
input language and each item in the language list). While this does work for some languages,
it's really not the correct way to compare BCP47 language tags. Additionally, it basically
ignores the text after the first `'-'`, unless there's an exact match with the input
language. This leads to `"zh-CN"` and `"zh-HK"` being considered a (not exact) match, which
isn't ideal.
* wtf/Language.cpp:
* wtf/cocoa/LanguageCocoa.mm:
(WTF::indexOfBestMatchingLanguageInList): Added.
* wtf/spi/cocoa/NSLocaleSPI.h:
2021-05-26 Cameron McCormack <heycam@apple.com>
Prevent sbix glyphs from being rendered in the GPU process
https://bugs.webkit.org/show_bug.cgi?id=226159
<rdar://77231959>
Reviewed by Darin Adler.
* wtf/PlatformHave.h: Add HAVE_CORE_TEXT_SBIX_IMAGE_SIZE_FUNCTIONS.
2021-05-26 Chris Dumez <cdumez@apple.com>
Leverage the new Vector(const T*, size_t) constructor
https://bugs.webkit.org/show_bug.cgi?id=226304
Reviewed by Darin Adler.
Leverage the new Vector(const T*, size_t) constructor in existing code.
* wtf/text/WTFString.cpp:
(asciiDebug):
2021-05-26 Chris Dumez <cdumez@apple.com>
Use timingsafe_bcmp() in WTF::constantTimeMemcmp() when available
https://bugs.webkit.org/show_bug.cgi?id=226294
<rdar://problem/78542643>
Reviewed by Darin Adler.
Follow-up to r278140 to address post-landing feedback.
* wtf/CryptographicUtilities.cpp:
(WTF::constantTimeMemcmp):
* wtf/CryptographicUtilities.h:
(WTF::constantTimeMemcmp):
2021-05-26 Chris Dumez <cdumez@apple.com>
Use timingsafe_bcmp() in WTF::constantTimeMemcmp() when available
https://bugs.webkit.org/show_bug.cgi?id=226294
Reviewed by Alex Christensen.
Use timingsafe_bcmp() in WTF::constantTimeMemcmp() when available (iOS, macOS, FreeBSD, OpenBSD),
instead of our own custom implementation.
* wtf/CryptographicUtilities.cpp:
(WTF::constantTimeMemcmp):
2021-05-26 Chris Dumez <cdumez@apple.com>
[Hardening] Have the Ref<> destructor null out its pointer
https://bugs.webkit.org/show_bug.cgi?id=226293
<rdar://problem/78532149>
Reviewed by Geoffrey Garen.
* wtf/Ref.h:
(WTF::Ref::~Ref):
2021-05-26 Alex Christensen <achristensen@webkit.org>
URL path setter messes up UTF-8 encoding after ?
https://bugs.webkit.org/show_bug.cgi?id=226136
Reviewed by Chris Dumez.
escapePathWithoutCopying needs to tell percentEncodeCharacters to percent encode all non-ASCII characters in the output of UTF-8 encoding
in addition to ? and #. Otherwise, we take the output of UTF-8 encoding and append each code unit to the input of URL parsing as if it were Latin-1.
This matches Chrome, Firefox, and reason.
Covered by a newly passing WPT test.
Other callers of percentEncodeCharacters use functions that already encode all non-ASCII characters.
* wtf/URL.cpp:
(WTF::escapePathWithoutCopying):
2021-05-26 Chris Dumez <cdumez@apple.com>
Stop using UncheckedLock in WTF::AutomaticThread
https://bugs.webkit.org/show_bug.cgi?id=226255
Reviewed by Keith Miller.
Stop using UncheckedLock in WTF::AutomaticThread as it is being phased out in favor of
Lock, which supports Clang thread safety analysis.
* wtf/AutomaticThread.cpp:
(WTF::AutomaticThreadCondition::wait):
(WTF::AutomaticThreadCondition::waitFor):
(WTF::AutomaticThread::AutomaticThread):
* wtf/AutomaticThread.h:
* wtf/ParallelHelperPool.cpp:
(WTF::ParallelHelperClient::~ParallelHelperClient):
(WTF::ParallelHelperClient::finish):
(WTF::ParallelHelperClient::finishWithLock):
(WTF::ParallelHelperPool::ParallelHelperPool):
* wtf/ParallelHelperPool.h:
(WTF::ParallelHelperPool::numberOfThreads const):
* wtf/WorkerPool.cpp:
(WTF::WorkerPool::WorkerPool):
* wtf/WorkerPool.h:
2021-05-25 Chris Dumez <cdumez@apple.com>
Use UncheckedLock less in JavaScriptCore
https://bugs.webkit.org/show_bug.cgi?id=226212
Reviewed by Saam Barati.
Add support for unlockEarly() to Locker<Lock> specialization, for consistency
with the generic Locker.
* wtf/Lock.h:
2021-05-25 Devin Rousso <drousso@apple.com>
[Modern Media Controls] REGRESSION(r254389) media controls needs the full list of language preferences for ordering tracks
https://bugs.webkit.org/show_bug.cgi?id=226038
Reviewed by Myles C. Maxfield and Eric Carlson.
Media controls need access to the full list of language preferences in order to properly
sort/order the list of tracks in the controls UI. For example, if a `<video>` has subtitles
for English, Spanish, and French, and the user has English (default) and French (alternate)
configured in the Language & Region view of System Preferences on macOS, WebKit should order
the subtitles list English, French, and then Spanish.
* wtf/Language.h:
* wtf/Language.cpp:
(WTF::cachedFullPlatformPreferredLanguages): Added.
(WTF::cachedMinimizedPlatformPreferredLanguages): Added.
(WTF::languageDidChange):
(WTF::defaultLanguage):
(WTF::userPreferredLanguages):
(WTF::platformLanguageDidChange): Deleted.
Move the caching in `wtf/cf/LanguageCF.cpp` to `wtf/Language.cpp` so that all platforms can
benefit from caching the result of `platformUserPreferredLanguages`.
* wtf/cf/LanguageCF.cpp:
(WTF::platformUserPreferredLanguages):
(WTF::platformLanguageDidChange): Deleted.
* wtf/playstation/LanguagePlayStation.cpp:
(WTF::platformUserPreferredLanguages):
* wtf/spi/cocoa/NSLocaleSPI.h:
* wtf/unix/LanguageUnix.cpp:
(WTF::platformUserPreferredLanguages):
* wtf/win/LanguageWin.cpp:
(WTF::platformUserPreferredLanguages):
Add `WTF::ShouldMinimizeLanguages` that controls whether `WTF::minimizedPreferredLanguages`
is called. Since the result is cached, create separate `Vector<String>` for each enum value.
2021-05-25 Chris Dumez <cdumez@apple.com>
Stop using UncheckedLock in html/canvas
https://bugs.webkit.org/show_bug.cgi?id=226186
Reviewed by Darin Adler.
Allow converting a Locker<Lock> to an AbstractLocker type. This allows porting
code from UncheckedLock to Lock even if said code is passing the Locker<Lock>
as parameter around as an AbstractLocker. This is very common in JSC and in
html/canvas.
Also make DropLockForScope work with Locker<Lock> to help port code over.
* wtf/Lock.h:
2021-05-24 Darin Adler <darin@apple.com>
Switch from WTF::Optional to std::optional
https://bugs.webkit.org/show_bug.cgi?id=211674
Reviewed by Chris Dumez.
* wtf/Forward.h: Remove Optional forward declaration.
Also include Optional.h, just for now. Need to remove this once
we do the global rename.
* wtf/Optional.h: Replaced the entire WTF::Optional implementation
with a WTF::Optional "using" that makes it a synonym for std::optional.
WTF::nullopt being a synonym for std::nullopt and WTF::nullopt_t
being a synonym for std::nullopt_t. Also included functions so
that WTF::makeOptional calls std::make_optional and kept the
WTF extension named valueOrCompute. Need to remove these once we
do the global rename, and likely just get rid of valueOrCompute, and
then delete this entire header.
* wtf/Seconds.h: Added an include of FastMalloc.h, since it's no
longer pulled in because of including Optional.h.
* wtf/persistence/PersistentCoder.h: Use Forward.h for now instead of
forward-declaring WTF::optional.
2021-05-25 Per Arne Vollan <pvollan@apple.com>
[AppleWin] JSC fails to build
https://bugs.webkit.org/show_bug.cgi?id=226225
<rdar://78330435>
Reviewed by Brent Fulgham.
Speculative build fix for missing script to generate unified sources. Make sure the WTF scripts directory exists before
copying the script there, and add a CMake log message to help further debugging if this is not the correct fix.
* wtf/CMakeLists.txt:
2021-05-25 Don Olmstead <don.olmstead@sony.com>
[PlayStation] Implement FileSystem without std::filesystem
https://bugs.webkit.org/show_bug.cgi?id=226197
Reviewed by Chris Dumez.
The PlayStation 4 doesn't have support in its SDK for std::filesystem so backport the
functions jettisoned from FileSystemPOSIX and add them to a FileSystemPlayStation.cpp.
The ordering matches the contents of FileSystem.cpp.
Most of the functions ported to std::filesystem were just moved over as is from the commit
prior to r276879. Minor changes to the function signatures made when required.
The fileTypePotentiallyFollowingSymLinks function was created from the previous behavior
of fileMetadataUsingFunction and toFileMetataType.
The hardLinkCount was created from looking at the behavior hardLinkCount replaced in
r277446.
* wtf/FileSystem.cpp:
* wtf/PlatformHave.h:
* wtf/PlatformPlayStation.cmake:
* wtf/StdFilesystem.h:
* wtf/playstation/FileSystemPlayStation.cpp: Added.
(WTF::FileSystemImpl::fileTypePotentiallyFollowingSymLinks):
(WTF::FileSystemImpl::fileExists):
(WTF::FileSystemImpl::deleteFile):
(WTF::FileSystemImpl::deleteEmptyDirectory):
(WTF::FileSystemImpl::moveFile):
(WTF::FileSystemImpl::fileSize):
(WTF::FileSystemImpl::makeAllDirectories):
(WTF::FileSystemImpl::volumeFreeSpace):
(WTF::FileSystemImpl::createSymbolicLink):
(WTF::FileSystemImpl::hardLink):
(WTF::FileSystemImpl::hardLinkOrCopyFile):
(WTF::FileSystemImpl::hardLinkCount):
(WTF::FileSystemImpl::deleteNonEmptyDirectory):
(WTF::FileSystemImpl::fileModificationTime):
(WTF::FileSystemImpl::updateFileModificationTime):
(WTF::FileSystemImpl::isHiddenFile):
(WTF::FileSystemImpl::fileType):
(WTF::FileSystemImpl::fileTypeFollowingSymlinks):
(WTF::FileSystemImpl::pathFileName):
(WTF::FileSystemImpl::parentPath):
(WTF::FileSystemImpl::realPath):
(WTF::FileSystemImpl::pathByAppendingComponent):
(WTF::FileSystemImpl::pathByAppendingComponents):
(WTF::FileSystemImpl::listDirectory):
2021-05-24 Chris Dumez <cdumez@apple.com>
Stop using UncheckedLock in WTF::RecursiveLock
https://bugs.webkit.org/show_bug.cgi?id=226206
Reviewed by Sam Weinig.
Stop using UncheckedLock in WTF::RecursiveLock and use a regular Lock instead.
This is a step towards phasing out UncheckedLock.
Note that despite this change, RecursiveLock still doesn't benefit from
Clang thread safety analysis. Its functions do conditional locking / unlocking
which are not currently supported by analysis. Even if they were, we'd need
a template specialization for RecursiveLockAdapter<Lock> since
RecursiveLockAdapter may wrap other types of Lock which do not support analysis.
* wtf/RecursiveLockAdapter.h:
2021-05-24 Darin Adler <darin@apple.com>
Remove StringBuilder::appendLiteral
https://bugs.webkit.org/show_bug.cgi?id=226137
Reviewed by Chris Dumez.
The optimization done by appendLiteral has minimal value and is something we
can do without. It does not cut down the number of allocations, which is the
main cost of the StringBuilder class. Getting rid of the differently named
appendLiteral improves the design of the StringBuilder class for callers.
Our goal is to get as close as possible to a single append function.
If we decide we need an optimization for literals, we can come up with a
different way that is compatible with append. For example, we could assume
that any char array is a literal and check that at compile time in
StringConcatenate; that optimization would work for both makeString and
StringBuilder. Or we could use a strategy like ASCIILiteral.
* wtf/FileSystem.cpp:
(WTF::FileSystemImpl::encodeForFileName): Streamline logic,
and use variadic append to make this more efficient.
* wtf/JSONValues.cpp:
(WTF::JSONImpl::Value::escapeString): Use append instead
of appendLiteral.
(WTF::JSONImpl::Value::writeJSON const): Ditto.
* wtf/Logger.h:
(WTF::Logger::log): Use auto for result of makeString.
(WTF::Logger::logVerbose): Ditto.
* wtf/MediaTime.cpp:
(WTF::MediaTime::toString const): Use makeString instead of StringBuilder.
* wtf/text/IntegerToStringConversion.h:
Made lengthOfIntegerAsString a constexpr function so we can use it to
compute the required size of arrays for conversion. Added using for both
lengthOfIntegerAsString and writeIntegerToBuffer so we can use them without
the WTF prefix as is customary for functions in WTF.
* wtf/text/StringBuilder.h:
(WTF::StringBuilder::appendLiteral): Deleted.
* wtf/text/StringConcatenate.h: Added support for appending StringImpl&,
StringImpl*, AtomStringImpl&, and AtomStringImpl*.
2021-05-24 Keith Miller <keith_miller@apple.com>
Unreviewed, revert r276610 because it causes a 1% PLT regression.
* wtf/Bag.h:
2021-05-24 Chris Dumez <cdumez@apple.com>
Drop CheckedLock / CheckedCondition aliases
https://bugs.webkit.org/show_bug.cgi?id=226176
Reviewed by Kate Cheney.
Drop CheckedLock / CheckedCondition aliases now that they are the default.
* WTF.xcodeproj/project.pbxproj:
* wtf/Assertions.cpp:
* wtf/AutomaticThread.cpp:
(WTF::AutomaticThreadCondition::wait):
(WTF::AutomaticThreadCondition::waitFor):
(WTF::AutomaticThread::AutomaticThread):
* wtf/AutomaticThread.h:
* wtf/CMakeLists.txt:
* wtf/CheckedCondition.h: Removed.
* wtf/CheckedLock.h: Removed.
* wtf/Condition.h:
* wtf/CrossThreadQueue.h:
* wtf/CrossThreadTaskHandler.h:
* wtf/CryptographicallyRandomNumber.cpp:
* wtf/FastMalloc.cpp:
* wtf/Forward.h:
* wtf/Language.cpp:
* wtf/Lock.cpp:
(WTF::UncheckedLock::lockSlow):
(WTF::UncheckedLock::unlockSlow):
(WTF::UncheckedLock::unlockFairlySlow):
(WTF::UncheckedLock::safepointSlow):
* wtf/Lock.h:
(WTF::WTF_ASSERTS_ACQUIRED_LOCK):
* wtf/Logger.cpp:
* wtf/Logger.h:
(WTF::Logger::WTF_RETURNS_LOCK):
* wtf/MessageQueue.h:
* wtf/MetaAllocator.cpp:
(WTF::MetaAllocator::release):
(WTF::MetaAllocator::MetaAllocator):
(WTF::MetaAllocator::allocate):
(WTF::MetaAllocator::currentStatistics):
* wtf/MetaAllocator.h:
* wtf/OSLogPrintStream.h:
* wtf/ParallelHelperPool.cpp:
(WTF::ParallelHelperPool::ParallelHelperPool):
* wtf/ParallelHelperPool.h:
* wtf/ParallelJobsGeneric.h:
* wtf/ParallelVectorIterator.h:
* wtf/ReadWriteLock.h:
* wtf/RecursiveLockAdapter.h:
* wtf/RunLoop.h:
* wtf/SynchronizedFixedQueue.h:
* wtf/Threading.cpp:
(WTF::Thread::allThreadsLock):
* wtf/Threading.h:
* wtf/TimingScope.cpp:
* wtf/URL.cpp:
* wtf/WTFSemaphore.h:
* wtf/WorkQueue.cpp:
(WTF::WorkQueue::concurrentApply):
* wtf/WorkerPool.cpp:
(WTF::WorkerPool::WorkerPool):
* wtf/WorkerPool.h:
* wtf/cf/LanguageCF.cpp:
* wtf/text/AtomStringImpl.cpp:
(WTF::AtomStringTableLocker::AtomStringTableLocker):
* wtf/text/StringView.cpp:
* wtf/threads/BinarySemaphore.h:
* wtf/unicode/icu/CollatorICU.cpp:
2021-05-23 Chris Dumez <cdumez@apple.com>
Make CheckedLock the default Lock
https://bugs.webkit.org/show_bug.cgi?id=226157
Reviewed by Darin Adler.
Make CheckedLock the default Lock so that we get more benefits from Clang
Thread Safety Analysis. Note that CheckedLock 100% relies on the existing
Lock implementation and merely adds the clang anotations for thread
safety.
That this patch does is:
1. Rename the Lock class to UncheckedLock
2. Rename the CheckedLock class to Lock
3. Rename the Condition class to UncheckedCondition
4. Rename the CheckedCondition class to Condition
5. Update the types of certain variables from Lock / Condition to
UncheckedLock / UncheckedCondition if I got a build failure. Build
failures are usually caused by the following facts:
- Locker<CheckedLock> doesn't subclass AbstractLocker which a lot of
JSC code passes as argument
- Locker<CheckedLock> has no move constructor
- Locker<CheckedLock> cannot be constructed from a lock pointer, only
a reference
For now, CheckedLock and CheckedCondition remain as aliases to Lock and
Condition, in their respective CheckedLock.h / CheckedCondition.h headers.
I will drop them in a follow-up to reduce patch size.
I will also follow-up to try and get rid of as much usage of UncheckedLock
and UncheckedCondition as possible. I did not try very hard in this patch
to reduce patch size.
* wtf/AutomaticThread.cpp:
(WTF::AutomaticThreadCondition::wait):
(WTF::AutomaticThreadCondition::waitFor):
(WTF::AutomaticThread::AutomaticThread):
* wtf/AutomaticThread.h:
* wtf/CheckedCondition.h:
* wtf/CheckedLock.h:
* wtf/Condition.h:
* wtf/Lock.cpp:
(WTF::UncheckedLock::lockSlow):
(WTF::UncheckedLock::unlockSlow):
(WTF::UncheckedLock::unlockFairlySlow):
(WTF::UncheckedLock::safepointSlow):
* wtf/Lock.h:
(WTF::WTF_ASSERTS_ACQUIRED_LOCK):
* wtf/MetaAllocator.cpp:
(WTF::MetaAllocator::release):
(WTF::MetaAllocator::MetaAllocator):
(WTF::MetaAllocator::allocate):
(WTF::MetaAllocator::currentStatistics):
* wtf/MetaAllocator.h:
* wtf/ParallelHelperPool.cpp:
(WTF::ParallelHelperPool::ParallelHelperPool):
* wtf/ParallelHelperPool.h:
* wtf/RecursiveLockAdapter.h:
* wtf/WorkerPool.cpp:
(WTF::WorkerPool::WorkerPool):
* wtf/WorkerPool.h:
2021-05-23 Mark Lam <mark.lam@apple.com>
Remove ENABLE(MASM_PROBE) flag.
https://bugs.webkit.org/show_bug.cgi?id=226154
Reviewed by Yusuke Suzuki.
The MacroAssembler::probe() mechanism is now available on all supported platforms.
There's no longer a need for the ENABLE(MASM_PROBE) flag.
* wtf/PlatformEnable.h:
2021-05-23 Chris Dumez <cdumez@apple.com>
Drop WTF::tryHoldLock() as it is incompatible with Clang Thread Safety Analysis
https://bugs.webkit.org/show_bug.cgi?id=226145
Reviewed by Darin Adler.
Drop WTF::tryHoldLock() as it is incompatible with Clang Thread Safety Analysis.
Instead, use the following pattern which is supported:
```
if (lock.tryLock()) {
Locker locker { AdoptLock, lock };
// ...
}
```
* wtf/CheckedLock.h:
* wtf/Lock.h:
* wtf/Locker.h:
(WTF::Locker::Locker):
2021-05-23 Mark Lam <mark.lam@apple.com>
Build fix for JSCOnly-Linux-AArch64 bot.
Not reviewed.
* wtf/Vector.h:
(WTF::Malloc>::expandCapacity):
(WTF::Malloc>::reserveCapacity):
(WTF::Malloc>::constructAndAppendSlowCase):
2021-05-22 Chris Dumez <cdumez@apple.com>
Adopt CheckedLock in more places
https://bugs.webkit.org/show_bug.cgi?id=226138
Reviewed by Darin Adler.
Adopt CheckedLock in more places to benefit from Clang Thread Safety Analysis.
* wtf/Assertions.cpp:
* wtf/TimingScope.cpp:
* wtf/threads/BinarySemaphore.cpp:
(WTF::BinarySemaphore::waitUntil):
* wtf/threads/BinarySemaphore.h:
2021-05-22 Chris Dumez <cdumez@apple.com>
Replace LockHolder with Locker in local variables
https://bugs.webkit.org/show_bug.cgi?id=226133
Reviewed by Darin Adler.
Replace LockHolder with Locker in local variables. It is shorter and it allows switching the lock
type more easily since the compiler with deduce the lock type T for Locker<T>.
* benchmarks/LockSpeedTest.cpp:
* wtf/AutomaticThread.cpp:
(WTF::AutomaticThread::~AutomaticThread):
(WTF::AutomaticThread::join):
(WTF::AutomaticThread::start):
* wtf/AutomaticThread.h:
* wtf/MetaAllocator.cpp:
(WTF::MetaAllocatorHandle::shrink):
(WTF::MetaAllocator::addFreshFreeSpace):
(WTF::MetaAllocator::debugFreeSpaceSize):
* wtf/ParallelHelperPool.cpp:
(WTF::ParallelHelperClient::ParallelHelperClient):
(WTF::ParallelHelperClient::~ParallelHelperClient):
(WTF::ParallelHelperClient::setTask):
(WTF::ParallelHelperClient::finish):
(WTF::ParallelHelperClient::doSomeHelping):
(WTF::ParallelHelperClient::runTask):
(WTF::ParallelHelperPool::~ParallelHelperPool):
(WTF::ParallelHelperPool::ensureThreads):
(WTF::ParallelHelperPool::doSomeHelping):
* wtf/Seconds.cpp:
(WTF::sleep):
* wtf/TimeWithDynamicClockType.cpp:
(WTF::sleep):
* wtf/WorkerPool.cpp:
(WTF::WorkerPool::WorkerPool):
(WTF::WorkerPool::~WorkerPool):
(WTF::WorkerPool::postTask):
* wtf/posix/ThreadingPOSIX.cpp:
(WTF::Thread::suspend):
(WTF::Thread::resume):
(WTF::Thread::getRegisters):
* wtf/win/DbgHelperWin.cpp:
(WTF::DbgHelper::SymFromAddress):
* wtf/win/ThreadingWin.cpp:
(WTF::Thread::suspend):
(WTF::Thread::resume):
(WTF::Thread::getRegisters):
2021-05-22 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r277913.
https://bugs.webkit.org/show_bug.cgi?id=226140
Caused multiple layout-test crash on mac debug queues
Reverted changeset:
"Replace LockHolder with Locker in local variables"
https://bugs.webkit.org/show_bug.cgi?id=226133
https://trac.webkit.org/changeset/277913
2021-05-21 Chris Dumez <cdumez@apple.com>
Remove WTF::holdLock() / WTF::holdLockIf()
https://bugs.webkit.org/show_bug.cgi?id=226135
Reviewed by Darin Adler.
Remove WTF::holdLock() / WTF::holdLockIf() because they are not compatible with
Clang Thread Safety Analysis. All call sites have been converted to use the Locker
constructor directly.
* wtf/Locker.h:
2021-05-21 Chris Dumez <cdumez@apple.com>
Replace LockHolder with Locker in local variables
https://bugs.webkit.org/show_bug.cgi?id=226133
Reviewed by Darin Adler.
Replace LockHolder with Locker in local variables. It is shorter and it allows switching the lock
type more easily since the compiler with deduce the lock type T for Locker<T>.
* benchmarks/LockSpeedTest.cpp:
* wtf/AutomaticThread.cpp:
(WTF::AutomaticThread::~AutomaticThread):
(WTF::AutomaticThread::join):
(WTF::AutomaticThread::start):
* wtf/AutomaticThread.h:
* wtf/MetaAllocator.cpp:
(WTF::MetaAllocatorHandle::shrink):
(WTF::MetaAllocator::addFreshFreeSpace):
(WTF::MetaAllocator::debugFreeSpaceSize):
* wtf/ParallelHelperPool.cpp:
(WTF::ParallelHelperClient::ParallelHelperClient):
(WTF::ParallelHelperClient::~ParallelHelperClient):
(WTF::ParallelHelperClient::setTask):
(WTF::ParallelHelperClient::finish):
(WTF::ParallelHelperClient::doSomeHelping):
(WTF::ParallelHelperClient::runTask):
(WTF::ParallelHelperPool::~ParallelHelperPool):
(WTF::ParallelHelperPool::ensureThreads):
(WTF::ParallelHelperPool::doSomeHelping):
* wtf/Seconds.cpp:
(WTF::sleep):
* wtf/TimeWithDynamicClockType.cpp:
(WTF::sleep):
* wtf/WorkerPool.cpp:
(WTF::WorkerPool::WorkerPool):
(WTF::WorkerPool::~WorkerPool):
(WTF::WorkerPool::postTask):
* wtf/posix/ThreadingPOSIX.cpp:
(WTF::Thread::suspend):
(WTF::Thread::resume):
(WTF::Thread::getRegisters):
* wtf/win/DbgHelperWin.cpp:
(WTF::DbgHelper::SymFromAddress):
* wtf/win/ThreadingWin.cpp:
(WTF::Thread::suspend):
(WTF::Thread::resume):
(WTF::Thread::getRegisters):
2021-05-21 Chris Dumez <cdumez@apple.com>
Use CheckedCondition in more places
https://bugs.webkit.org/show_bug.cgi?id=226113
Reviewed by Darin Adler.
Use CheckedCondition in more places to benefit from Clang Thread Safety
Analysis.
* wtf/RunLoop.h:
* wtf/SynchronizedFixedQueue.h:
* wtf/WTFSemaphore.h:
* wtf/WorkQueue.cpp:
(WTF::WorkQueue::concurrentApply):
* wtf/generic/RunLoopGeneric.cpp:
(WTF::RunLoop::~RunLoop):
(WTF::RunLoop::populateTasks):
(WTF::RunLoop::runImpl):
(WTF::RunLoop::stop):
(WTF::RunLoop::wakeUpWithLock):
(WTF::RunLoop::wakeUp):
(WTF::RunLoop::schedule):
(WTF::RunLoop::scheduleAndWakeUpWithLock):
(WTF::RunLoop::TimerBase::~TimerBase):
(WTF::RunLoop::TimerBase::start):
(WTF::RunLoop::TimerBase::stop):
(WTF::RunLoop::TimerBase::isActive const):
(WTF::RunLoop::TimerBase::secondsUntilFire const):
* wtf/win/RunLoopWin.cpp:
(WTF::RunLoop::TimerBase::timerFired):
(WTF::RunLoop::TimerBase::start):
(WTF::RunLoop::TimerBase::stop):
(WTF::RunLoop::TimerBase::isActive const):
(WTF::RunLoop::TimerBase::secondsUntilFire const):
2021-05-21 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS] Adopt QLItem in WKImageExtractionPreviewController
https://bugs.webkit.org/show_bug.cgi?id=226114
rdar://76657718
Reviewed by Tim Horton.
Introduce `SOFT_LINK_FRAMEWORK_IN_UMBRELLA_FOR_SOURCE_WITH_EXPORT`, so that we can soft link frameworks that are
embedded inside other umbrella frameworks in PAL.
* wtf/cocoa/SoftLinking.h:
2021-05-21 Chris Dumez <cdumez@apple.com>
Stop using holdLock() in WTF as it is not compatible with Clang thread safety analysis
https://bugs.webkit.org/show_bug.cgi?id=226117
Reviewed by Darin Adler.
Stop using holdLock() in WTF as it is not compatible with Clang thread safety analysis
(WTF::CheckedLock) and use the Locker constructor instead.
This is a step towards getting rid of holdLock() completely.
* benchmarks/ConditionSpeedTest.cpp:
* wtf/ConcurrentPtrHashSet.cpp:
(WTF::ConcurrentPtrHashSet::deleteOldTables):
(WTF::ConcurrentPtrHashSet::clear):
(WTF::ConcurrentPtrHashSet::containsImplSlow const):
(WTF::ConcurrentPtrHashSet::sizeSlow const):
(WTF::ConcurrentPtrHashSet::resizeIfNecessary):
* wtf/CountingLock.h:
* wtf/HashTable.cpp:
(WTF::HashTableStats::recordCollisionAtCount):
(WTF::HashTableStats::dumpStats):
* wtf/HashTable.h:
(WTF::invalidateIterators):
(WTF::addIterator):
(WTF::removeIterator):
* wtf/LockedPrintStream.cpp:
(WTF::LockedPrintStream::vprintf):
(WTF::LockedPrintStream::flush):
* wtf/MetaAllocator.cpp:
(WTF::MetaAllocatorHandle::~MetaAllocatorHandle):
* wtf/MetaAllocator.h:
(WTF::MetaAllocator::allocate):
(WTF::MetaAllocator::currentStatistics):
* wtf/ReadWriteLock.h:
* wtf/StackShotProfiler.h:
(WTF::StackShotProfiler::profile):
(WTF::StackShotProfiler::run):
* wtf/StackStats.cpp:
(WTF::StackStats::CheckPoint::CheckPoint):
(WTF::StackStats::CheckPoint::~CheckPoint):
(WTF::StackStats::probe):
(WTF::StackStats::LayoutCheckPoint::LayoutCheckPoint):
(WTF::StackStats::LayoutCheckPoint::~LayoutCheckPoint):
* wtf/ThreadGroup.cpp:
(WTF::ThreadGroup::~ThreadGroup):
(WTF::ThreadGroup::add):
* wtf/ThreadMessage.cpp:
(WTF::sendMessageScoped):
* wtf/Threading.cpp:
(WTF::Thread::didExit):
(WTF::Thread::addToThreadGroup):
(WTF::Thread::removeFromThreadGroup):
(WTF::Thread::numberOfThreadGroups):
* wtf/TimingScope.cpp:
* wtf/WTFConfig.cpp:
(WTF::Config::permanentlyFreeze):
* wtf/WTFSemaphore.h:
* wtf/posix/ThreadingPOSIX.cpp:
(WTF::Thread::changePriority):
(WTF::Thread::waitForCompletion):
(WTF::Thread::detach):
(WTF::Thread::signal):
(WTF::Thread::establishPlatformSpecificHandle):
* wtf/threads/BinarySemaphore.cpp:
(WTF::BinarySemaphore::signal):
(WTF::BinarySemaphore::waitUntil):
* wtf/threads/Signals.cpp:
(WTF::SignalHandlers::add):
(WTF::registerThreadForMachExceptionHandling):
(WTF::activateSignalHandlersFor):
* wtf/win/LanguageWin.cpp:
(WTF::platformLanguage):
* wtf/win/ThreadingWin.cpp:
(WTF::Thread::changePriority):
(WTF::Thread::waitForCompletion):
(WTF::Thread::detach):
(WTF::Thread::establishPlatformSpecificHandle):
2021-05-21 Chris Dumez <cdumez@apple.com>
[Cocoa] Unable to upload files that are stored in the cloud (without a local copy)
https://bugs.webkit.org/show_bug.cgi?id=226090
<rdar://77775887>
Reviewed by Darin Adler.
Add FileSystem API to allow/disallow the materializing of dataless files stored
in the cloud, at process or thread level.
* wtf/FileSystem.h:
* wtf/cocoa/FileSystemCocoa.mm:
(WTF::FileSystemImpl::toIOPolicyScope):
(WTF::FileSystemImpl::setAllowsMaterializingDatalessFiles):
(WTF::FileSystemImpl::allowsMaterializingDatalessFiles):
2021-05-21 Chris Dumez <cdumez@apple.com>
Replace more static Locks with CheckedLocks in WTF / WebCore
https://bugs.webkit.org/show_bug.cgi?id=226040
Reviewed by Darin Adler.
Replace more static Locks with CheckedLocks so that we can benefit from Clang Thread Safety Analysis.
* wtf/Threading.cpp:
(WTF::Thread::allThreadsLock):
(WTF::Thread::create):
(WTF::Thread::didExit):
* wtf/Threading.h:
* wtf/URL.cpp:
(WTF::WTF_REQUIRES_LOCK):
(WTF::registerDefaultPortForProtocolForTesting):
(WTF::clearDefaultPortForProtocolMapForTesting):
(WTF::defaultPortForProtocol):
* wtf/cf/LanguageCF.cpp:
(WTF::WTF_REQUIRES_LOCK):
(WTF::platformLanguageDidChange):
(WTF::platformUserPreferredLanguages):
* wtf/text/StringView.cpp:
(WTF::StringView::invalidate):
(WTF::StringView::adoptUnderlyingString):
(WTF::StringView::setUnderlyingString):
* wtf/unicode/icu/CollatorICU.cpp:
(WTF::Collator::Collator):
(WTF::Collator::~Collator):
2021-05-21 Chris Dumez <cdumez@apple.com>
Use CheckedLock more in cases where we try-lock
https://bugs.webkit.org/show_bug.cgi?id=226056
Reviewed by Alex Christensen.
Use CheckedLock more in cases where we try-lock to benefit from Clang
Thread Safety Analysis.
* wtf/Logger.cpp:
* wtf/Logger.h:
(WTF::Logger::addObserver):
(WTF::Logger::removeObserver):
(WTF::Logger::log):
(WTF::Logger::logVerbose):
(WTF::Logger::WTF_RETURNS_LOCK):
2021-05-20 Chris Dumez <cdumez@apple.com>
Use CheckedLock more in WTF
https://bugs.webkit.org/show_bug.cgi?id=226045
Reviewed by Darin Adler.
Use CheckedLock more in WTF to benefit from Clang Thread Safety Analysis.
* wtf/CrossThreadQueue.h:
(WTF::CrossThreadQueue<DataType>::append):
(WTF::CrossThreadQueue<DataType>::waitForMessage):
(WTF::CrossThreadQueue<DataType>::tryGetMessage):
(WTF::CrossThreadQueue<DataType>::kill):
(WTF::CrossThreadQueue<DataType>::isKilled const):
(WTF::CrossThreadQueue<DataType>::isEmpty const):
* wtf/CrossThreadTaskHandler.cpp:
(WTF::CrossThreadTaskHandler::postTaskReply):
(WTF::CrossThreadTaskHandler::handleTaskRepliesOnMainThread):
* wtf/CrossThreadTaskHandler.h:
(WTF::CrossThreadTaskHandler::WTF_GUARDED_BY_LOCK):
* wtf/CryptographicallyRandomNumber.cpp:
* wtf/FastMalloc.cpp:
(WTF::MallocCallTracker::recordMalloc):
(WTF::MallocCallTracker::recordRealloc):
(WTF::MallocCallTracker::recordFree):
(WTF::MallocCallTracker::dumpStats):
* wtf/MessageQueue.h:
(WTF::MessageQueue<DataType>::append):
(WTF::MessageQueue<DataType>::appendAndKill):
(WTF::MessageQueue<DataType>::appendAndCheckEmpty):
(WTF::MessageQueue<DataType>::prepend):
(WTF::MessageQueue<DataType>::waitForMessageFilteredWithTimeout):
(WTF::MessageQueue<DataType>::tryGetMessage):
(WTF::MessageQueue<DataType>::takeAllMessages):
(WTF::MessageQueue<DataType>::tryGetMessageIgnoringKilled):
(WTF::MessageQueue<DataType>::removeIf):
(WTF::MessageQueue<DataType>::isEmpty):
(WTF::MessageQueue<DataType>::kill):
(WTF::MessageQueue<DataType>::killed const):
* wtf/OSLogPrintStream.cpp:
(WTF::OSLogPrintStream::vprintf):
* wtf/OSLogPrintStream.h:
* wtf/ParallelJobsGeneric.h:
(WTF::ParallelEnvironment::ThreadPrivate::WTF_GUARDED_BY_LOCK):
* wtf/ParallelVectorIterator.h:
(WTF::ParallelVectorIterator::iterate):
(WTF::ParallelVectorIterator::WTF_GUARDED_BY_LOCK):
* wtf/ReadWriteLock.cpp:
(WTF::ReadWriteLock::readLock):
(WTF::ReadWriteLock::readUnlock):
(WTF::ReadWriteLock::writeLock):
(WTF::ReadWriteLock::writeUnlock):
* wtf/ReadWriteLock.h:
(WTF::ReadWriteLock::WTF_GUARDED_BY_LOCK):
2021-05-20 Chris Dumez <cdumez@apple.com>
Add missing locks in Language.cpp
https://bugs.webkit.org/show_bug.cgi?id=226059
Reviewed by Alex Christensen.
Add missing locks in Language.cpp. This was found via Clang Thread Safety Analysis.
Some of the overrideUserPreferredLanguages() call sites were failing to grab the
lock first.
Also use NeverDestroyed in preferredLanguagesOverride() instead of LazyNeverDestroyed
with std::call_once. All call sites are already grabbing a lock so there is no need
for extra synchronization.
* wtf/Language.cpp:
(WTF::WTF_REQUIRES_LOCK):
(WTF::userPreferredLanguagesOverride):
(WTF::overrideUserPreferredLanguages):
(WTF::userPreferredLanguages):
(WTF::preferredLanguagesOverride): Deleted.
2021-05-19 Alex Christensen <achristensen@webkit.org>
Add support for Navigation Timing Level 2
https://bugs.webkit.org/show_bug.cgi?id=184363
Reviewed by Ryosuke Niwa.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-05-19 Chris Dumez <cdumez@apple.com>
Drop "get" prefix from SQLiteStatement member functions as well as out-parameters
https://bugs.webkit.org/show_bug.cgi?id=225971
Reviewed by Darin Adler.
Add Vector constructor that takes in an array and a size.
* wtf/Vector.h:
(WTF::Vector::Vector):
2021-05-18 Darin Adler <darin@apple.com>
Move CFStringRef and NSString support from StringBuilder into StringConcatenateCF
https://bugs.webkit.org/show_bug.cgi?id=225839
Reviewed by Sam Weinig.
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.
2021-05-19 Sam Weinig <weinig@apple.com>
Update Base64 encoding/decoding to match more modern WebKit conventions
https://bugs.webkit.org/show_bug.cgi?id=225920
Reviewed by Chris Dumez.
Bring base64 encoding/decoding up to more modern WebKit conventions by:
- Replace use of "out parameter + bool" with Optional return values.
- Using enum class for enumerations.
- Replacing SignedOrUnsignedCharVectorAdapter/ConstSignedOrUnsignedCharVectorAdapter
with appropriate function overloads.
Also adds a new StringTypeAdapter for inline base64 encoding data in either makeString()
or StringBuilder. To make this work, a few modifications were need to the base64Encode()
functions to support the fixed size writeTo() function.
First, the length of the encoded data is now computed up front depending on the policy.
This has been extracted into a new calculateBase64EncodedSize() function used by both
the adaptor and by base64Encode when passed a Vector. Previously, when encoding using
some policies, the size was an overestimate and the resulting Vector would be resized
down after encoding.
Second, base64EncodeInternal was made into a template function to allow for two new
base64Encode functions, one of which has a UChar* destination. These are used by the
adaptor to write the encoded data.
One additional small change is that now a optional map type parameter has been added
to all the encoders to allow using either the default map or the URL one as defined
in RFC 4648. This simplifies the implementation of the StringTypeAdapter and makes the
base64URLEncode/base64URLDecode functions into simple convenience functions that use
the right defaults for the generic encode/decode functions.
* wtf/text/Base64.cpp:
(WTF::base64EncodeInternal):
(WTF::base64Encode):
(WTF::base64DecodeInternal):
(WTF::base64Decode):
(WTF::base64URLDecode):
(WTF::base64URLEncode): Deleted.
* wtf/text/Base64.h:
(WTF::base64Decode):
(WTF::base64Encode):
(WTF::base64URLEncode):
(WTF::isBase64OrBase64URLCharacter):
(WTF::calculateBase64EncodedSize):
(WTF::base64Encoded):
(WTF::base64URLEncoded):
(WTF::StringTypeAdapter<Base64Specification>::StringTypeAdapter):
(WTF::StringTypeAdapter<Base64Specification>::length const):
(WTF::StringTypeAdapter<Base64Specification>::is8Bit const):
(WTF::StringTypeAdapter<Base64Specification>::writeTo const):
2021-05-18 Robin Morisset <rmorisset@apple.com>
Make AirAllocateRegistersByGraphColoring use less memory
https://bugs.webkit.org/show_bug.cgi?id=225848
Reviewed by Filip Pizlo.
Two changes: the addition of LikelyDenseUnsignedIntegerSet, and various improvements to Small(Ptr)Set.
The latter include:
- Renaming SmallPtrSet into SmallSet, as it now supports integers as well as pointers.
- Reducing its size by sharing the same storage for m_buffer and for m_smallStorage.
This is safe to do, because all operations branch on isSmall() which depends purely on m_capacity.
- Adding trivial size(), isEmpty() and memoryUse() methods
- Adding a comment at the top of the file explaining when to use, and (more importantly) not to use SmallSet.
LikelyDenseUnsignedIntegerSet is an even more specialized data structure, that can represent sets of unsigned integers very compactly if they are clustered.
Finally I added an outOfLineMemoryUse() method to BitVector, making it more convenient to compare the memory consumption of different data structures in the register allocator.
* WTF.xcodeproj/project.pbxproj:
* wtf/BitVector.h:
* wtf/CMakeLists.txt:
* wtf/LikelyDenseUnsignedIntegerSet.cpp: Copied from Source/WTF/wtf/SmallPtrSet.cpp.
* wtf/LikelyDenseUnsignedIntegerSet.h: Added.
(WTF::LikelyDenseUnsignedIntegerSet::LikelyDenseUnsignedIntegerSet):
(WTF::LikelyDenseUnsignedIntegerSet::~LikelyDenseUnsignedIntegerSet):
(WTF::LikelyDenseUnsignedIntegerSet::contains const):
(WTF::LikelyDenseUnsignedIntegerSet::add):
(WTF::LikelyDenseUnsignedIntegerSet::size const):
(WTF::LikelyDenseUnsignedIntegerSet::iterator::iterator):
(WTF::LikelyDenseUnsignedIntegerSet::iterator::m_shift):
(WTF::LikelyDenseUnsignedIntegerSet::iterator::operator++):
(WTF::LikelyDenseUnsignedIntegerSet::iterator::operator* const):
(WTF::LikelyDenseUnsignedIntegerSet::iterator::operator== const):
(WTF::LikelyDenseUnsignedIntegerSet::iterator::operator!= const):
(WTF::LikelyDenseUnsignedIntegerSet::begin const):
(WTF::LikelyDenseUnsignedIntegerSet::end const):
(WTF::LikelyDenseUnsignedIntegerSet::memoryUse const):
(WTF::LikelyDenseUnsignedIntegerSet::validate const):
(WTF::LikelyDenseUnsignedIntegerSet::isBitVector const):
(WTF::LikelyDenseUnsignedIntegerSet::isValidValue const):
(WTF::LikelyDenseUnsignedIntegerSet::transitionToHashSet):
(WTF::LikelyDenseUnsignedIntegerSet::transitionToBitVector):
* wtf/SmallPtrSet.h: Removed.
* wtf/SmallSet.cpp: Renamed from Source/WTF/wtf/SmallPtrSet.cpp.
* wtf/SmallSet.h: Added.
2021-05-18 Chris Dumez <cdumez@apple.com>
Use WTF::Locker for locking BaseAudioContext's graph lock
https://bugs.webkit.org/show_bug.cgi?id=225935
Reviewed by Sam Weinig.
* wtf/RecursiveLockAdapter.h:
(WTF::RecursiveLockAdapter::isOwner const):
Add isOwner() function that returns true if the current thread is holding the lock.
This is needed for WebAudio purposes.
2021-05-18 Aditya Keerthi <akeerthi@apple.com>
[macOS] Titlebar separator doesn't show when WKWebView is scrolled
https://bugs.webkit.org/show_bug.cgi?id=220633
<rdar://problem/71094055>
Reviewed by Darin Adler.
* wtf/PlatformHave.h: Defined HAVE_NSSCROLLVIEW_SEPARATOR_TRACKING_ADAPTER.
2021-05-18 Yoshiaki Jitsukawa <yoshiaki.jitsukawa@sony.com>
[PlayStation] Fix PlayStation port
https://bugs.webkit.org/show_bug.cgi?id=225913
Reviewed by Don Olmstead.
Fix PlayStation port
* wtf/PlatformPlayStation.cmake: Rename
PLAYSTATION_COPY_SHARED_LIBRARIES to PLAYSTATION_COPY_REQUIREMENTS.
2021-05-17 Saam Barati <sbarati@apple.com>
Enable JS to emit sign posts and trace points under Options::exposeProfilersOnGlobalObject
https://bugs.webkit.org/show_bug.cgi?id=225895
Reviewed by Yusuke Suzuki.
* wtf/SystemTracing.h:
2021-05-17 Wenson Hsieh <wenson_hsieh@apple.com>
[GPU Process] Object identifiers with the deleted value should cause MESSAGE_CHECKs
https://bugs.webkit.org/show_bug.cgi?id=225886
rdar://78114708
Reviewed by Chris Dumez.
See WebCore/ChangeLog for more details. Add a helper method on `ObjectIdentifier` that returns true only if it
is the empty value or deleted value.
* wtf/ObjectIdentifier.h:
(WTF::ObjectIdentifier::isValid const):
2021-05-17 Alex Christensen <achristensen@webkit.org>
Use kAudioObjectPropertyElementMain where available
https://bugs.webkit.org/show_bug.cgi?id=224635
Reviewed by Eric Carlson.
* wtf/PlatformHave.h:
2021-05-16 Chris Dumez <cdumez@apple.com>
Modernize / Optimize SQLiteStatement creation and preparation
https://bugs.webkit.org/show_bug.cgi?id=225791
Reviewed by Sam Weinig.
Allow constructing a UniqueRef<> from a C++ reference. std::unique_ptr<>() can be constructed
using a raw pointer and we can construct a UniqueRef<> from a std::unique_ptr<>() so I see
no reason not to allow that.
The reason I needed this is that I want to prevent call sites from allocating SQLiteStatement
without going through the SQLiteDatabase. As a result, I made the SQLiteStatement constructor
private and marked SQLiteDatabase as a friend class. SQLiteDatabase has to heap-allocate
a SQLiteStatement via new and then construct a UniqueRef<> for it. SQLiteDatabase cannot use
makeUniqueRef() because the SQLiteStatement constructor is private. I also cannot mark
makeUniqueRef() as a friend function of SQLiteStatement or anybody could heap allocate a
SQLiteStatement via makeUniqueRef (not just the SQLiteDatabase).
* wtf/UniqueRef.h:
(WTF::UniqueRef::UniqueRef):
2021-05-15 Ryosuke Niwa <rniwa@webkit.org>
Delete WebSQL code from WebKit2
https://bugs.webkit.org/show_bug.cgi?id=225739
Reviewed by Sihui Liu.
Deleted the experimental feature to disable WebSQL since we've been shipping this,
and made the flag to selectively enable WebSQL in WebKit1 an internal debug setting
since nobody should be enabling this now.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
* Scripts/Preferences/WebPreferencesInternal.yaml:
2021-05-15 Sam Weinig <weinig@apple.com>
Allow conditionally enabling OffscreenCanvas only for non-worker contexts
https://bugs.webkit.org/show_bug.cgi?id=225845
Reviewed by Darin Adler.
* Scripts/Preferences/WebPreferencesInternal.yaml:
Add new OffscreenCanvasInWorkersEnabled preference.
* wtf/PlatformEnable.h:
Add new ENABLE_OFFSCREEN_CANVAS_IN_WORKERS macro.
2021-05-15 Alberto Garcia <berto@igalia.com>
CeilingOnPageSize too low for Loongson CPUs
https://bugs.webkit.org/show_bug.cgi?id=221198
<rdar://problem/74089683>
Reviewed by Michael Catanzaro.
Increase the page size to 16KB in MIPS64.
* wtf/PageBlock.h:
2021-05-14 Chris Dumez <cdumez@apple.com>
Drop FileSystem::fileMetadata() / fileMetadataFollowingSymlinks()
https://bugs.webkit.org/show_bug.cgi?id=225820
Reviewed by Darin Adler.
Drop FileSystem::fileMetadata() / fileMetadataFollowingSymlinks(). Those don't match very closely the
std::filesystem API we use internally and they are not very efficient because we gather several attributes
of a file but the callers are usually only interested in one thing (e.g. file type or file size).
Callers interested in the file size, can call the pre-existing FileSystem::fileSize(). For call sites
wanting to check if it is a hidden file, I introduced a new FileSystem::isHiddenFile() API. For call sites
interested in the file type, I replaced FileSystem::isDirectory() / FileSystem::isDirectoryFollowingSymlinks()
with more generic FileSystem::fileType() / FileSystem::fileTypeFollowingSymlinks().
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/FileMetadata.h: Removed.
* wtf/FileSystem.cpp:
(WTF::FileSystemImpl::isHiddenFile):
(WTF::FileSystemImpl::fileTypePotentiallyFollowingSymLinks):
(WTF::FileSystemImpl::fileType):
(WTF::FileSystemImpl::fileTypeFollowingSymlinks):
* wtf/FileSystem.h:
* wtf/glib/FileSystemGlib.cpp:
* wtf/posix/FileSystemPOSIX.cpp:
* wtf/win/FileSystemWin.cpp:
2021-05-14 Chris Dumez <cdumez@apple.com>
Drop legacy / prefixed WebAudio implementation
https://bugs.webkit.org/show_bug.cgi?id=225832
Reviewed by Darin Adler.
Drop preference for prefixed WebAudio, which was disabled everywhere.
* Scripts/Preferences/WebPreferencesInternal.yaml:
2021-05-14 Chris Dumez <cdumez@apple.com>
Port WTF::FileSystem::realPath() to std::filesystem
https://bugs.webkit.org/show_bug.cgi?id=225828
Reviewed by Darin Adler.
Port WTF::FileSystem::realPath() to std::filesystem (in particular std::filesystem::canonical())
so that we no longer need platform-specific code.
* wtf/FileSystem.cpp:
(WTF::FileSystemImpl::realPath):
* wtf/posix/FileSystemPOSIX.cpp:
* wtf/win/FileSystemWin.cpp:
2021-05-14 Chris Dumez <cdumez@apple.com>
Drop "get" prefix from WTF::FileSystem's getFileModificationTime() / getFileCreationTime()
https://bugs.webkit.org/show_bug.cgi?id=225812
Reviewed by Darin Adler.
We avoid the "get" prefix in WebKit.
* wtf/FileSystem.cpp:
(WTF::FileSystemImpl::fileModificationTime):
* wtf/FileSystem.h:
* wtf/glib/FileSystemGlib.cpp:
(WTF::FileSystemImpl::fileCreationTime):
* wtf/posix/FileSystemPOSIX.cpp:
(WTF::FileSystemImpl::fileCreationTime):
* wtf/win/FileSystemWin.cpp:
(WTF::FileSystemImpl::fileCreationTimeFromFindData):
(WTF::FileSystemImpl::fileModificationTimeFromFindData):
(WTF::FileSystemImpl::fileCreationTime):
2021-05-14 Chris Dumez <cdumez@apple.com>
Rename FileSystem::getVolumeFreeSpace() to FileSystem::volumeFreeSpace()
https://bugs.webkit.org/show_bug.cgi?id=225811
Reviewed by Darin Adler.
Rename FileSystem::getVolumeFreeSpace() to FileSystem::volumeFreeSpace() given that we
avoid the "get" prefix in WebKit. Also modernize the function by returning an
Optional<uint64_t> instead of using an out-parameter.
* wtf/FileSystem.cpp:
(WTF::FileSystemImpl::volumeFreeSpace):
* wtf/FileSystem.h:
2021-05-14 Devin Rousso <drousso@apple.com>
Promote `-[WKWebView _pageExtendedBackgroundColor]` SPI to `-[WKWebView underPageBackgroundColor]` API
https://bugs.webkit.org/show_bug.cgi?id=225615
<rdar://problem/76568094>
Reviewed by Wenson Hsieh.
`underPageBackgroundColor` is a `null_resettable` property that will return (in order of validity)
- the most recent non-null value provided
- the CSS `background-color` of the `<body>` and/or `<html>` (this is the current value of `_pageExtendedBackgroundColor`)
- the underlying platform view's background color
Modifications to this property will not have any effect until control is returned to the runloop.
* Scripts/Preferences/WebPreferencesInternal.yaml:
Remove the experimental settings `UseSampledPageTopColorForScrollAreaBackgroundColor`and
`UseThemeColorForScrollAreaBackgroundColor` now that clients can override the default
overscroll area background color using `-[WKWebView setUnderPageBackgroundColor:]`.
2021-05-14 Chris Dumez <cdumez@apple.com>
Introduce FileSystem::updateFileModificationTime()
https://bugs.webkit.org/show_bug.cgi?id=225810
Reviewed by Darin Adler.
Introduce FileSystem::updateFileModificationTime() to update the modification time of a
file. The implementation is cross-platform and relies on std::filesystem. It allows us
to replace platform-specific code that we had at the WebKit2 layer.
* wtf/FileSystem.cpp:
(WTF::FileSystemImpl::updateFileModificationTime):
* wtf/FileSystem.h:
2021-05-14 Chris Dumez <cdumez@apple.com>
Drop unused FileSystem::homeDirectoryPath()
https://bugs.webkit.org/show_bug.cgi?id=225808
Reviewed by Anders Carlsson.
Only Windows-specific code was calling FileSystem::homeDirectoryPath() but the Windows implementation
for this was always returning the empty string.
* wtf/FileSystem.h:
* wtf/cocoa/FileSystemCocoa.mm:
(WTF::FileSystemImpl::homeDirectoryPath): Deleted.
* wtf/glib/FileSystemGlib.cpp:
(WTF::FileSystemImpl::homeDirectoryPath): Deleted.
* wtf/win/FileSystemWin.cpp:
(WTF::FileSystemImpl::homeDirectoryPath): Deleted.
2021-05-14 Chris Dumez <cdumez@apple.com>
Rename FileSystem::getFileSize() to FileSystem::fileSize()
https://bugs.webkit.org/show_bug.cgi?id=225798
Reviewed by Alex Christensen.
Rename FileSystem::getFileSize() to FileSystem::fileSize() as we usually avoid the "get"
prefix in WebKit. It is also more consistent with the std::filesystem::file_size() the
implementation relies on.
Also have it return an Optional<uint64_t> instead of taking a long long out-parameter, as
this is more modern.
* wtf/FileSystem.cpp:
(WTF::FileSystemImpl::fileSize):
* wtf/FileSystem.h:
* wtf/glib/FileSystemGlib.cpp:
(WTF::FileSystemImpl::fileSize):
* wtf/posix/FileSystemPOSIX.cpp:
(WTF::FileSystemImpl::fileSize):
* wtf/win/FileSystemWin.cpp:
(WTF::FileSystemImpl::getFileSizeFromByHandleFileInformationStructure):
(WTF::FileSystemImpl::fileSize):
(WTF::FileSystemImpl::MappedFileData::mapFileHandle):
2021-05-14 Chris Dumez <cdumez@apple.com>
Rename FileSystem::pathGetFileName() to FileSystem::pathFileName()
https://bugs.webkit.org/show_bug.cgi?id=225806
Reviewed by Alex Christensen.
Rename FileSystem::pathGetFileName() to FileSystem::pathFileName(), as we avoid "get" prefixes in WebKit.
* wtf/FileSystem.cpp:
(WTF::FileSystemImpl::pathFileName):
(WTF::FileSystemImpl::pathGetFileName): Deleted.
* wtf/FileSystem.h:
2021-05-13 Dean Jackson <dino@apple.com>
[WebXR] Allow WebXR to be tested on PLATFORM(COCOA)
https://bugs.webkit.org/show_bug.cgi?id=225578
Reviewed by Sam Weinig.
Compile-time enabled on all Cocoa platforms.
* wtf/PlatformEnableCocoa.h:
2021-05-13 Chris Dumez <cdumez@apple.com>
Rename FileSystem::directoryName() to FileSystem::parentPath()
https://bugs.webkit.org/show_bug.cgi?id=225768
Reviewed by Darin Adler.
Rename FileSystem::directoryName() to FileSystem::parentPath() for clarity and
consistency with std::filesystem::parent_path() which is used internally.
* wtf/FileSystem.cpp:
(WTF::FileSystemImpl::readOrMakeSalt):
(WTF::FileSystemImpl::parentPath):
(WTF::FileSystemImpl::directoryName): Deleted.
* wtf/FileSystem.h:
2021-05-13 Chris Dumez <cdumez@apple.com>
Rename FileSystem::fileIsDirectory(path, followSymlinks) to isDirectory(path) / isDirectoryFollowingSymlinks(path)
https://bugs.webkit.org/show_bug.cgi?id=225772
Reviewed by Darin Adler.
I don't think the "file" prefix is useful here so I am renaming the function to
isDirectory(). Also, instead of using an enum parameter to decide whether or
not to follow symlink, I am adding a separate function called
isDirectoryFollowingSymlinks(). This is consistent with the
fileMetadata() / fileMetadataFollowingSymlinks() pattern, which Darin said he
preferred.
* wtf/FileSystem.cpp:
(WTF::FileSystemImpl::isDirectory):
(WTF::FileSystemImpl::isDirectoryFollowingSymlinks):
(WTF::FileSystemImpl::fileIsDirectory): Deleted.
* wtf/FileSystem.h:
2021-05-13 Chris Dumez <cdumez@apple.com>
Introduce FileSystem::hardLinkCount()
https://bugs.webkit.org/show_bug.cgi?id=225767
Reviewed by Darin Adler.
Introduce FileSystem::hardLinkCount() to replace our platform-specific implementation
in NetworkCacheBlobStorage.
* wtf/FileSystem.cpp:
(WTF::FileSystemImpl::hardLinkCount):
* wtf/FileSystem.h:
2021-05-13 Alicia Boya García <aboya@igalia.com>
[WTF] Add holdLock() overload for WTF::DataMutex
https://bugs.webkit.org/show_bug.cgi?id=225652
Reviewed by Xabier Rodriguez-Calvar.
This patch adds a holdLock() overload for WTF::DataMutex as syntactic
sugar to simplify usage in a similar way to what holdLock() already
does for WTF::Locker.
* wtf/DataMutex.h:
(WTF::holdLock):
2021-05-13 Darin Adler <darin@apple.com>
Remove StringBuilder::appendNumber
https://bugs.webkit.org/show_bug.cgi?id=225732
Reviewed by Sam Weinig.
We originally added StringBuilder::appendNumber to resolve the ambiguity
between UChar and uint16_t, but that problem was solved long ago and it
is safe to use StringBuilder::append, including the variadic form, on all
types of numbers and we'll get the same results we did with appendNumber.
* wtf/JSONValues.cpp:
(WTF::JSONImpl::Value::writeJSON const): Use append instead of appendNumber.
* wtf/text/StringBuilder.cpp:
(WTF::StringBuilder::appendNumber): Deleted.
* wtf/text/StringBuilder.h: Removed appendNumber.
* wtf/text/TextStream.cpp:
(WTF::TextStream::operator<<): Use append instead of appendNumber.
2021-05-12 Mark Lam <mark.lam@apple.com>
Implement some common Baseline JIT slow paths using JIT thunks.
https://bugs.webkit.org/show_bug.cgi?id=225682
Reviewed by Filip Pizlo.
Introduce ENABLE(EXTRA_CTI_THUNKS) flag to guard the use of these new thunks.
Currently, the thunks are 64-bit only, and only supported for ARM64 and non-Windows
X86_64. The reason it is not supported for Windows as well is because Windows
only has 4 argument registers. In this patch, the thunks do not use that many
registers yet, but there will be more thunks coming that will require the use
of up to 6 argument registers.
* wtf/PlatformEnable.h:
2021-05-11 Chris Dumez <cdumez@apple.com>
Port WTF::FileSystem::listDirectory to std::filesystem
https://bugs.webkit.org/show_bug.cgi?id=225633
Reviewed by Darin Adler.
Port WTF::FileSystem::listDirectory to std::filesystem with the following 2 changes:
- The function no longer takes a (blob-style) filter parameter
- The function now returns file names instead of file paths, allowing the call sites
to more easily filter based on prefixes.
* wtf/FileSystem.cpp:
(WTF::FileSystemImpl::listDirectory):
* wtf/FileSystem.h:
* wtf/glib/FileSystemGlib.cpp:
* wtf/posix/FileSystemPOSIX.cpp:
* wtf/win/FileSystemWin.cpp:
2021-05-11 Darin Adler <darin@apple.com>
Remove the String::toInt family of functions
https://bugs.webkit.org/show_bug.cgi?id=225599
Reviewed by Anders Carlsson.
* wtf/text/AtomString.h: Deleted AtomString::toInt.
* wtf/text/StringImpl.cpp:
(WTF::StringImpl::toIntStrict): Deleted.
(WTF::StringImpl::toUIntStrict): Deleted.
(WTF::StringImpl::toInt64Strict): Deleted.
(WTF::StringImpl::toUInt64Strict): Deleted.
(WTF::StringImpl::toIntPtrStrict): Deleted.
(WTF::StringImpl::toInt): Deleted.
(WTF::StringImpl::toUInt): Deleted.
(WTF::StringImpl::toInt64): Deleted.
(WTF::StringImpl::toUInt64): Deleted.
(WTF::StringImpl::toIntPtr): Deleted.
* wtf/text/StringImpl.h: Deleted the above functions.
* wtf/text/StringToIntegerConversion.h: Removed toIntegralType.
* wtf/text/StringView.cpp:
(WTF::parseUInt16): Deleted.
* wtf/text/StringView.h: Deleted StringView::toInt,
StringView::toIntStrict, StringView::toUInt64Strict,
StringView::toInt64Strict, and parseUInt16. Changed the constructor
that takes a const char* to work when passed nullptr. StringView has
a null value, and converting a null const char* should produce that.
* wtf/text/WTFString.cpp:
(WTF::String::toIntStrict const): Deleted.
(WTF::String::toUIntStrict const): Deleted.
(WTF::String::toInt64Strict const): Deleted.
(WTF::String::toUInt64Strict const): Deleted.
(WTF::String::toIntPtrStrict const): Deleted.
(WTF::String::toInt const): Deleted.
(WTF::String::toUInt const): Deleted.
(WTF::String::toInt64 const): Deleted.
(WTF::String::toUInt64 const): Deleted.
(WTF::String::toIntPtr const): Deleted.
(WTF::lengthOfCharactersAsInteger): Deleted.
(WTF::charactersToIntStrict): Deleted.
(WTF::charactersToUIntStrict): Deleted.
(WTF::charactersToInt64Strict): Deleted.
(WTF::charactersToUInt64Strict): Deleted.
(WTF::charactersToIntPtrStrict): Deleted.
(WTF::charactersToInt): Deleted.
(WTF::charactersToUInt): Deleted.
(WTF::charactersToInt64): Deleted.
(WTF::charactersToUInt64): Deleted.
(WTF::charactersToIntPtr): Deleted.
* wtf/text/WTFString.h: Deleted the above functions.
2021-05-11 Devin Rousso <drousso@apple.com>
[macCatalyst] should have CSS `hover: hover` and `pointer: fine`
https://bugs.webkit.org/show_bug.cgi?id=225672
Reviewed by Tim Horton.
* wtf/PlatformHave.h:
Add `HAVE_MOUSE_DEVICE_OBSERVATION` and `HAVE_STYLUS_DEVICE_OBSERVATION` to make callsites
clearer instead of having a somewhat unrelated connection to `HAVE_UIKIT_WITH_MOUSE_SUPPORT`
and `HAVE_PENCILKIT_TEXT_INPUT` (not to mention both of them are `PLATFORM(MACCATALYST)`
which isn't desirable since macCatalyst should consider the mouse as the primary pointing
device, just like macOS).
2021-05-11 Alex Christensen <achristensen@webkit.org>
Remove xpc_connection_kill
https://bugs.webkit.org/show_bug.cgi?id=225602
Reviewed by Alexey Proskuryakov.
* wtf/PlatformHave.h:
2021-05-10 Chris Dumez <cdumez@apple.com>
[ macOS Release wk2 ] http/tests/cache-storage/cache-records-persistency.https.html is flaky crashing
https://bugs.webkit.org/show_bug.cgi?id=225522
<rdar://problem/77680019>
Reviewed by Darin Adler.
Pass ec parameter to std::filesystem::directory_iterator() so that it doesn't throw in case of the
path does not exist. Normally, the function would return early earlier if the path does not exist
or isn't a directory. However, in the context of the test, this function is getting called on a
background thread and another thread is deleting the directory in parallel.
* wtf/FileSystem.cpp:
(WTF::FileSystemImpl::deleteEmptyDirectory):
2021-05-10 Devin Rousso <drousso@apple.com>
`SLEEP_THREAD_FOR_DEBUGGER` should print the PID before sleeping
https://bugs.webkit.org/show_bug.cgi?id=225619
Reviewed by Tim Horton.
* wtf/DebugUtilities.h:
2021-05-10 Rob Buis <rbuis@igalia.com>
Implement <form>.requestSubmit()
https://bugs.webkit.org/show_bug.cgi?id=197958
Reviewed by Darin Adler.
Add requestSubmit as experimental feature, disabled by default.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-05-09 Darin Adler <darin@apple.com>
Remove uses of the String::toInt family of functions from WebCore/html and similar directories
https://bugs.webkit.org/show_bug.cgi?id=225577
Reviewed by Sam Weinig.
* wtf/text/StringBuilder.h: Added conversion operator to make a StringView, built on the exiting
is8Bit, characters8, characters16 and length functions. Removed now-uneeded equal function and
== and != operators since the StringView ones work for those same cases with the same syntax.
2021-05-08 Darin Adler <darin@apple.com>
Rename toIntegralType to parseInteger and prepare to use it to replace all our integer-parsing functions
https://bugs.webkit.org/show_bug.cgi?id=225560
Reviewed by Sam Weinig.
I have a much larger patch that replaces all the many toInt functions with these parseInteger
function templates. The parseInteger ones take StringView, which means we can pass almost any
type of string or character/length pair including a substring without allocating a new string,
return Optional rather than using an out argument to report failure, take the integer type as
a template parameter so can be used for precisely the desired type at each call site, and make
the "allow trailing junk" feature explicit, rather than implicitly including it in the shortest
named functions, which I hope will discourage people from using that junk-ignoring mode
when it's not desirable.
Also includes adoption of parseInteger within WTF itself, outside the string classes.
My plan is to land the rest of adoption of this in chunks so we can review carefully and spot
mistakes as we go. Then return to files like WTFString.h and remove the many old functions
this replaces, including the String::toInt and charactersToInt families of functions.
* wtf/URL.cpp:
(WTF::URL::port const): Use parseInteger<uint16_t>.
(WTF::URL::setHostAndPort): Ditto.
* wtf/text/StringToIntegerConversion.h: Refactored the existing code to tighten things up
a bit, and got rid of overloads that take pointer and length and the the generic "any string
type" feature, since StringView already works well for that. Renamed toIntegralType to
parseInteger, leaving the old name behind to ease the transition while adopting parseInteger.
* wtf/text/WTFString.cpp:
(WTF::toDoubleType): Use the TrailingJunkPolicy enumeration from the
StringToIntegerConversion.h header.
(WTF::charactersToDouble): Ditto.
(WTF::charactersToFloat): Ditto.
2021-05-08 Chris Dumez <cdumez@apple.com>
Port Filesystem::pathByAppendingComponent() & Filesystem:: pathByAppendingComponents() to std::filesystem
https://bugs.webkit.org/show_bug.cgi?id=225550
Reviewed by Darin Adler.
Port Filesystem::pathByAppendingComponent() & Filesystem:: pathByAppendingComponents() to std::filesystem
and get rid of platform-specific implementations.
* wtf/FileSystem.cpp:
(WTF::FileSystemImpl::pathByAppendingComponent):
(WTF::FileSystemImpl::pathByAppendingComponents):
* wtf/glib/FileSystemGlib.cpp:
* wtf/posix/FileSystemPOSIX.cpp:
* wtf/win/FileSystemWin.cpp:
2021-05-08 Diego Pino Garcia <dpino@igalia.com>
[GLIB] REGRESSION(r277158) imported/w3c/web-platform-tests/xhr/FormData-append.html is crashing
https://bugs.webkit.org/show_bug.cgi?id=225551
Reviewed by Chris Dumez.
* wtf/FileSystem.cpp:
(WTF::FileSystemImpl::fileIsDirectory): Remove unnecessary path.isEmpty check.
* wtf/glib/FileSystemGlib.cpp:
(WTF::FileSystemImpl::fileSystemRepresentation): Return empty CString if path is empty.
2021-05-07 Chris Dumez <cdumez@apple.com>
Port FileSystem::pathGetFileName() & Filesystem::directoryName() to std::filesystem
https://bugs.webkit.org/show_bug.cgi?id=225524
Reviewed by Darin Adler.
Port FileSystem::pathGetFileName() & Filesystem::directoryName() to std::filesystem so
that we can get rid of platform-specific implementions.
* wtf/FileSystem.cpp:
(WTF::FileSystemImpl::pathGetFileName):
(WTF::FileSystemImpl::directoryName):
* wtf/glib/FileSystemGlib.cpp:
(WTF::FileSystemImpl::pathGetFileName): Deleted.
(WTF::FileSystemImpl::directoryName): Deleted.
* wtf/posix/FileSystemPOSIX.cpp:
(WTF::FileSystemImpl::pathGetFileName): Deleted.
(WTF::FileSystemImpl::directoryName): Deleted.
* wtf/win/FileSystemWin.cpp:
(WTF::FileSystemImpl::pathGetFileName): Deleted.
(WTF::FileSystemImpl::directoryName): Deleted.
2021-05-07 Tim Horton <timothy_horton@apple.com>
Add an experimental alternative display-list-based RemoteLayerBackingStore implementation
https://bugs.webkit.org/show_bug.cgi?id=225508
Reviewed by Sam Weinig.
* Scripts/Preferences/WebPreferencesInternal.yaml:
2021-05-07 Philippe Normand <pnormand@igalia.com>
[GTK] Warnings about unused filesystem functions
https://bugs.webkit.org/show_bug.cgi?id=225507
Reviewed by Adrian Perez de Castro.
Since r277158 these functions are no longer needed.
* wtf/glib/FileSystemGlib.cpp:
(WTF::FileSystemImpl::getFileStat): Deleted.
(WTF::FileSystemImpl::getFileLStat): Deleted.
2021-05-06 Chris Dumez <cdumez@apple.com>
Port Filesystem::fileMetadata() & Filesystem::getFileModificationTime() to std::filesystem
https://bugs.webkit.org/show_bug.cgi?id=225362
Reviewed by Darin Adler.
Port Filesystem::fileMetadata() & Filesystem::getFileModificationTime() to std::filesystem
and get rid of platform-specific implementations.
* wtf/FileSystem.cpp:
(WTF::FileSystemImpl::toWallTime):
(WTF::FileSystemImpl::getFileModificationTime):
(WTF::FileSystemImpl::fileMetadata):
* wtf/FileSystem.h:
* wtf/glib/FileSystemGlib.cpp:
* wtf/posix/FileSystemPOSIX.cpp:
* wtf/win/FileSystemWin.cpp:
2021-05-06 Yoshiaki Jitsukawa <yoshiaki.jitsukawa@sony.com>
[OpenSSL] Implement CryptoAlgorithmRSA*
https://bugs.webkit.org/show_bug.cgi?id=225294
Reviewed by Don Olmstead.
Implement RSA for OpenSSL.
Implement CryptoAlgorithmRSA_OAEP, CryptoAlgorithmRSA_PSS,
CryptoAlgorithmRSAES_PKCS1_v1_5, CryptoAlgorithmRSASA_PKCS1_v1_5,
and CryptoKeyRSA for OpenSSL.
Note that if such OpenSSL version that does not support RSA_OAEP or
RSA_PSS, the WebCrypto API for those algorithm will return a
NotSupportedError.
* wtf/Platform.h: Set HAVE_RSA_PSS for USE(OPENSSL)
2021-05-06 Chris Dumez <cdumez@apple.com>
Regression(r254389?) navigator.languages returns all lowercase languages for ports using CF
https://bugs.webkit.org/show_bug.cgi?id=225461
Reviewed by Darin Adler.
Stop lowercasing the languages returned by navigator.language / navigator.languages
as this does not match the specification [1][2] or other Web browsers. The proper format is
'en-US', not 'en-us'.
[1] https://html.spec.whatwg.org/#dom-navigator-language
[2] https://tools.ietf.org/html/bcp47
* wtf/cf/LanguageCF.cpp:
(WTF::httpStyleLanguageCode):
2021-05-06 Filip Pizlo <fpizlo@apple.com>
Remove old and unused memory barrier abstractions
https://bugs.webkit.org/show_bug.cgi?id=225487
Reviewed by Mark Lam.
We don't use memoryBarrierBlahBlah anymore.
* wtf/Atomics.h:
(WTF::memoryBarrierAfterLock): Deleted.
(WTF::memoryBarrierBeforeUnlock): Deleted.
2021-05-06 Filip Pizlo <fpizlo@apple.com>
Reduce use of dmb ish on ARM64
https://bugs.webkit.org/show_bug.cgi?id=225465
Reviewed by Keith Miller.
* wtf/Atomics.h:
(WTF::dependentLoadLoadFence):
2021-05-06 Per Arne Vollan <pvollan@apple.com>
Add sandbox extension flag to specify that path contains no symlinks
https://bugs.webkit.org/show_bug.cgi?id=219428
<rdar://problem/66551986>
Reviewed by Brent Fulgham.
Declare canonical sandbox flag.
* wtf/spi/darwin/SandboxSPI.h:
2021-05-06 Dean Jackson <dino@apple.com>
[WebXR] Add IOSurface to FrameData::LayerData
https://bugs.webkit.org/show_bug.cgi?id=225428
<rdar://problem/77586270>
Reviewed by Tim Horton.
Add USE(IOSURFACE_FOR_XR_LAYER_DATA) and make it true
for Cocoa platforms.
* wtf/PlatformUse.h:
2021-05-06 Darin Adler <darin@apple.com>
Streamline codec parsing, replacing uses of HashMap with SortedArrayMap
https://bugs.webkit.org/show_bug.cgi?id=225368
Reviewed by Sam Weinig.
* wtf/SortedArrayMap.h: Moved PackedASCIILowerCodes here for reuse.
Slightly tweaked ComparableASCIISubsetLiteral to match better.
2021-05-05 Devin Rousso <drousso@apple.com>
Sampled Page Top Color: take additional snapshots further down the page to see if the sampled top color is more than just a tiny strip
https://bugs.webkit.org/show_bug.cgi?id=225323
Reviewed by Beth Dakin.
Add a `SampledPageTopColorMinHeight` setting that controls how far down the sampled page top
color needs to extend in order for us to not bail. If the value > 0, we take an additional
snapshot at (0, SampledPageTopColorMinHeight) and (width, SampledPageTopColorMinHeight),
comparing each to the snapshot directly above (e.g. (0, SampledPageTopColorMinHeight) is
compared to (0, 0)) using the `SampledPageTopColorMaxDifference`. Depending on the value, if
the color across the top of the page is only a small strip, these extra snapshot comparisons
will prevent a resulting color from being derived.
* Scripts/Preferences/WebPreferences.yaml:
2021-05-05 Sam Weinig <weinig@apple.com>
Add preliminary support for specifying a color space for 2D canvas
https://bugs.webkit.org/show_bug.cgi?id=225286
Reviewed by Dean Jackson.
Add new experimental feature, CanvasColorSpaceEnabled, which blocks
access to the new ability to specify color spaces for 2D canvas.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-05-04 Alex Christensen <achristensen@webkit.org>
Don't iterate NetworkProcessProxy::m_websiteDataStores
https://bugs.webkit.org/show_bug.cgi?id=225337
<rdar://77233103>
Reviewed by Geoffrey Garen.
* wtf/Vector.h:
(WTF::copyToVectorOf):
Use a universal reference instead of const&.
* wtf/WeakHashSet.h:
WeakHashSet iteration returns T&, and we need this instead of WeakPtr<T> to be able to return a Ref from a map function.
2021-05-04 Chris Dumez <cdumez@apple.com>
Drop std::filesystem logic in PlatformJSCOnly.cmake
https://bugs.webkit.org/show_bug.cgi?id=225355
Reviewed by Alex Christensen.
Drop std::filesystem logic in PlatformJSCOnly.cmake as it is no longer needed after r276946.
* wtf/PlatformJSCOnly.cmake:
2021-05-03 Kimmo Kinnunen <kkinnunen@apple.com>
[GPUP] Move GPUProcess WebGL to Experimental Feature
https://bugs.webkit.org/show_bug.cgi?id=222836
rdar://75048190
Reviewed by Brent Fulgham.
Move the setting for WebGL in GPU process
to experimental features but disable it by default,
even on layout tests.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
* Scripts/Preferences/WebPreferencesInternal.yaml:
2021-05-03 Lauro Moura <lmoura@igalia.com>
REGRESSION(r276879) Add libstdc++fs to wtf libraries when using experimental fs headers
https://bugs.webkit.org/show_bug.cgi?id=225341
Reviewed by Chris Dumez.
After r276879, Filesystem.cpp uses std::filesystem directly. So,
expose the need for stdc++fs like was done in r268708 when std::fs was
used in WTR.
* wtf/CMakeLists.txt:
2021-05-03 Chris Dumez <cdumez@apple.com>
Restore pre-r276879 behavior for FileSystem::moveFile()
https://bugs.webkit.org/show_bug.cgi?id=225307
Reviewed by Sam Weinig.
Update FileSystem::moveFile() so that it now supports again moving a file across different
volumes by copying the file over and then deleting the source file.
I have verified locally that the function is now able to move a file to a different volumes.
Sadly, I don't think having an API test is feasible here as it requires pre-determined
volumes to be available.
* wtf/FileSystem.cpp:
(WTF::FileSystemImpl::moveFile):
2021-05-03 Chris Dumez <cdumez@apple.com>
Unreviewed attempt to fix JSCOnly build with recent clang after r276879
https://bugs.webkit.org/show_bug.cgi?id=225327
* wtf/PlatformJSCOnly.cmake:
2021-05-03 Diego Pino Garcia <dpino@igalia.com>
[GLIB] REGRESSION(r276879): Several tests are crashing or failing
https://bugs.webkit.org/show_bug.cgi?id=225292
Reviewed by Carlos Alberto Lopez Perez.
* wtf/FileSystem.cpp:
(WTF::FileSystemImpl::fileIsDirectory): Return false if path is empty.
2021-05-03 Chris Dumez <cdumez@apple.com>
Restore pre-r276879 behavior for FileSystem::deleteFile() and FileSystem::deleteEmptyDirectory()
https://bugs.webkit.org/show_bug.cgi?id=225289
Reviewed by Darin Adler.
Restore pre-r276879 behavior for FileSystem::deleteFile() and FileSystem::deleteEmptyDirectory() to
reduce the risk of regressions. In particular, calling FileSystem::deleteFile() on an empty directory
now fails and calling FileSystem::deleteEmptyDirectory() on a non-directory now fails.
I have also gotten rid of the macOS-specific implementation of deleteEmptyDirectory() and merged the
needed behavior (Dealing with .DS_Store files) to the generic function.
* wtf/FileSystem.cpp:
(WTF::FileSystemImpl::deleteFile):
(WTF::FileSystemImpl::deleteEmptyDirectory):
* wtf/mac/FileSystemMac.mm:
(WTF::FileSystem::deleteEmptyDirectory): Deleted.
2021-05-02 Sam Weinig <weinig@apple.com>
Add support for DestinationColorSpace::DisplayP3 in preparation for DisplayP3 canvas
https://bugs.webkit.org/show_bug.cgi?id=225280
Reviewed by Anders Carlsson.
Add new ENABLE_DESTINATION_COLOR_SPACE_DISPLAY_P3 macro to declare which ports
support P3 backing stores. Currently, only the Apple/Cocoa ports support it.
* wtf/PlatformEnable.h:
* wtf/PlatformEnableCocoa.h:
2021-04-30 Darin Adler <darin@apple.com>
Use SortedArrayMap in a few more places
https://bugs.webkit.org/show_bug.cgi?id=225251
Reviewed by Sam Weinig.
* wtf/SortedArrayMap.h: Added support for types that don't have a parse member function.
* wtf/cocoa/MainThreadCocoa.mm: Removed unneeded includes.
* wtf/text/AtomStringImpl.cpp: Ditto.
* wtf/text/AtomStringTable.cpp: Ditto.
2021-05-01 Chris Dumez <cdumez@apple.com>
Start leveraging std::filesystem in WTF::FileSystem
https://bugs.webkit.org/show_bug.cgi?id=225255
Reviewed by Sam Weinig.
Start leveraging std::filesystem in WTF::FileSystem to reduce the amount of
platform-specific code.
* WTF.xcodeproj/project.pbxproj:
* wtf/FileSystem.cpp:
(WTF::FileSystemImpl::fileExists):
(WTF::FileSystemImpl::deleteFile):
(WTF::FileSystemImpl::deleteEmptyDirectory):
(WTF::FileSystemImpl::moveFile):
(WTF::FileSystemImpl::getFileSize):
(WTF::FileSystemImpl::fileIsDirectory):
(WTF::FileSystemImpl::makeAllDirectories):
(WTF::FileSystemImpl::getVolumeFreeSpace):
(WTF::FileSystemImpl::createSymbolicLink):
(WTF::FileSystemImpl::hardLink):
(WTF::FileSystemImpl::hardLinkOrCopyFile):
(WTF::FileSystemImpl::deleteNonEmptyDirectory):
* wtf/FileSystem.h:
* wtf/cocoa/FileSystemCocoa.mm:
(WTF::FileSystemImpl::createTemporaryDirectory):
* wtf/glib/FileSystemGlib.cpp:
* wtf/posix/FileSystemPOSIX.cpp:
* wtf/win/FileSystemWin.cpp:
* wtf/PlatformJSCOnly.cmake:
GNU implementation prior to 9.1 requires linking with -lstdc++fs and LLVM implementation
prior to LLVM 9.0 requires linking with -lc++fs.
* wtf/StdFilesystem.cpp: Removed.
* wtf/StdFilesystem.h:
Drop our own copy of std::filesystem as all the operating system we support now have
support for this.
2021-05-01 Sam Weinig <weinig@apple.com>
Make destination color space enumeration match supported destination color spaces for the port
https://bugs.webkit.org/show_bug.cgi?id=225237
Reviewed by Simon Fraser.
Add ENABLE_DESTINATION_COLOR_SPACE_LINEAR_SRGB and enabled it for all ports
except the Apple Windows port, which is the only one doesn't have any support
for it.
* wtf/PlatformEnable.h:
* wtf/PlatformEnableCocoa.h:
* wtf/PlatformEnableWinApple.h:
2021-04-30 Darin Adler <darin@apple.com>
Optimize SortedArrayMap by using linear search for small arrays
https://bugs.webkit.org/show_bug.cgi?id=225223
Reviewed by Yusuke Suzuki.
* wtf/SortedArrayMap.h: Added a base class SortedArrayBase that contains a constant
for the cutoff between linear and binary search. Based on a quick empirical test,
it seems faster to do linear search for arrays that have less then 20 elements.
While doing this also switched from tryBinarySearch to std::find/find_if/lower_bound
because the standard library function templates should be excellent for this purpose,
and there's no reason to use our own. Also filled out the operations for the
ComparableASCIILiteral family so that the "<" operator works in either direction,
since that's needed for compatibility with standard library algorithms.
2021-04-29 Ben Nham <nham@apple.com>
Reduce memory footprint for background tabs
https://bugs.webkit.org/show_bug.cgi?id=225007
Reviewed by Chris Dumez.
Add an option to slim background tabs by proactively calling WebCore::releaseMemory on Macs.
* wtf/PlatformEnableCocoa.h:
2021-04-29 Darin Adler <darin@apple.com>
Extend SortedArrayMap further to work on case-folded strings, use in MIMETypeRegistry
https://bugs.webkit.org/show_bug.cgi?id=224968
Reviewed by Sam Weinig.
* wtf/ASCIICType.h: Make most functions constexpr.
* wtf/Forward.h: Added FixedVector.
* wtf/SortedArrayMap.h: Added SortedArraySet. Added ComparableCaseFoldingASCIILiteral
and ComparableLettersLiteral, using a template shared with ComparableASCIILiteral.
* wtf/StdLibExtras.h: Added isSortedConstExpr and allOfConstExpr.
2021-04-29 Ben Nham <nham@apple.com>
Unreviewed, reverting r276619.
Causes multiple regressions on perf bots.
Reverted changeset:
"Reduce memory footprint for background tabs"
https://bugs.webkit.org/show_bug.cgi?id=225007
https://commits.webkit.org/r276619
2021-04-28 Devin Rousso <drousso@apple.com>
experiment with averaging sampling colors across the top of the page as the scroll area background
https://bugs.webkit.org/show_bug.cgi?id=224987
<rdar://problem/76251889>
Reviewed by Darin Adler.
* Scripts/Preferences/WebPreferences.yaml:
Add a `SampledPageTopColorMaxDifference` setting that controls both whether or not to sample
colors from the top of the page (only if value > 0) and the max Lab color difference allowed
across all samples.
* Scripts/Preferences/WebPreferencesInternal.yaml:
Add a `UseSampledPageTopColorForScrollAreaBackgroundColor` internal setting that controls
whether the sampled page top color can be used as the overscroll area background color.
2021-04-28 Kate Cheney <katherine_cheney@apple.com>
Disable App Bound Requests on macOS
https://bugs.webkit.org/show_bug.cgi?id=225155
<rdar://problem/77288787>
App-bound requests is causing potential performance issues on macOS.
We should disable it while we investigate further.
Reviewed by Brent Fulgham.
* wtf/PlatformEnableCocoa.h:
2021-04-28 Basuke Suzuki <basuke.suzuki@sony.com>
Suppress warnings for %{private}s format specifier
https://bugs.webkit.org/show_bug.cgi?id=225137
Reviewed by Alex Christensen.
Add PRIVATE_LOG_STRING macro which is defined depending on if
os_log() is used or rather old printf().
See also: https://bugs.webkit.org/show_bug.cgi?id=207478
* wtf/Assertions.h:
2021-04-28 Alex Christensen <achristensen@webkit.org>
Remove support for NPAPI plugins in WebView
https://bugs.webkit.org/show_bug.cgi?id=224449
Reviewed by Geoffrey Garen.
* Scripts/Preferences/WebPreferencesInternal.yaml:
2021-04-28 Chris Dumez <cdumez@apple.com>
Drop ModernUnprefixedWebAudio & AudioWorklet experimental feature flags
https://bugs.webkit.org/show_bug.cgi?id=225130
Reviewed by Eric Carlson.
Drop ModernUnprefixedWebAudio & AudioWorklet experimental feature flags now that
these features have shipped. It also doesn't make sense to disable them given
that the prefixed WebAudio API is no longer exposed and there is no feature flag
to turn the legacy prefixed API back on.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-04-28 Kimmo Kinnunen <kkinnunen@apple.com>
Asserting that function or variable is accessed in a certain thread should be simpler and more robust
https://bugs.webkit.org/show_bug.cgi?id=224971
Reviewed by Darin Adler.
Adds support for more fine-grained thread assertion than
ASSERT(isMainThread()) / ASSERT(!isMainThread())
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/Compiler.h:
Add NO_UNIQUE_ADDRESS which can be used to declare members that are empty in
RELEASE builds. The declaration avoids increasing the size of the enclosing type.
This should be used with ThreadAssertion:
class MyThreadAware {
....
NO_UNIQUE_ADDRESS ThreadAssertion m_ownerThread;
};
* wtf/ThreadAssertions.h: Added.
Add ThreadAssertion class that can be held as a member of a type.
This allows consistent assertions that the code in the type
runs in the expected thread.
Add NamedAssertion& WTF::mainThread.
Add NamedAssertion& WTF::mainRunLoop.
These are only to be used in thread safety analysis phase. These are undefined
symbols, it is an error to reference them.
Adds functions assertIsMainThread() and assertIsMainRunLoop() to replace
patterns of ASSERT(isMainThread()), ASSERT(isMainRunLoop().
In addition to behaving as the direct ASSERT behaves, the functions
enable compile-time thread safety analysis to know that the calling
scope has the assertions. These can be optionally then used in the
function and member signatures to require the assertions.
2021-04-28 Daniel Kolesa <dkolesa@igalia.com>
[WPE][GTK] More correct fixes for stack size issues on musl libc
https://bugs.webkit.org/show_bug.cgi?id=225099
Reviewed by Adrian Perez de Castro.
Partial revert https://bugs.webkit.org/show_bug.cgi?id=210068
While the changes in r236306 stopped JSC from crashing outright,
they are not correct, since they also make it rather unstable.
To counter this, increase stack size for threads on Linux with
non-glibc/bionic libcs to 1 megabyte, which is a robust enough
value that should always be sufficient.
While at it, the previous approach to musl thread stack size was
breaking use of DEFAULT_THREAD_STACK_SIZE_IN_KB (if defined) as
well as not properly taking care of the unused parameter. Move
the code to a more appropriate place, which solves these problems.
All this is however not enough, since there is still the main thread;
using pthread_attr_getstack on a main thread is not reliable since main
thread stacks are allowed to grow, and we expect the bounds to always
be constant. On glibc, this already behaved right, but e.g. on musl
(and possibly other C libraries) this is not necessarily the case - at
the point of the check, it was returning 128k (since that's the initial
size reserved by the kernel). Therefore, do the same thing as on Darwin
and use process resource limits to get the boundary on Linux as well.
This results in JavaScriptCore behaving correctly on musl libc and
allows us to drop the options special-casing that was in place.
* wtf/StackBounds.cpp:
(WTF::StackBounds::currentThreadStackBoundsInternal):
* wtf/Threading.cpp:
(WTF::stackSize):
2021-04-27 Kimmo Kinnunen <kkinnunen@apple.com>
Add a Condition type that supports thread safety analysis
https://bugs.webkit.org/show_bug.cgi?id=224970
Reviewed by Darin Adler.
Add CheckedCondition, a condition variable to be used with CheckedLock.
Use thread safety analysis annotations for CheckedCondition.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/CheckedCondition.h: Added.
* wtf/CheckedLock.h:
2021-04-27 Ben Nham <nham@apple.com>
Memory pressure events should be logged to com.apple.WebKit subsystem
https://bugs.webkit.org/show_bug.cgi?id=225112
Reviewed by Chris Dumez.
Currently memory pressure events are logged to the default os_log subsystem instead of the
com.apple.WebKit subsystem. This makes it hard to capture such events using common logging
prefs (e.g. a pref that persists all logs from the WebKit subsystem).
To fix this, call WTFInitializeLogChannelStatesFromString at init time. This associates the
WTFLogChannel with an os_log object that sends the messages to the WebKit subsystem.
* wtf/MemoryPressureHandler.cpp:
(WTF::MemoryPressureHandler::singleton):
* wtf/cocoa/MemoryPressureHandlerCocoa.mm:
(WTF::MemoryPressureHandler::install):
2021-04-27 Alex Christensen <achristensen@webkit.org>
Unreviewed, reverting r275912.
rdar://77179042
Broke internal client
Reverted changeset:
"Remove support for NPAPI plugins in WebView"
https://bugs.webkit.org/show_bug.cgi?id=224449
https://commits.webkit.org/r275912
2021-04-26 Ben Nham <nham@apple.com>
Reduce memory footprint for background tabs
https://bugs.webkit.org/show_bug.cgi?id=225007
Reviewed by Chris Dumez.
When a WebContent process contains only non-visible pages (e.g. if it is a background tab),
we should attempt to reduce our memory footprint after some time interval to help relieve
system-wide memory pressure. This is enabled only on Mac because iOS already does something
similar just before WebContent suspends.
* wtf/PlatformEnableCocoa.h:
2021-04-26 Keith Miller <keith_miller@apple.com>
CodeBlock should do a better job accounting for extra memory it allocates.
https://bugs.webkit.org/show_bug.cgi?id=225068
Reviewed by Mark Lam.
Small convenience function to help compute the memory used by a Bag for JS GC
accounting.
* wtf/Bag.h:
2021-04-26 Angelos Oikonomopoulos <angelos@igalia.com>
Bump CeilingOnPageSize to 16KB on MIPS
https://bugs.webkit.org/show_bug.cgi?id=225030
Reviewed by Michael Catanzaro.
* wtf/PageBlock.h:
2021-04-25 Darin Adler <darin@apple.com>
Fix handling of overflow of /= and *= operators with double over Checked<uint64_t> and other 64-bit types.
https://bugs.webkit.org/show_bug.cgi?id=224835
Reviewed by Chris Dumez.
* wtf/CheckedArithmetic.h: Since it is quite difficult to write correct implementations of the
operations where we multiply or divide a checked integer by a floating point number, deleted
those functions, which were barely used. Also corrected return types of various member functions,
which were unconventional "const Type", replacing them with the conventional "Type" for functions
that return a distinct value, "Type&" for assignment operators, and bool for relational operators.
2021-04-25 Devin Rousso <drousso@apple.com>
Add `ALWAYS_LOG_WITH_STREAM` macro for easier development/debugging
https://bugs.webkit.org/show_bug.cgi?id=224959
Reviewed by Darin Adler.
It's often very helpful to use existing `operator<<` defined on objects, but annoying to
have to copypaste the boilerplate code that creates a `WTF::TextStream` and uses it in a
`WTFLogAlways` or wait for a debug build to enable existing `LOG_WITH_STREAM`.
* wtf/Assertions.h:
(LOG_WITH_STREAM): Moved from `Source/WebCore/pal/LogMacros.h`.
(ALWAYS_LOG_WITH_STREAM): Added.
Add `ALWAYS_LOG_WITH_STREAM` so that one change existing `LOG` when debugging with minimal
friction. As an example, many times I've wished I could've just changed
```
LOG_WITH_STREAM(Channel, stream << node);
```
to something like
```
ALWAYS_LOG_WITH_STREAM(stream << node);
```
and avoid having to modify the surrounding code too much.
2021-04-23 Darin Adler <darin@apple.com>
Remove decoder memory allocations based on untrusted data (sizes) in the stream; related changes
https://bugs.webkit.org/show_bug.cgi?id=224984
Reviewed by Sam Weinig.
* wtf/persistence/PersistentDecoder.cpp:
(WTF::Persistence::Decoder::bufferPointerForDirectRead): Added.
(WTF::Persistence::Decoder::decodeFixedLengthData): Refactor to use bufferPointerForDirectRead.
* wtf/persistence/PersistentDecoder.h: Added bufferPointerForDirectRead function for use in the
rare cases where we want to read directly out of the decoder buffer, rather than writing to a
passed-in pointer. Also did a small refactoring of bufferIsLargeEnoughToContain to use &&
rather than an if statement.
2021-04-23 Chris Dumez <cdumez@apple.com>
Disable GPUProcess on shipping iOS
https://bugs.webkit.org/show_bug.cgi?id=224897
Reviewed by Eric Carlson.
* wtf/PlatformEnableCocoa.h:
2021-04-22 Lauro Moura <lmoura@igalia.com>
[WTF] Undefined behavior warning in StringBuilder::allocateBuffer
https://bugs.webkit.org/show_bug.cgi?id=224942
Reviewed by Chris Dumez.
* wtf/text/StringBuilder.cpp:
(WTF::StringBuilder::allocateBuffer): Add check before calling memcpy
2021-04-22 Simon Fraser <simon.fraser@apple.com>
Add trace points for WKWebView snapshotting
https://bugs.webkit.org/show_bug.cgi?id=224943
Reviewed by Tim Horton.
New snapshot values.
* wtf/SystemTracing.h:
2021-04-22 Martin Robinson <mrobinson@webkit.org>
[GTK] Turn on editable <input type=date> and <input type=time> fields
https://bugs.webkit.org/show_bug.cgi?id=224921
Reviewed by Carlos Garcia Campos.
Turn on editable date and time inputs for GTK.
* Scripts/Preferences/WebPreferencesInternal.yaml: Set editable date/time inputs
on by default for GTK as well.
2021-04-22 Aditya Keerthi <akeerthi@apple.com>
Fix the tvOS build after r276325
https://bugs.webkit.org/show_bug.cgi?id=224929
<rdar://problem/77003408>
Reviewed by Wenson Hsieh.
Fix the tvOS build after r276325
* wtf/PlatformHave.h:
2021-04-21 Aditya Keerthi <akeerthi@apple.com>
[iOS] Fix internal builds after r276325
https://bugs.webkit.org/show_bug.cgi?id=224896
Reviewed by Tim Horton.
* wtf/PlatformHave.h:
2021-04-21 Martin Robinson <mrobinson@igalia.com>
Enable CSS Scroll Snap by default
https://bugs.webkit.org/show_bug.cgi?id=224867
Reviewed by Don Olmstead.
* wtf/PlatformEnable.h: Move the preprocessor enabling of scroll snap here.
* wtf/PlatformEnableCocoa.h: Move it from here.
2021-04-21 Simon Fraser <simon.fraser@apple.com>
Enhance scrolling-related trace points
https://bugs.webkit.org/show_bug.cgi?id=224852
Reviewed by Tim Horton.
One new trace point, and some argument descriptors.
* wtf/SystemTracing.h:
2021-04-20 Brent Fulgham <bfulgham@apple.com>
[Cocoa] Prevent GPU and WebContent processes from attempting to connect to the AppSSO service
https://bugs.webkit.org/show_bug.cgi?id=224834
<rdar://problem/72157514>
Reviewed by Jiewen Tan.
* wtf/PlatformHave.h:
2021-04-20 Eric Carlson <eric.carlson@apple.com>
[Cocoa] Enable MediaSession and MediaSessionCoordinator experimental features
https://bugs.webkit.org/show_bug.cgi?id=224822
<rdar://problem/76908014>
Reviewed by Jer Noble.
* Scripts/Preferences/WebPreferencesExperimental.yaml: Change the defaults for
MediaSessionCoordinatorEnabled and MediaSessionEnabled to true.
2021-04-20 Michael Catanzaro <mcatanzaro@gnome.org>
Lots of spurious -Wnonnull warnings with GCC 11
https://bugs.webkit.org/show_bug.cgi?id=224452
Reviewed by Darin Adler.
* wtf/RefPtr.h:
(WTF::DefaultRefDerefTraits::derefIfNotNull):
2021-04-20 Keith Miller <keith_miller@apple.com>
FullGCActivityCallback should use the percentage of pages uncompressed in RAM to determine deferral.
https://bugs.webkit.org/show_bug.cgi?id=224817
Reviewed by Filip Pizlo.
Add a noexcept flavor of FunctionTraits. On Linux mincore (and probably other syscalls) are marked noexcept so the existing overloads don't work.
* wtf/FunctionTraits.h:
2021-04-20 Chris Dumez <cdumez@apple.com>
Make sure we don't exit the GPUProcess too frequently while under memory pressure
https://bugs.webkit.org/show_bug.cgi?id=224798
Reviewed by Darin Adler.
Add member function to the MemoryPressureHandler to indicate if we're currently simulating memory
pressure or not.
* wtf/MemoryPressureHandler.h:
(WTF::MemoryPressureHandler::isSimulatingMemoryPressure const):
2021-04-19 Darin Adler <darin@apple.com>
Refactor sorted array mapping machinery in LocaleToScriptMapping.cpp for reuse elsewhere
https://bugs.webkit.org/show_bug.cgi?id=224733
Reviewed by Yusuke Suzuki.
* WTF.xcodeproj/project.pbxproj: Added SortedArrayMap.h.
* wtf/CMakeLists.txt: Ditto.
* wtf/SortedArrayMap.h: Added. Builds on the idiom in LocalToScriptMapping, and to be
generic uses std::pair instead of custom structures. Includes the ComparableASCIILiteral
structure for maps that are keyed by case-sensitive ASCII strings.
* wtf/StdLibExtras.h:
(WTF::binarySearchImpl): Use auto in one place to make this a bit more generic.
2021-04-19 Kimmo Kinnunen <kkinnunen@apple.com>
Enable -Wthread-safety, add attributes to custom lock classes, and provide macros to declare guards
https://bugs.webkit.org/show_bug.cgi?id=221614
<rdar://problem/74396781>
Reviewed by David Kilzer.
Implement rudimentary support for clang thread safety analysis.
The added macros can be used to declare which member variables or
global variables are locked by which mutexes. The compiler will
check statically that the mutexes are held correctly. The checking
is intra procedural, not global.
* Configurations/Base.xcconfig:
Add -Wthread-safety to compile flags.
* wtf/CheckedLock.h: Added.
Add CheckedLock, a Lock variant that is amenable to static
analysis.
Add a Locker specialization for CheckedLock that is amenable to
static analysis.
Locker<CheckedLock> is a std::scoped_lock. The scoped_lock cannot be aliased,
since it appears that (Apple's) libcxx is not compiled with thread safety
analysis support enabled by default.
New types are needed due Locker move constructor and conditional locking.
The Locker has default usage pattern of:
auto locker = holdLock(m_lock);
This forces dynamism that removes the possibility of simple statical
analysis that thread safety analysis capabilities "mutex" and "scoped_lock"
currently implement. Most likely large fraction of call sites is due to historical
lack of CTAD and as such can be converted to less general form.
Once the pattern is not used by default, CheckedLock can be deleted
and the move dynamism bits of Locker can be moved to some more specific type
("UncheckedLocker").
* wtf/ThreadSafetyAnalysis.h: Added.
Add macro wrappers around clang "mutex" and "scoped_lock" capability attributes.
2021-04-17 Sam Weinig <weinig@apple.com>
Move RuntimeEnabledFeatures to Settings (Part 1)
https://bugs.webkit.org/show_bug.cgi?id=224440
Reviewed by Alex Christensen.
Move a few RuntimeEnabledFeatures to Settings to consolidate settings
in one object and removes the need for additional boilerplate. This
is now possible as Settings are now accessible in workers.
Moves PeerConnectionEnabled, WebGLUsingMetal, WebGL2Enabled, WebGPUEnabled
and MaskWebGLStringsEnabled.
* Scripts/Preferences/WebPreferences.yaml:
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-04-16 Kate Cheney <katherine_cheney@apple.com>
Disable app-bound request API tests on specific OS versions
https://bugs.webkit.org/show_bug.cgi?id=223692
<rdar://problem/75787288>
Reviewed by Brent Fulgham.
* wtf/PlatformEnableCocoa.h:
2021-04-16 Alex Christensen <achristensen@webkit.org>
Disable ApplicationCache with linkedOnOrAfter check
https://bugs.webkit.org/show_bug.cgi?id=224629
Reviewed by Brady Eidson.
* Scripts/Preferences/WebPreferences.yaml:
2021-04-16 Alex Christensen <achristensen@webkit.org>
Reduce maximum HashTable entry size to 128 bytes
https://bugs.webkit.org/show_bug.cgi?id=224381
Reviewed by Yusuke Suzuki.
* wtf/HashTable.h:
(WTF::KeyTraits>::inlineLookup):
2021-04-16 Tyler Wilcock <twilco.o@protonmail.com>
[css-counter-styles] Parse and add feature flag for @counter-style
https://bugs.webkit.org/show_bug.cgi?id=223150
Reviewed by Darin Adler.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
Add CSSCounterStyleAtRulesEnabled and CSSCounterStyleAtRuleImageSymbolsEnabled flags.
2021-04-15 Alex Christensen <achristensen@webkit.org>
Use WTF::Function instead of std::function in SVGPropertyAnimatorFactory::attributeAnimatorCreator
https://bugs.webkit.org/show_bug.cgi?id=224586
Reviewed by Darin Adler.
This requires something like r223122 until something like http://wg21.link/P1249 is accepted.
I also added a missing reserveInitialCapacity call that could reduce rehashing when constructing a HashMap from an initializer_list.
* wtf/HashMap.h:
2021-04-14 Alex Christensen <achristensen@webkit.org>
Revert important part of r275948
https://bugs.webkit.org/show_bug.cgi?id=224381
It caused an internal build failure.
* wtf/HashTable.h:
(WTF::KeyTraits>::inlineLookup):
2021-04-14 Alex Christensen <achristensen@webkit.org>
Reduce maximum HashTable entry size to 128 bytes
https://bugs.webkit.org/show_bug.cgi?id=224381
Reviewed by Yusuke Suzuki.
It turns out that HashMaps use HashTable::Value as KeyValuePair, so sizeof(Key) + sizeof(Value) was double counting the key size.
This caused FontCascadeCache to be a false positive. It has a key size of a little over 100 bytes. Only counting it once reflects what is intended.
Also, the USE(ANGLE) exception was convenient for a downstream branch, but isn't needed. Next time they rebase they will use UniqueRef.
* wtf/HashTable.h:
(WTF::KeyTraits>::inlineLookup):
2021-04-13 Ada Chan <ada.chan@apple.com>
Implement PlatformXRSystem::xrCoordinator() for USE(APPLE_INTERNAL_SDK)
https://bugs.webkit.org/show_bug.cgi?id=224510
Reviewed by Dean Jackson.
Update ENABLE_WEBXR flag
* wtf/PlatformEnableCocoa.h:
2021-04-13 Alex Christensen <achristensen@webkit.org>
WebProcessPool should store Vector<Ref<WebProcessProxy>> instead of Vector<RefPtr>
https://bugs.webkit.org/show_bug.cgi?id=224412
Reviewed by Chris Dumez.
* wtf/Ref.h:
(WTF::operator==):
(WTF::operator!=):
2021-04-13 Alex Christensen <achristensen@webkit.org>
Remove support for NPAPI plugins in WebView
https://bugs.webkit.org/show_bug.cgi?id=224449
Reviewed by Chris Dumez.
* Scripts/Preferences/WebPreferences.yaml:
2021-04-13 Chris Dumez <cdumez@apple.com>
Make MemoryPressureHandler::isUnderMemoryPressure() return true for 2 seconds after a simulated warning
https://bugs.webkit.org/show_bug.cgi?id=224505
Reviewed by Darin Adler.
Make MemoryPressureHandler::isUnderMemoryPressure() return true for 2 seconds after a simulated warning,
to make our simulated warning more realistic.
* wtf/cocoa/MemoryPressureHandlerCocoa.mm:
(WTF::MemoryPressureHandler::install):
2021-04-13 Yusuke Suzuki <ysuzuki@apple.com>
[WTF] Add Vector&& move constructor / assignment to FixedVector and RefCountedArray
https://bugs.webkit.org/show_bug.cgi?id=224475
Reviewed by Ryosuke Niwa.
This patch adds move constructor and move-assignment taking Vector to FixedVector / RefCountedArray.
This allows transferring MoveOnly things from Vector to FixedVector.
* wtf/FixedVector.h:
(WTF::FixedVector::FixedVector):
(WTF::FixedVector::operator=):
* wtf/RefCountedArray.h:
(WTF::RefCountedArray::RefCountedArray):
(WTF::RefCountedArray::operator=):
(WTF::RefCountedArray::~RefCountedArray):
(WTF::RefCountedArray::allocateUninitializedData):
(WTF::RefCountedArray::assign):
2021-04-13 Alex Christensen <achristensen@webkit.org>
Revert r275172
https://bugs.webkit.org/show_bug.cgi?id=224499
<rdar://76396241>
Reviewed by Tim Horton.
* wtf/spi/darwin/XPCSPI.h:
2021-04-12 Basuke Suzuki <basuke.suzuki@sony.com>
[PlayStation] Enable WTFCrashWithInfo implementation
https://bugs.webkit.org/show_bug.cgi?id=224458
Reviewed by Don Olmstead.
Enable WTFCrashWithInfo implementation for PlayStation platform. It is x86_64 and uses clang
so that it can share Darwin's implemetation with us.
* wtf/Assertions.cpp:
2021-04-12 Youenn Fablet <youenn@apple.com>
Block loading for port 10080
https://bugs.webkit.org/show_bug.cgi?id=224432
Reviewed by Alex Christensen.
Follow Chrome and Firefox by blocking port 10080.
* wtf/URL.cpp:
(WTF::portAllowed):
2021-04-11 Sam Weinig <weinig@apple.com>
Reduce compile time and binary size cost of enabling proper CSSStyleDeclaration property access behavior
https://bugs.webkit.org/show_bug.cgi?id=222518
<rdar://problem/75136887>
Reviewed by Darin Adler.
* wtf/PlatformEnable.h:
Remove ENABLE_ATTRIBUTE_BASED_PROPERTIES_FOR_CSS_STYLE_DECLARATION, as it is now the default and on everwhere.
2021-04-09 Jer Noble <jer.noble@apple.com>
WTF SoftLinking macros can cause collisions with their target functions
https://bugs.webkit.org/show_bug.cgi?id=224379
<rdar://76434202>
Reviewed by Eric Carlson.
Do not declare an inline version of the target function, as this will collide if the target function
becomes inlined. Instead, callers should use the explicit softLink_Library_Function() syntax, or
the LibrarySoftLinking.h headers should use #defines to re-declare the function name.
* wtf/cocoa/SoftLinking.h:
2021-04-08 Stephan Szabo <stephan.szabo@sony.com>
[RunLoopGeneric] OneShotTimer should not remain "isActive" after fired
https://bugs.webkit.org/show_bug.cgi?id=189335
<rdar://problem/44226604>
Reviewed by Geoffrey Garen.
* wtf/generic/RunLoopGeneric.cpp:
Deactivate one-shot timer before invoking its callback.
2021-04-08 Khem Raj <raj.khem@gmail.com>
[WPE] Build fixes for musl C library on Linux
https://bugs.webkit.org/show_bug.cgi?id=210068
Reviewed by Carlos Alberto Lopez Perez.
Define 128KB DEFAULT_THREAD_STACK_SIZE_IN_KB for musl
Use OS(LINUX) check to include musl when building for
Linux based platforms.
* wtf/PlatformHave.h:
* wtf/Threading.cpp:
2021-04-08 Chris Dumez <cdumez@apple.com>
OfflineAudioContext objects are leaking
https://bugs.webkit.org/show_bug.cgi?id=224279
Reviewed by Darin Adler.
Add flag that can be passed when constructing a WeakPtr to disable threading assertions.
This is useful for cases where we know it is safe due to locking but we'd like to use a
WeakPtr instead of a raw pointer because it is safer.
* wtf/WeakPtr.h:
(WTF::WeakPtr::get const):
(WTF::WeakPtr::operator-> const):
(WTF::WeakPtr::operator* const):
(WTF::WeakPtr::WeakPtr):
(WTF::WeakPtrFactory::createWeakPtr const):
(WTF::=):
(WTF::makeWeakPtr):
2021-04-08 Simon Fraser <simon.fraser@apple.com>
Copy-constructed Vectors should not have excess capacity
https://bugs.webkit.org/show_bug.cgi?id=224313
Reviewed by Darin Adler.
When copy-constructing a Vector<>, set the capacity to the size of the input.
This avoids wasted vector capacity at call sites that dynamically build vectors
and then copy them into read-only caches.
* wtf/Vector.h:
(WTF::Malloc>::Vector):
2021-04-02 Darin Adler <darin@apple.com>
Use Hasher more, remove IntegerHasher, fix hashing-related mistakes
https://bugs.webkit.org/show_bug.cgi?id=224138
Reviewed by Chris Dumez.
* wtf/HashFunctions.h: Export intHash and pairIntHash to the global namespace
so they can be called without an explicit WTF prefix. This follows the usual
WTF design pattern given that these functions are intended for use outside WTF.
* wtf/Hasher.h: Deleted IntegerHasher.
(WTF::add): Added overloads for String, AtomString, and URL.
* wtf/ObjectIdentifier.h:
(WTF::add): Added a Hasher overload for any ObjectIdentifier.
* wtf/RetainPtr.h: Export safeCFEqual and safeCFHash to the global namespace
so they can be called without an explicit WTF prefix. This follows the usual
WTF design pattern given that these functions are intended for use outside WTF.
* wtf/VectorHash.h: Removed the VectorHash template, instead just specializing
DefaultHash. Use computeHash to hash the contents of the vector instead of
hashing the hashes of the items in the vector. This is better in general and
better for the one case where we are currently using this, for a Vector<int>.
We want to hash all the integers rather than hashing hashes of all the integers.
In the future, this means the elements of the Vector need to be hashable using
the Hasher machinery. The old requirement was the the elements had a DefaultHash.
2021-04-07 Michael Catanzaro <mcatanzaro@gnome.org>
Suppress -Warray-bounds warning spam in Bitmap.h
https://bugs.webkit.org/show_bug.cgi?id=224207
Reviewed by Don Olmstead.
Suppress this warning.
* wtf/Bitmap.h:
(WTF::WordType>::clear):
2021-04-07 Yusuke Suzuki <ysuzuki@apple.com>
[JSC] Use FixedVector more in bytecode dir and JumpTable
https://bugs.webkit.org/show_bug.cgi?id=224275
Reviewed by Michael Saboff and Mark Lam.
* wtf/FixedVector.h:
(WTF::FixedVector::offsetOfStorage):
* wtf/RefCountedArray.h:
(WTF::RefCountedArray::Header::size):
(WTF::RefCountedArray::Header::offsetOfLength):
2021-04-07 Alex Christensen <achristensen@webkit.org>
Use os_transaction_create instead of deprecated xpc_transaction_begin/end
https://bugs.webkit.org/show_bug.cgi?id=224288
Reviewed by Tim Horton.
* wtf/spi/darwin/XPCSPI.h:
2021-04-06 Yusuke Suzuki <ysuzuki@apple.com>
[JSC] WasmMemory caging should care nullptr
https://bugs.webkit.org/show_bug.cgi?id=224268
<rdar://problem/74654838>
Reviewed by Mark Lam.
Accept size_t since Wasm::Memory's length can be larger than 4GB.
* wtf/CagedPtr.h:
(WTF::CagedPtr::CagedPtr):
(WTF::CagedPtr::get const):
(WTF::CagedPtr::getMayBeNull const):
(WTF::CagedPtr::at const):
(WTF::CagedPtr::recage):
* wtf/CagedUniquePtr.h:
(WTF::CagedUniquePtr::CagedUniquePtr):
(WTF::CagedUniquePtr::create):
(WTF::CagedUniquePtr::tryCreate):
2021-04-06 Alex Christensen <achristensen@webkit.org>
Add U+0581 and U+0585 to list of Armenian characters that look like Latin characters
https://bugs.webkit.org/show_bug.cgi?id=224219
<rdar://75896365>
Reviewed by Brent Fulgham.
These code points are allowed in the context of other Armenian code points and punctuation, but not other script code points.
This was already implemented for the others, but I consolidated the list to one location to avoid having two locations for the list.
* wtf/URLHelpers.cpp:
(WTF::URLHelpers::isArmenianLookalikeCharacter):
(WTF::URLHelpers::isArmenianLookalikeSequence):
(WTF::URLHelpers::isLookalikeCharacter):
2021-04-06 Yusuke Suzuki <ysuzuki@apple.com>
[WTF] Introduce FixedVector and use it for FixedOperands
https://bugs.webkit.org/show_bug.cgi?id=224171
Reviewed by Mark Lam.
This FixedVector<T> is a wrapper around RefCountedArray<T>, but this offers Vector-like copy / move semantics,
so that we can use this FixedVector<T> as a drop-in-replacement for fixed-sized Vector fields. The purpose
of that is saving memory by removing unnecessary storage (FixedVector is fixed-sized allocated) and putting size
into the allocated memory.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/FastBitVector.h:
(WTF::FastBitVector::FastBitVector):
* wtf/FixedVector.h: Added.
(WTF::FixedVector::FixedVector):
(WTF::FixedVector::operator=):
(WTF::FixedVector::size const):
(WTF::FixedVector::isEmpty const):
(WTF::FixedVector::byteSize const):
(WTF::FixedVector::data):
(WTF::FixedVector::begin):
(WTF::FixedVector::end):
(WTF::FixedVector::data const):
(WTF::FixedVector::begin const):
(WTF::FixedVector::end const):
(WTF::FixedVector::rbegin):
(WTF::FixedVector::rend):
(WTF::FixedVector::rbegin const):
(WTF::FixedVector::rend const):
(WTF::FixedVector::at):
(WTF::FixedVector::at const):
(WTF::FixedVector::operator[]):
(WTF::FixedVector::operator[] const):
(WTF::FixedVector::first):
(WTF::FixedVector::first const):
(WTF::FixedVector::last):
(WTF::FixedVector::last const):
(WTF::FixedVector::fill):
(WTF::FixedVector::operator== const):
(WTF::FixedVector::swap):
(WTF::swap):
* wtf/RefCountedArray.h:
(WTF::RefCountedArray::RefCountedArray):
(WTF::RefCountedArray::fill):
(WTF::RefCountedArray::swap):
2021-04-06 Youenn Fablet <youenn@apple.com>
Enable NSURLSession WebSocket code path by default
https://bugs.webkit.org/show_bug.cgi?id=224102
Reviewed by Alex Christensen.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-04-05 Yusuke Suzuki <ysuzuki@apple.com>
[JSC] Shrink some of Vectors in JSC
https://bugs.webkit.org/show_bug.cgi?id=224162
Reviewed by Simon Fraser.
Add rbegin and rend to make RefCountedArray usable for Vector clients who use these features.
* wtf/RefCountedArray.h:
(WTF::RefCountedArray::begin):
(WTF::RefCountedArray::end):
(WTF::RefCountedArray::begin const):
(WTF::RefCountedArray::end const):
(WTF::RefCountedArray::rbegin):
(WTF::RefCountedArray::rend):
(WTF::RefCountedArray::rbegin const):
(WTF::RefCountedArray::rend const):
2021-04-05 Alex Christensen <achristensen@webkit.org>
Resurrect Mac CMake build
https://bugs.webkit.org/show_bug.cgi?id=224084
Reviewed by Tim Horton.
* wtf/PlatformMac.cmake:
2021-04-05 Wenson Hsieh <wenson_hsieh@apple.com>
REGRESSION: ASSERTION FAILED: settings().textAutosizingEnabled() && settings().textAutosizingUsesIdempotentMode() on various tests
https://bugs.webkit.org/show_bug.cgi?id=209450
<rdar://problem/60799255>
Reviewed by Tim Horton.
Replace the call to `setNeedsRecalcStyleInAllFrames` with `textAutosizingUsesIdempotentModeChanged` when
changing whether idempotent text autosizing is enabled.
* Scripts/Preferences/WebPreferencesInternal.yaml:
2021-04-05 Yusuke Suzuki <ysuzuki@apple.com>
Define AtomString(ASCIILiteral) and use ASCIILiteral more to avoid memory allocation
https://bugs.webkit.org/show_bug.cgi?id=224125
Reviewed by Saam Barati.
Add AtomString(ASCIILiteral). ASCIILiteral ensures that storage is constant non-heap string by its type.
So we can just use it as a literal (not allocating a string storage).
* wtf/text/AtomString.h:
2021-04-02 Simon Fraser <simon.fraser@apple.com>
Enable PreferPageRenderingUpdatesNear60FPSEnabled by default
https://bugs.webkit.org/show_bug.cgi?id=224133
Reviewed by Tim Horton.
Turn the PreferPageRenderingUpdatesNear60FPSEnabled internal setting on by default. This
means that requestAnimationFrame on 144Hz displays will fire at 72Hz. 60Hz displays are
unaffected.
Firing at "close to 60fps" was determined to be necessary for web compatibility and power.
* Scripts/Preferences/WebPreferencesInternal.yaml:
2021-04-02 Youenn Fablet <youenn@apple.com>
[MacOS] Enable NSURLSession WebSocket code path in WebKitTestRunner
https://bugs.webkit.org/show_bug.cgi?id=220973
<rdar://problem/73655870>
Reviewed by Darin Adler.
* wtf/PlatformHave.h:
Bump NSURLSessionWebSocket path to above BigSur and iOS14.
2021-04-02 Yusuke Suzuki <ysuzuki@apple.com>
Unreviewed, fix passing hash value
https://bugs.webkit.org/show_bug.cgi?id=223895
* wtf/RobinHoodHashTable.h:
(WTF::SizePolicy>::addPassingHashCode):
2021-04-01 Yusuke Suzuki <ysuzuki@apple.com>
[WTF] Introduce RobinHoodHashTable
https://bugs.webkit.org/show_bug.cgi?id=223895
Reviewed by Fil Pizlo.
This patch implements RobinHoodHashTable[1]. We don't use it as a default hashtable since it has different performance v.s. memory-saving characteristics,
and this patch's goal is not tackling on making this default. Rather, the goal of this patch is introducing it to non-performance sensitive area quickly
so that we can save memory. RobinHoodHashTable more frequently computes hash value compared to HashTable, so this is not drop-in replacement for the existing
one. But still, this is useful since we know that "while there are many small HashTables and they holds much memory, there are super large HashTables and
they holds almost same amount of memory while they are a few.". This patch's goal is applying this RobinHoodHashTable to these "large, but a few" singleton tables.
RobinHoodHashTable maintains distance-from-initial-bucket (DIB) small by adjusting existing entries when inserting. When inserting, if we found that the
existing entry has less DIB than the current inserting entry's DIB, then we swap entries, and insert the existing entry to the other place. This is giving
some good DIB from rich entry to poor entry (that's why it is called RobinHood Hashing), and making average DIB lower. And this algorithm adds good invariant
that, when looking up an entry, and we found that existing entry has smaller DIB, then we can stop searching in the middle of the chain since we know that
we should swap entries when this happened when inserting. These two tricks maintain HashTable performance even under significantly high load factor: 90% load-factor
just works. 95% load-factor regress adding performance, but still it does not become catastrophic compared to normal open-addressing HashTable.
We introduce RobinHoodHashTable, and adding several kinds of tables based on load-factors.
1. MemoryCompactLookupOnlyRobinHoodHashSet / HashMap
This has 95% load-factor. This is suitable for sets and maps which is mostly-constant: constructing once, and looking up repeatedly. In WebKit, there are so
many this kind of tables e.g. singleton HashMap for various kinds of things. We can use this super high load-factor table so that we can save memory even while
we are maintains fast HashTable lookup.
2. MemoryCompactRobinHoodHashSet / HashMap
This has 90% load-factor. It just works, and we can try using it if sets and maps are significantly performance intensive.
3. FastRobinHoodHashSet / HashMap
This has 75% load-factor. This is still good compared to HashSet and HashMap since they are using 50% load-factor for large sized tables. This has very slightly performance regressed
compared to 50% load-factor large HashSet and HashMap, but if that is not performance intensive (e.g. AtomStringTable is one of the most performance intensive table), this is good.
In this patch, we replace many singleton HashSet / HashMap with RobinHoodHashTable.
[1]: https://www.sebastiansylvan.com/post/robin-hood-hashing-should-be-your-default-hash-table-implementation/
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/Forward.h:
* wtf/HashMap.h:
(WTF::Y>::swap):
(WTF::Y>::size const):
(WTF::Y>::capacity const):
(WTF::Y>::isEmpty const):
(WTF::Y>::begin):
(WTF::Y>::end):
(WTF::Y>::begin const):
(WTF::Y>::end const):
(WTF::Y>::find):
(WTF::Y>::find const):
(WTF::Y>::contains const):
(WTF::Y>::get const):
(WTF::Y>::inlineGet const):
(WTF::TableTraitsArg>::inlineSet):
(WTF::TableTraitsArg>::inlineAdd):
(WTF::TableTraitsArg>::inlineEnsure):
(WTF::TableTraitsArg>::set):
(WTF::TableTraitsArg>::add):
(WTF::TableTraitsArg>::fastAdd):
(WTF::TableTraitsArg>::ensure):
(WTF::Y>::remove):
(WTF::Y>::removeIf):
(WTF::Y>::clear):
(WTF::Y>::take):
(WTF::Y>::checkConsistency const):
(WTF::Y>::isValidKey):
(WTF::operator==):
(WTF::operator!=):
(WTF::X>::swap): Deleted.
(WTF::X>::size const): Deleted.
(WTF::X>::capacity const): Deleted.
(WTF::X>::isEmpty const): Deleted.
(WTF::X>::begin): Deleted.
(WTF::X>::end): Deleted.
(WTF::X>::begin const): Deleted.
(WTF::X>::end const): Deleted.
(WTF::X>::find): Deleted.
(WTF::X>::find const): Deleted.
(WTF::X>::contains const): Deleted.
(WTF::X>::get const): Deleted.
(WTF::X>::inlineGet const): Deleted.
(WTF::MappedTraitsArg>::inlineSet): Deleted.
(WTF::MappedTraitsArg>::inlineAdd): Deleted.
(WTF::MappedTraitsArg>::inlineEnsure): Deleted.
(WTF::MappedTraitsArg>::set): Deleted.
(WTF::MappedTraitsArg>::add): Deleted.
(WTF::MappedTraitsArg>::fastAdd): Deleted.
(WTF::MappedTraitsArg>::ensure): Deleted.
(WTF::MappedTraits>::get const): Deleted.
(WTF::MappedTraits>::inlineGet const): Deleted.
(WTF::X>::remove): Deleted.
(WTF::X>::removeIf): Deleted.
(WTF::X>::clear): Deleted.
(WTF::MappedTraits>::take): Deleted.
(WTF::X>::take): Deleted.
(WTF::X>::checkConsistency const): Deleted.
(WTF::X>::isValidKey): Deleted.
* wtf/HashSet.h:
(WTF::W>::swap):
(WTF::W>::size const):
(WTF::W>::capacity const):
(WTF::W>::isEmpty const):
(WTF::W>::begin const):
(WTF::W>::end const):
(WTF::W>::find const):
(WTF::W>::contains const):
(WTF::TableTraits>::find const):
(WTF::TableTraits>::contains const):
(WTF::TableTraits>::ensure):
(WTF::W>::add):
(WTF::W>::addVoid):
(WTF::TableTraits>::add):
(WTF::W>::remove):
(WTF::W>::removeIf):
(WTF::W>::clear):
(WTF::W>::take):
(WTF::W>::takeAny):
(WTF::TableTraits>::remove):
(WTF::TableTraits>::take):
(WTF::W>::isValidValue):
(WTF::= const):
(WTF::W>::checkConsistency const):
(WTF::V>::swap): Deleted.
(WTF::V>::size const): Deleted.
(WTF::V>::capacity const): Deleted.
(WTF::V>::isEmpty const): Deleted.
(WTF::V>::begin const): Deleted.
(WTF::V>::end const): Deleted.
(WTF::V>::find const): Deleted.
(WTF::V>::contains const): Deleted.
(WTF::Traits>::find const): Deleted.
(WTF::Traits>::contains const): Deleted.
(WTF::Traits>::ensure): Deleted.
(WTF::V>::add): Deleted.
(WTF::V>::addVoid): Deleted.
(WTF::Traits>::add): Deleted.
(WTF::V>::remove): Deleted.
(WTF::V>::removeIf): Deleted.
(WTF::V>::clear): Deleted.
(WTF::V>::take): Deleted.
(WTF::V>::takeAny): Deleted.
(WTF::Traits>::remove): Deleted.
(WTF::Traits>::take): Deleted.
(WTF::V>::isValidValue): Deleted.
(WTF::V>::checkConsistency const): Deleted.
* wtf/HashTable.h:
(WTF::addIterator):
(WTF::removeIterator):
(WTF::invalidateIterators):
(WTF::HashTable::~HashTable):
(WTF::HashTable::random):
(WTF::KeyTraits>::inlineLookup):
(WTF::KeyTraits>::lookupForWriting):
(WTF::KeyTraits>::fullLookupForWriting):
(WTF::KeyTraits>::addUniqueForInitialization):
(WTF::KeyTraits>::add):
(WTF::KeyTraits>::addPassingHashCode):
(WTF::KeyTraits>::removeAndInvalidateWithoutEntryConsistencyCheck):
(WTF::KeyTraits>::removeAndInvalidate):
(WTF::KeyTraits>::clear):
(WTF::KeyTraits>::swap):
(WTF::KeyTraits>::HashTable):
(WTF::HashTable::invalidateIterators): Deleted.
(WTF::KeyTraits>::invalidateIterators): Deleted.
* wtf/RobinHoodHashMap.h: Added.
* wtf/RobinHoodHashSet.h: Added.
* wtf/RobinHoodHashTable.h: Added.
(WTF::RobinHoodHashTable::~RobinHoodHashTable):
(WTF::RobinHoodHashTable::begin):
(WTF::RobinHoodHashTable::end):
(WTF::RobinHoodHashTable::begin const):
(WTF::RobinHoodHashTable::end const):
(WTF::RobinHoodHashTable::random):
(WTF::RobinHoodHashTable::random const):
(WTF::RobinHoodHashTable::size const):
(WTF::RobinHoodHashTable::capacity const):
(WTF::RobinHoodHashTable::isEmpty const):
(WTF::RobinHoodHashTable::reserveInitialCapacity):
(WTF::RobinHoodHashTable::add):
(WTF::RobinHoodHashTable::find):
(WTF::RobinHoodHashTable::find const):
(WTF::RobinHoodHashTable::contains const):
(WTF::RobinHoodHashTable::isEmptyBucket):
(WTF::RobinHoodHashTable::isEmptyOrDeletedBucket):
(WTF::RobinHoodHashTable::lookup):
(WTF::RobinHoodHashTable::checkTableConsistency):
(WTF::RobinHoodHashTable::internalCheckTableConsistency const):
(WTF::RobinHoodHashTable::internalCheckTableConsistencyExceptSize const):
(WTF::RobinHoodHashTable::internalCheckTableConsistencyExceptSize):
(WTF::RobinHoodHashTable::internalCheckTableConsistency):
(WTF::RobinHoodHashTable::shouldExpand):
(WTF::RobinHoodHashTable::computeTableHash):
(WTF::RobinHoodHashTable::shouldExpand const):
(WTF::RobinHoodHashTable::shouldShrink const):
(WTF::RobinHoodHashTable::shrink):
(WTF::RobinHoodHashTable::deleteBucket):
(WTF::RobinHoodHashTable::desiredIndex):
(WTF::RobinHoodHashTable::probeDistance):
(WTF::RobinHoodHashTable::makeIterator):
(WTF::RobinHoodHashTable::makeConstIterator const):
(WTF::RobinHoodHashTable::makeKnownGoodIterator):
(WTF::RobinHoodHashTable::makeKnownGoodConstIterator const):
(WTF::RobinHoodHashTable::checkTableConsistencyExceptSize):
(WTF::RobinHoodHashTable::tableSize const):
(WTF::RobinHoodHashTable::tableSizeMask const):
(WTF::RobinHoodHashTable::keyCount const):
(WTF::RobinHoodHashTable::tableHash const):
(WTF::SizePolicy>::checkKey):
(WTF::SizePolicy>::lookup):
(WTF::SizePolicy>::inlineLookup):
(WTF::SizePolicy>::initializeBucket):
(WTF::SizePolicy>::add):
(WTF::SizePolicy>::maintainProbeDistanceForAdd):
(WTF::SizePolicy>::addPassingHashCode):
(WTF::SizePolicy>::reinsert):
(WTF::SizePolicy>::find):
(WTF::SizePolicy>::find const):
(WTF::SizePolicy>::contains const):
(WTF::SizePolicy>::removeAndInvalidateWithoutEntryConsistencyCheck):
(WTF::SizePolicy>::removeAndInvalidate):
(WTF::SizePolicy>::remove):
(WTF::SizePolicy>::removeWithoutEntryConsistencyCheck):
(WTF::SizePolicy>::allocateTable):
(WTF::SizePolicy>::deallocateTable):
(WTF::SizePolicy>::expand):
(WTF::SizePolicy>::computeBestTableSize):
(WTF::SizePolicy>::shrinkToBestSize):
(WTF::SizePolicy>::rehash):
(WTF::SizePolicy>::clear):
(WTF::SizePolicy>::RobinHoodHashTable):
(WTF::SizePolicy>::swap):
(WTF::=):
(WTF::SizePolicy>::checkTableConsistency const):
(WTF::SizePolicy>::checkTableConsistencyExceptSize const):
* wtf/text/AtomStringHash.h:
* wtf/text/AtomStringImpl.cpp:
* wtf/text/AtomStringTable.cpp:
(WTF::AtomStringTable::~AtomStringTable):
* wtf/text/AtomStringTable.h:
(WTF::AtomStringTable::table):
* wtf/text/StringHash.h:
2021-04-01 Kate Cheney <katherine_cheney@apple.com>
Clear network website data when a user clears history/website data
https://bugs.webkit.org/show_bug.cgi?id=224030
<rdar://problem/75288338>
Reviewed by David Kilzer.
* wtf/cocoa/SoftLinking.h:
Add a new soft link macro to link umbrella private frameworks. We need
this to support internal additions we need to clear network domain data.
2021-04-01 Chris Dumez <cdumez@apple.com>
REGRESSION(r275267): [GTK][WPE] 12 new crashes on service-workers layout tests
https://bugs.webkit.org/show_bug.cgi?id=224059
Reviewed by Carlos Alberto Lopez Perez.
Have the glib implementation of FileSystem::writeToFile() return early when the size to
write is 0, instead of calling g_output_stream_write_all(). It appears that passing a
NULL buffer to g_output_stream_write_all() crashes, even if size is 0.
* wtf/glib/FileSystemGlib.cpp:
(WTF::FileSystemImpl::writeToFile):
2021-03-31 Jiewen Tan <jiewen_tan@apple.com>
Allow ASCWebKitSPISupport to be used on macOS
https://bugs.webkit.org/show_bug.cgi?id=224036
<rdar://76028645>
Reviewed by Brent Fulgham.
* wtf/PlatformHave.h:
2021-03-31 Sam Weinig <weinig@apple.com>
Ease experimentation by enabling <model> if SEPARATED_MODEL is being used
https://bugs.webkit.org/show_bug.cgi?id=224011
Reviewed by Tim Horton.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
There is little point to experimenting with SEPARATED_MODEL if <model> is disabled.
2021-03-31 Antoine Quint <graouts@webkit.org>
Remove CA_WHERE_ADDITIVE_TRANSFORMS_ARE_REVERSED
https://bugs.webkit.org/show_bug.cgi?id=224000
Reviewed by Simon Fraser.
Since trunk is no longer maintained on macOS versions earlier than 10.15,
we can remove this compile-time flag.
* wtf/PlatformHave.h:
2021-03-30 Chris Dumez <cdumez@apple.com>
Service Worker scripts use too much memory in the network process
https://bugs.webkit.org/show_bug.cgi?id=223808
<rdar://75637093>
Reviewed by Geoff Garen.
* wtf/FileSystem.cpp:
(WTF::FileSystemImpl::deleteNonEmptyDirectory):
Add an implementation of FileSystem::deleteNonEmptyDirectory() on all supported platforms.
We previously only had implemetations for Cocoa and Windows.
(WTF::FileSystemImpl::mapToFile):
Moved most of the mapToFile() logic from NetworkCacheData::mapToFile() to FileSystem, so that
it can be reused by the new SWScriptStorage class. It creates the destination file, mmap's it,
writes the provided data to it and then returns the mmap'd file.
(WTF::FileSystemImpl::readOrMakeSalt):
Move readOrMakeSalt() from NetworkCacheData to FileSystem so that it can be reused by the new
SWScriptStorage.
* wtf/FileSystem.h:
2021-03-30 Sam Weinig <weinig@apple.com>
JSGlobalObject's m_customGetterFunctionMap and m_customSetterFunctionMap should be sets, not maps, and should use both the identifier and function pointer as the key
https://bugs.webkit.org/show_bug.cgi?id=223613
Reviewed by Saam Barati.
Adds a heterogenous HashSet::ensure, which allows lazy construction of the value to
insert into the HashSet only if the heterogenous key (e.g. a key + HashTranslator
that are not the same as the HashSet's ValueType) does not match any item in the
set. For example given a set of ExpensiveToConstruct, but uniquely identifiable
by CheapToConstruct:
HashSet<ExpensiveToConstruct> hashSet;
...
struct Translator {
static unsigned hash(const CheapToConstruct& key)
{
return key.hash();
}
static bool equal(const ExpensiveToConstruct& a, const CheapToConstruct& b)
{
return a == b;
}
};
hashSet.ensure<Translator>(CheapToConstruct { ... }, [] {
return ExpensiveToConstruct { ... };
});
This will be used by the custom getter/setter sets to avoid constructing the GC objects
unless they are really needed.
Also took the opertunity to replace some typedefs with usings, and fixed some comments.
* wtf/HashSet.h:
(WTF::Traits>::ensure):
2021-03-30 Mark Lam <mark.lam@apple.com>
Add disableForwardingVPrintfStdErrToOSLog() and use it in the jsc shell.
https://bugs.webkit.org/show_bug.cgi?id=223963
Reviewed by Saam Barati.
* wtf/Assertions.cpp:
(WTF::disableForwardingVPrintfStdErrToOSLog):
* wtf/Assertions.h:
* wtf/WTFConfig.h:
2021-03-29 Alex Christensen <achristensen@webkit.org>
Use terminate_with_reason instead of xpc_connection_kill
https://bugs.webkit.org/show_bug.cgi?id=223618
Reviewed by Darin Adler.
* wtf/spi/darwin/XPCSPI.h:
2021-03-28 Cameron McCormack <heycam@apple.com>
Enable AspectRatioOfImgFromWidthAndHeightEnabled for WebKitLegacy.
https://bugs.webkit.org/show_bug.cgi?id=223815
Reviewed by Sam Weinig.
There's no reason this is enabled for WebKit and not WebKitLegacy.
And set WebCore = true since this feature could conceivably be
used in SVG images.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-03-28 Sam Weinig <weinig@apple.com>
Remove ENABLE_INDEXED_DATABASE & ENABLE_INDEXED_DATABASE_IN_WORKERS, it seems like it is on for all ports
https://bugs.webkit.org/show_bug.cgi?id=223810
Reviewed by Simon Fraser.
* wtf/PlatformEnable.h:
* wtf/PlatformEnableCocoa.h:
Remove ENABLE_INDEXED_DATABASE and ENABLE_INDEXED_DATABASE_IN_WORKERS.
2021-03-27 Chris Dumez <cdumez@apple.com>
wtf/Vector.h:1276:88: runtime error: reference binding to null pointer of type 'const WebCore::Style::RuleFeature'
https://bugs.webkit.org/show_bug.cgi?id=223828
Reviewed by David Kilzer.
Fix issue found by UBSan in Vector::append(const U*, size_t):
wtf/Vector.h:1276:88: runtime error: reference binding to null pointer of type 'const WebCore::Style::RuleFeature'
wtf/Vector.h:1276:88: runtime error: reference binding to null pointer of type 'const WebCore::LayoutRect'
wtf/Vector.h:1276:88: runtime error: reference binding to null pointer of type 'const WTF::RefPtr<WebCore::CSSStyleSheet, WTF::RawPtrTraits<WebCore::CSSStyleSheet>, WTF::DefaultRefDerefTraits<WebCore::CSSStyleSheet> >'
* wtf/Vector.h:
(WTF::Malloc>::append):
Return early if dataSize is 0. For some call sites, the pointer may be null and dataSize is 0. In such cases,
we should just return early instead of proceeding and using the null pointer. I believe this can happen if
you call Vector::appendVector() with an empty Vector for example.
2021-03-26 Chris Dumez <cdumez@apple.com>
REGRESSION (r275038?): Perf test IndexedDB/stress/large-binary-keys.html failing with logging about memory pressure events
https://bugs.webkit.org/show_bug.cgi?id=223826
<rdar://problem/75906134>
Reviewed by Darin Adler.
Use RELEASE_LOG() instead of WTFLogAlways() to log memory pressure events, so that they don't
show on stdout in the performance tests and make them fail.
* wtf/cocoa/MemoryPressureHandlerCocoa.mm:
(WTF::MemoryPressureHandler::install):
2021-03-26 Wenson Hsieh <wenson_hsieh@apple.com>
Use PUICQuickboardController for text input when HAVE(QUICKBOARD_CONTROLLER) is defined
https://bugs.webkit.org/show_bug.cgi?id=223809
<rdar://problem/56730407>
Reviewed by Tim Horton.
Remove the `QuickboardControllerForTextInputEnabled` WebKit preference, now that the feature is enabled by
default behind a build-time flag.
* Scripts/Preferences/WebPreferencesInternal.yaml:
2021-03-26 Yusuke Suzuki <ysuzuki@apple.com>
[JSC] Use new Apple ICU APIs to avoid C++ ICU API usage
https://bugs.webkit.org/show_bug.cgi?id=223783
<rdar://problem/75060240>
Reviewed by Mark Lam.
* wtf/DateMath.h:
(WTF::LocalTimeOffset::LocalTimeOffset):
2021-03-26 Per Arne <pvollan@apple.com>
Enforce notifyd message filtering
https://bugs.webkit.org/show_bug.cgi?id=223601
<rdar://75098580>
Reviewed by Brent Fulgham.
Add ENABLE define for Notify filtering.
* wtf/PlatformEnableCocoa.h:
2021-03-26 Dean Jackson <dino@apple.com>
Enable Metal ANGLE backend for WebGL
https://bugs.webkit.org/show_bug.cgi?id=220076
<rdar://problem/72565020>
Reviewed by Sam Weinig.
Turn the Metal backend for ANGLE on, moving the feature
from Internal to Experimental.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
* Scripts/Preferences/WebPreferencesInternal.yaml:
2021-03-26 Jessie Berlin <jberlin@webkit.org>
Update the BEFORE/SINCE, SYSTEM_VERSION_PREFIX, and MACOSX_DEPLOYMENT_TARGET flags
https://bugs.webkit.org/show_bug.cgi?id=223779
Reviewed by Tim Horton.
* Configurations/DebugRelease.xcconfig:
2021-03-25 Megan Gardner <megan_gardner@apple.com>
Have App Highlights be a Configuration Setting instead of an internal Preference setting.
https://bugs.webkit.org/show_bug.cgi?id=223720
rdar://75196085
Reviewed by Wenson Hsieh.
* Scripts/Preferences/WebPreferences.yaml:
* Scripts/Preferences/WebPreferencesInternal.yaml:
2021-03-25 Jessie Berlin <jberlin@webkit.org>
Remove 10.13 DEPLOYMENT_TARGETs and SYSTEM_VERSION_PREFIXs
https://bugs.webkit.org/show_bug.cgi?id=223765
Reviewed by Tim Horton.
* Configurations/Base.xcconfig:
* Configurations/DebugRelease.xcconfig:
2021-03-25 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r275057.
https://bugs.webkit.org/show_bug.cgi?id=223768
Caused build failure
Reverted changeset:
"Enforce notifyd message filtering"
https://bugs.webkit.org/show_bug.cgi?id=223601
https://trac.webkit.org/changeset/275057
2021-03-25 Kate Cheney <katherine_cheney@apple.com>
Some calls in AuthenticatorPresenterCoordinator::selectAssertionResponse are not yet available for mac
https://bugs.webkit.org/show_bug.cgi?id=223752
<rdar://problem/75808515>
Reviewed by Jiewen Tan.
* wtf/PlatformHave.h:
2021-03-25 Per Arne <pvollan@apple.com>
Enforce notifyd message filtering
https://bugs.webkit.org/show_bug.cgi?id=223601
<rdar://75098580>
Reviewed by Brent Fulgham.
Add ENABLE define for Notify filtering.
* wtf/PlatformEnableCocoa.h:
2021-03-25 Don Olmstead <don.olmstead@sony.com>
Embiggen maximum HashTable size when not using ANGLE
https://bugs.webkit.org/show_bug.cgi?id=223757
Reviewed by Alex Christensen.
This is a partial revert of r274603 which cut the maximum size HashTable from 400 to 250.
When not using ANGLE directly for an OpenGL ES implementation there's some code hashing its
sh::ShaderVariable from the shader compiler ANGLE ships with. This type is too big and
triggers the static_assert.
The eventual goal is for ANGLE to be the OpenGL ES implementation for WebKit when enabling
WebGL. On PlayStation we already have a system OpenGL ES and any use of WebGL is in legacy
applications. The WebGL compliance features in ANGLE aren't needed in this case so ideally
we wouldn't even compile out ANGLE.
This patch punts on fixing the actual problem and just resolves this build issue.
* wtf/HashTable.h:
(WTF::KeyTraits>::inlineLookup):
2021-03-25 Chris Dumez <cdumez@apple.com>
Do not do process pre-warming when the system is under memory pressure
https://bugs.webkit.org/show_bug.cgi?id=223717
<rdar://problem/75810423>
Reviewed by Antti Koivisto.
* wtf/cocoa/MemoryPressureHandlerCocoa.mm:
(WTF::MemoryPressureHandler::install):
- Listen to the same memory pressure notifications on macOS and iOS. Previously, macOS would not respond to
non-critical memory pressure notifications for example. Also, since macOS would not listen for the notification
that happens when the memory usage goes back to normal, MemoruPressureHandler::isUnderMemoryPressure() would
start returning true after a critical memory pressure notification and it would never go back to false.
2021-03-25 Alberto Garcia <berto@igalia.com>
REGRESSION(r271560): [Linux] release assert in Thread::initializePlatformThreading
https://bugs.webkit.org/show_bug.cgi?id=223069
Reviewed by Carlos Garcia Campos.
Replace an existing signal handler instead of aborting.
* wtf/posix/ThreadingPOSIX.cpp:
(WTF::Thread::initializePlatformThreading):
2021-03-24 Mark Lam <mark.lam@apple.com>
WTF::setPermissionsOfConfigPage() should allow its VM_FLAGS_PERMANENT workaround unconditionally.
https://bugs.webkit.org/show_bug.cgi?id=223725
rdar://75813316
Reviewed by Saam Barati.
If the OS does not support the flag, then we should not require it.
* wtf/WTFConfig.cpp:
(WTF::setPermissionsOfConfigPage):
2021-03-24 Yusuke Suzuki <ysuzuki@apple.com>
Use StaticStringImpl instead of StringImpl::createStaticStringImpl if it is not dynamic string content
https://bugs.webkit.org/show_bug.cgi?id=223714
Reviewed by Saam Barati.
We should just use StaticStringImpl instead of StringImpl::createStaticStringImpl if the string content is
not dynamically allocated one. Keep in mind that this URL code is strongly assuming that internal StringImpl
is static so that this string (and URL) can be used in multiple threads. And StaticStringImpl meets this requirement.
* wtf/URL.cpp:
(WTF::aboutBlankURL):
(WTF::aboutSrcDocURL):
2021-03-24 Yusuke Suzuki <ysuzuki@apple.com>
All string resources from UserAgentStyleSheets / UserAgentScripts should be used as non-copying StringImpl
https://bugs.webkit.org/show_bug.cgi?id=223685
Reviewed by Saam Barati.
Add StringImpl::createWithoutCopying for `const char*`.
* wtf/text/StringImpl.h:
(WTF::StringImpl::createWithoutCopying):
2021-03-24 Eric Carlson <eric.carlson@apple.com>
[Cocoa] Add Experimental MediaSession coordinator
https://bugs.webkit.org/show_bug.cgi?id=222158
<rdar://problem/74508862>
Reviewed by Jer Noble.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
* wtf/PlatformEnableCocoa.h:
2021-03-24 Chris Dumez <cdumez@apple.com>
Address undefined behavior found by UBSan in StringToIntegerConversion.h
https://bugs.webkit.org/show_bug.cgi?id=223694
Reviewed by Geoffrey Garen.
Update StringToIntegerConversion to deal with overflows in a well-defined manner,
by relying on CheckedArithmetics. This addresses undefined behavior reborted by
UBSan:
- wtf/text/StringToIntegerConversion.h:94:30: runtime error: signed integer overflow: 2147483640 + 8 cannot be represented in type 'int'
- wtf/text/StringToIntegerConversion.h:104:17: runtime error: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself
* wtf/text/StringToIntegerConversion.h:
(WTF::toIntegralType):
2021-03-24 Truitt Savell <tsavell@apple.com>
Unreviewed, reverting r274927.
Broke many tests in WebGL
Reverted changeset:
"Enable Metal ANGLE backend for WebGL"
https://bugs.webkit.org/show_bug.cgi?id=220076
https://commits.webkit.org/r274927
2021-03-24 Chris Dumez <cdumez@apple.com>
Address undefined behavior found by UBSan in DateMath.h
https://bugs.webkit.org/show_bug.cgi?id=223663
Reviewed by Darin Adler.
Address undefined behavior found by UBSan in DateMath.h
Release/usr/local/include/wtf/DateMath.h:247:39: runtime error: nan is outside the range of representable values of type 'int'
Release/usr/local/include/wtf/DateMath.h:221:29: runtime error: nan is outside the range of representable values of type 'int'
Release/usr/local/include/wtf/DateMath.h:165:38: runtime error: signed integer overflow: -2147483648 - 1 cannot be represented in type 'int'
* wtf/DateMath.h:
(WTF::daysFrom1970ToYear):
Cast year to a double *before* substracting 1 instead of *after*. This works around the fact that INT_MIN-1 would not
fit in an int and would be undefined behavior.
(WTF::dayInYear):
(WTF::msToYear):
Deal with the double potentially being NaN before casting to an int, since
casting NaN to an int type has undefined behavior.
2021-03-23 Dean Jackson <yolo@apple.com>
Enable Metal ANGLE backend for WebGL
https://bugs.webkit.org/show_bug.cgi?id=220076
<rdar://problem/72565020>
Reviewed by Sam Weinig.
Turn the Metal backend for ANGLE on, moving the feature
from Internal to Experimental.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
* Scripts/Preferences/WebPreferencesInternal.yaml:
2021-03-23 Chris Dumez <cdumez@apple.com>
DerivedSources/WebKitTestRunner/JSAccessibilityUIElement.cpp:802:72: runtime error: -1 is outside the range of representable values of type 'unsigned int'
https://bugs.webkit.org/show_bug.cgi?id=223650
Reviewed by Darin Adler.
Update the clampTo() template specialization that converts floating types into integer types so that
it deals with NaN inputs in a well-defined manner. Previously, it would simply cast the NaN to the
integer type, which was undefined behavior. We now return the minimum range boundary for the output
when the input is NaN.
* wtf/MathExtras.h:
(clampTo):
2021-03-23 Saam Barati <sbarati@apple.com>
Don't require VM_FLAGS_PERMANENT on the simulator builds
https://bugs.webkit.org/show_bug.cgi?id=223649
<rdar://problem/75747788>
Reviewed by Alexey Proskuryakov.
Since VM_FLAGS_PERMANENT must be supported by the kernel, let's make
it so that the vm_map that passes this flag in can fail when running
on the simulator. This is to support the use case of running a newer
simulator on an older OS. When the call to vm_map fails when running
on the simulator, we try again without the VM_FLAGS_PERMANENT flag.
* wtf/WTFConfig.cpp:
(WTF::setPermissionsOfConfigPage):
2021-03-23 Alex Christensen <achristensen@webkit.org>
Remove unused WTF::String::percentage
https://bugs.webkit.org/show_bug.cgi?id=223651
Reviewed by Chris Dumez.
* wtf/text/AtomString.h:
* wtf/text/WTFString.cpp:
(WTF::String::percentage const): Deleted.
* wtf/text/WTFString.h:
2021-03-23 Chris Dumez <cdumez@apple.com>
wtf/text/IntegerToStringConversion.h:54:104: runtime error: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself
https://bugs.webkit.org/show_bug.cgi?id=223614
Reviewed by Darin Adler.
numberToStringSigned() was calling -number when number is negative. This could trigger undefined behavior
since -number may not be representable in the input type. For example, if the type was int and number was
INT_MIN, -INT_MIN would overflow and the result would be undefined. To address the issue, we now cast
number to the destination *unsigned* type *before* negating it.
* wtf/text/IntegerToStringConversion.h:
(WTF::numberToStringSigned):
2021-03-23 Alex Christensen <achristensen@webkit.org>
Optimize StringView::CodePoints::Iterator
https://bugs.webkit.org/show_bug.cgi?id=162315
Reviewed by Darin Adler.
This stores range pointers in the iterator instead of a pointer to a pointer.
* wtf/text/StringView.h:
(WTF::StringView::CodePoints::Iterator::Iterator):
(WTF::StringView::CodePoints::Iterator::operator++):
(WTF::StringView::CodePoints::Iterator::operator* const):
(WTF::StringView::CodePoints::Iterator::operator== const):
2021-03-23 Chris Dumez <cdumez@apple.com>
Add assertions to guard against heap allocations on the audio thread
https://bugs.webkit.org/show_bug.cgi?id=223226
Reviewed by Darin Adler.
Add ForbidMallocUseForCurrentThreadScope to FastMalloc.h to enable assertions guarding against
doing heap allocations on the current thread (during the lifetime of the Scope object).
Also add a DisableMallocRestrictionsForCurrentThreadScope to temporarily disable those checks
to allow for some very specific assertions (either because they are required, or simply because
they are not fixed yet).
* wtf/FastMalloc.cpp:
(WTF::ForbidMallocUseForCurrentThreadScope::ForbidMallocUseForCurrentThreadScope):
(WTF::ForbidMallocUseForCurrentThreadScope::~ForbidMallocUseForCurrentThreadScope):
(WTF::DisableMallocRestrictionsForCurrentThreadScope::DisableMallocRestrictionsForCurrentThreadScope):
(WTF::DisableMallocRestrictionsForCurrentThreadScope::~DisableMallocRestrictionsForCurrentThreadScope):
(WTF::tryFastMalloc):
(WTF::fastMalloc):
(WTF::tryFastCalloc):
(WTF::fastCalloc):
(WTF::fastRealloc):
(WTF::tryFastRealloc):
(WTF::fastAlignedMalloc):
(WTF::tryFastAlignedMalloc):
* wtf/FastMalloc.h:
(WTF::ForbidMallocUseForCurrentThreadScope::~ForbidMallocUseForCurrentThreadScope):
(WTF::DisableMallocRestrictionsForCurrentThreadScope::~DisableMallocRestrictionsForCurrentThreadScope):
2021-03-22 Devin Rousso <drousso@apple.com>
Remove unused JS and CSS files of media controls
https://bugs.webkit.org/show_bug.cgi?id=214955
<rdar://problem/66604040>
Reviewed by Eric Carlson.
Cocoa platforms are already using modern media controls so there's no reason to keep the old
media controls resources/logic around any longer. It just wastes space.
The non-iOS Apple controls must be kept though as they are still used on Windows.
* wtf/PlatformEnable.h:
* wtf/PlatformEnableCocoa.h:
* Scripts/Preferences/WebPreferences.yaml:
Replace `ModernMediaControlsEnabled` setting with `ENABLE_MODERN_MEDIA_CONTROLS` build flag.
2021-03-22 Rob Buis <rbuis@igalia.com>
[css-contain] Parse CSS contain property
https://bugs.webkit.org/show_bug.cgi?id=223252
Reviewed by Darin Adler.
Add experimental feature flag.
* Scripts/Preferences/WebPreferencesExperimental.yaml:
2021-03-22 Ross Kirsling <ross.kirsling@sony.com>
Unreviewed, fix Mac and non-unified JSCOnly builds
https://bugs.webkit.org/show_bug.cgi?id=223546
* wtf/PlatformJSCOnly.cmake:
Add missing file for JSCOnly build on Mac.
2021-03-19 Darin Adler <darin@apple.com>
[Cocoa] Make it possible to release a WKWebView on a non-main thread without a crash due to WKScriptMessage race
https://bugs.webkit.org/show_bug.cgi?id=222336
Reviewed by Chris Dumez.
* wtf/spi/cocoa/objcSPI.h: Removed unnecessary #if so functions are correctly compiled for
non-Objective-C source files. Added include of <objc/objc.h> so that "id" is defined.
2021-03-19 Sam Weinig <weinig@apple.com>
Add PropertyName parameter to custom setters to allow shared implementations to do late name lookup
https://bugs.webkit.org/show_bug.cgi?id=223413
Reviewed by Alexey Shvayka.
* wtf/PlatformCallingConventions.h:
Update JSC_DECLARE_CUSTOM_SETTER to account for the new PropertyName parameter.
== Rolled over to ChangeLog-2021-03-18 ==