haikuwebkit/Source/WebCore/platform/FileMonitor.cpp

42 lines
1.6 KiB
C++
Raw Permalink Normal View History

Teach ResourceLoadStatistics to recognize changes in the file system https://bugs.webkit.org/show_bug.cgi?id=173800 <rdar://problem/32937842> Reviewed by Chris Dumez. Source/WebCore: We want to support the case where multiple UI processes choose to share the same statistics file. To support this, update the ResourceLoadStatistics logic to be aware that the statistics data file might change underneath it, and to take appropriate action when it does. * WebCore.xcodeproj/project.pbxproj: Update for new sources. * WebCore/CMakeLists.txt: Update for new FileMonitor source file. * loader/ResourceLoadStatisticsStore.cpp: (WebCore::ResourceLoadStatisticsStore::clearInMemoryAndPersistent): Use the new deletion handler for the data file instead of writing out an empty file. (WebCore::ResourceLoadStatisticsStore::setDeletePersistentStoreCallback): Added. * loader/ResourceLoadStatisticsStore.h: * platform/FileMonitor.cpp: Added. (WebCore::FileMonitor::create): (WebCore::FileMonitor::FileMonitor): Register handlers and begin monitoring file. (WebCore::FileMonitor::~FileMonitor): Stop any active file monitoring. (WebCore::FileMonitor::startMonitoringPath): Stub implementation. (WebCore::FileMonitor::stopMonitoring): Ditto. * platform/FileMonitor.h: Added. * platform/FileSystem.h: Export files needed by WebKit2. Add support for O_EVTONLY Darwin file handles. * platform/Logging.h: Add 'ResourceLoadStatistics' category. * platform/cocoa/FileMonitorCocoa.mm: Added. (WebCore::FileMonitor::startMonitoringPath): Create a new VNODE type dispatch_source to receive notifications when the specified file changes. (WebCore::FileMonitor::stopMonitoring): Cancel the dispatch_source when we are done monitoring the file. * platform/posix/FileSystemPOSIX.cpp: Update 'openFile' to understand the O_EVTONLY mode of file handles (Darwin-only). Source/WebKit2: We want to support the case where multiple UI processes choose to share the same statistics file. To support this, update the ResourceLoadStatistics logic to be aware that the statistics data file might change underneath it, and to take appropriate action when it does. * UIProcess/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::setResourceLoadStatisticsEnabled): When we enable the statistics, read in the data and then watch for changes. (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver): Add a 'delete data' handler to remove the file on disk, not just write an empty store. (WebKit::WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded): Use ASCIILiteral. (WebKit::WebResourceLoadStatisticsStore::refreshFromDisk): Convenience function. (WebKit::WebResourceLoadStatisticsStore::writeStoreToDisk): Sync with any on-disk storage before writing out. (WebKit::openAndLockFile): Convenience function. (WebKit::closeAndUnlockFile): Ditto. (WebKit::WebResourceLoadStatisticsStore::writeEncoderToDisk): Revise to lock file (on platforms that support it) before writing to disk. (WebKit::WebResourceLoadStatisticsStore::deleteStoreFromDisk): Added convenience function. (WebKit::WebResourceLoadStatisticsStore::clearInMemoryData): Ditto. (WebKit::WebResourceLoadStatisticsStore::startMonitoringStatisticsStorage): Create a file system monitor to watch for file changes. (WebKit::WebResourceLoadStatisticsStore::syncWithExistingStatisticsStorageIfNeeded): Added convenience function. (WebKit::WebResourceLoadStatisticsStore::createDecoderFromDisk): Revise to read data directly so we can control file locking. * UIProcess/WebResourceLoadStatisticsStore.h: 2017-06-28 Wenson Hsieh <wenson_hsieh@apple.com> Followup to r218885: adjust for further UIKit SPI changes https://bugs.webkit.org/show_bug.cgi?id=173927 <rdar://problem/33020792> Reviewed by Tim Horton. On ToT, UIKit now invokes -_dragInteraction:item:shouldDelaySetDownAnimationWithCompletion: before the completion block of -dragInteraction:willAnimateLiftWithAnimator:session: is called. This means we now need to store the completion block in -shouldDelaySetDownAnimationWithCompletion: and wait until the UIDragAnimating completion block in -willAnimateCancelWithAnimator: before invoking it. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView cleanUpDragSourceSessionState]): Ensure that the set-down completion block is invoked when a drag session ends (e.g., if the web content process crashes). (-[WKContentView _dragInteraction:item:shouldDelaySetDownAnimationWithCompletion:]): (-[WKContentView _api_dragInteraction:item:willAnimateCancelWithAnimator:]): Source/WTF: * wtf/DispatchPtr.h: Added (moved from WebKit2) * wtf/Platform.h: Make sure USE_FILE_LOCK is enabled. Tools: * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/WebCore/FileMonitor.cpp: Added. (TestWebKitAPI::FileMonitorTest::tempFilePath): (TestWebKitAPI::handleFileModification): (TestWebKitAPI::handleFileDeletion): (TestWebKitAPI::resetTestState): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/190777@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218901 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-06-28 23:21:11 +00:00
/*
* Copyright (C) 2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "FileMonitor.h"
namespace WebCore {
[GTK][WPE] All resource load statistics tests added in r212183 crash in GTK bots, timeout in GTK and WPE bots since r219049 https://bugs.webkit.org/show_bug.cgi?id=168171 Reviewed by Chris Dumez. Source/WebCore: Add an implementation of FileMonitor for GLib based ports. * PlatformGTK.cmake: * PlatformWPE.cmake: * platform/FileMonitor.cpp: * platform/FileMonitor.h: * platform/glib/FileMonitorGLib.cpp: Added. (WebCore::FileMonitor::FileMonitor): (WebCore::FileMonitor::~FileMonitor): (WebCore::FileMonitor::fileChangedCallback): (WebCore::FileMonitor::didChange): Source/WebKit: Add C API to handle all resource load statistics requests made by the layout tests. * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreSetStatisticsLastSeen): (WKWebsiteDataStoreSetStatisticsPrevalentResource): (WKWebsiteDataStoreIsStatisticsPrevalentResource): (WKWebsiteDataStoreSetStatisticsHasHadUserInteraction): (WKWebsiteDataStoreIsStatisticsHasHadUserInteraction): (WKWebsiteDataStoreSetStatisticsGrandfathered): (WKWebsiteDataStoreIsStatisticsGrandfathered): (WKWebsiteDataStoreSetStatisticsSubframeUnderTopFrameOrigin): (WKWebsiteDataStoreSetStatisticsSubresourceUnderTopFrameOrigin): (WKWebsiteDataStoreSetStatisticsSubresourceUniqueRedirectTo): (WKWebsiteDataStoreSetStatisticsTimeToLiveUserInteraction): (WKWebsiteDataStoreSetStatisticsTimeToLiveCookiePartitionFree): (WKWebsiteDataStoreStatisticsProcessStatisticsAndDataRecords): (WKWebsiteDataStoreStatisticsUpdateCookiePartitioning): (WKWebsiteDataStoreSetStatisticsShouldPartitionCookiesForHost): (WKWebsiteDataStoreStatisticsSubmitTelemetry): (WKWebsiteDataStoreSetStatisticsNotifyPagesWhenDataRecordsWereScanned): (WKWebsiteDataStoreSetStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval): (WKWebsiteDataStoreSetStatisticsNotifyPagesWhenTelemetryWasCaptured): (WKWebsiteDataStoreSetStatisticsMinimumTimeBetweenDataRecordsRemoval): (WKWebsiteDataStoreSetStatisticsGrandfatheringTime): (WKWebsiteDataStoreSetStatisticsMaxStatisticsEntries): (WKWebsiteDataStoreSetStatisticsPruneEntriesDownTo): (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStore): (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours): (WKWebsiteDataStoreStatisticsClearThroughWebsiteDataRemoval): (WKWebsiteDataStoreStatisticsResetToConsistentState): * UIProcess/API/C/WKWebsiteDataStoreRef.h: Tools: Implement all resource load statistics functions in TestController using the C API. Also enable the FileMonitor unit test. This test requires a platform implementation of Util::run(), so I've added UtilitiesGLib.cpp with an iplementation common to glib based ports using WTF RunLoop abstraction. * TestWebKitAPI/PlatformGTK.cmake: * TestWebKitAPI/PlatformWPE.cmake: * TestWebKitAPI/Tests/WebCore/FileMonitor.cpp: * TestWebKitAPI/glib/UtilitiesGLib.cpp: Copied from Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h. (TestWebKitAPI::Util::run): (TestWebKitAPI::Util::spinRunLoop): (TestWebKitAPI::Util::sleep): * TestWebKitAPI/gtk/PlatformUtilitiesGtk.cpp: * TestWebKitAPI/wpe/PlatformUtilitiesWPE.cpp: * WebKitTestRunner/TestController.cpp: (WTR::TestController::platformAdjustContext): (WTR::TestController::setStatisticsLastSeen): (WTR::TestController::setStatisticsPrevalentResource): (WTR::ResourceStatisticsCallbackContext::ResourceStatisticsCallbackContext): (WTR::resourceStatisticsCallback): (WTR::TestController::isStatisticsPrevalentResource): (WTR::TestController::setStatisticsHasHadUserInteraction): (WTR::TestController::isStatisticsHasHadUserInteraction): (WTR::TestController::setStatisticsGrandfathered): (WTR::TestController::isStatisticsGrandfathered): (WTR::TestController::setStatisticsSubframeUnderTopFrameOrigin): (WTR::TestController::setStatisticsSubresourceUnderTopFrameOrigin): (WTR::TestController::setStatisticsSubresourceUniqueRedirectTo): (WTR::TestController::setStatisticsTimeToLiveUserInteraction): (WTR::TestController::setStatisticsTimeToLiveCookiePartitionFree): (WTR::TestController::statisticsProcessStatisticsAndDataRecords): (WTR::TestController::statisticsUpdateCookiePartitioning): (WTR::TestController::statisticsSetShouldPartitionCookiesForHost): (WTR::TestController::statisticsSubmitTelemetry): (WTR::TestController::setStatisticsNotifyPagesWhenDataRecordsWereScanned): (WTR::TestController::setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval): (WTR::TestController::setStatisticsNotifyPagesWhenTelemetryWasCaptured): (WTR::TestController::setStatisticsMinimumTimeBetweenDataRecordsRemoval): (WTR::TestController::setStatisticsGrandfatheringTime): (WTR::TestController::setStatisticsMaxStatisticsEntries): (WTR::TestController::setStatisticsPruneEntriesDownTo): (WTR::TestController::statisticsClearInMemoryAndPersistentStore): (WTR::TestController::statisticsClearInMemoryAndPersistentStoreModifiedSinceHours): (WTR::TestController::statisticsClearThroughWebsiteDataRemovalCallback): (WTR::TestController::statisticsClearThroughWebsiteDataRemoval): (WTR::TestController::statisticsResetToConsistentState): * WebKitTestRunner/TestController.h: LayoutTests: Unskip the tests. * platform/wpe/TestExpectations: * platform/wpe/TestExpectations: Canonical link: https://commits.webkit.org/194234@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222962 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-06 06:48:38 +00:00
#if !PLATFORM(COCOA) && !USE(GLIB)
FileMonitor should not be ref counted https://bugs.webkit.org/show_bug.cgi?id=174166 Reviewed by Brent Fulgham. Source/WebCore: Update FileMonitor to no longer be refcounted. It was previously easy to leak it because the object would ref itself in various lambdas. The client would have to explicitely call FileMonitor::stopMonitoring() which was fragile. This patch also simplifies the code and API a bit since no longer actually requires startMonitoring() / stopMonitoring() API. No new tests, covered by API tests. * platform/FileMonitor.cpp: (WebCore::FileMonitor::FileMonitor): (WebCore::FileMonitor::~FileMonitor): (WebCore::FileMonitor::create): Deleted. (WebCore::FileMonitor::startMonitoring): Deleted. (WebCore::FileMonitor::stopMonitoring): Deleted. * platform/FileMonitor.h: * platform/cocoa/FileMonitorCocoa.mm: (WebCore::FileMonitor::FileMonitor): (WebCore::FileMonitor::~FileMonitor): (WebCore::FileMonitor::startMonitoring): Deleted. (WebCore::FileMonitor::stopMonitoring): Deleted. Source/WebKit2: Update code using FileMonitor to reflect API change. * UIProcess/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::startMonitoringStatisticsStorage): (WebKit::WebResourceLoadStatisticsStore::stopMonitoringStatisticsStorage): * UIProcess/WebResourceLoadStatisticsStore.h: Tools: Update the API tests to reflect the API change. * TestWebKitAPI/Tests/WebCore/FileMonitor.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/191062@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219219 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-07-06 21:45:04 +00:00
FileMonitor::FileMonitor(const String&, Ref<WorkQueue>&&, WTF::Function<void(FileChangeType)>&&)
Teach ResourceLoadStatistics to recognize changes in the file system https://bugs.webkit.org/show_bug.cgi?id=173800 <rdar://problem/32937842> Reviewed by Chris Dumez. Source/WebCore: We want to support the case where multiple UI processes choose to share the same statistics file. To support this, update the ResourceLoadStatistics logic to be aware that the statistics data file might change underneath it, and to take appropriate action when it does. * WebCore.xcodeproj/project.pbxproj: Update for new sources. * WebCore/CMakeLists.txt: Update for new FileMonitor source file. * loader/ResourceLoadStatisticsStore.cpp: (WebCore::ResourceLoadStatisticsStore::clearInMemoryAndPersistent): Use the new deletion handler for the data file instead of writing out an empty file. (WebCore::ResourceLoadStatisticsStore::setDeletePersistentStoreCallback): Added. * loader/ResourceLoadStatisticsStore.h: * platform/FileMonitor.cpp: Added. (WebCore::FileMonitor::create): (WebCore::FileMonitor::FileMonitor): Register handlers and begin monitoring file. (WebCore::FileMonitor::~FileMonitor): Stop any active file monitoring. (WebCore::FileMonitor::startMonitoringPath): Stub implementation. (WebCore::FileMonitor::stopMonitoring): Ditto. * platform/FileMonitor.h: Added. * platform/FileSystem.h: Export files needed by WebKit2. Add support for O_EVTONLY Darwin file handles. * platform/Logging.h: Add 'ResourceLoadStatistics' category. * platform/cocoa/FileMonitorCocoa.mm: Added. (WebCore::FileMonitor::startMonitoringPath): Create a new VNODE type dispatch_source to receive notifications when the specified file changes. (WebCore::FileMonitor::stopMonitoring): Cancel the dispatch_source when we are done monitoring the file. * platform/posix/FileSystemPOSIX.cpp: Update 'openFile' to understand the O_EVTONLY mode of file handles (Darwin-only). Source/WebKit2: We want to support the case where multiple UI processes choose to share the same statistics file. To support this, update the ResourceLoadStatistics logic to be aware that the statistics data file might change underneath it, and to take appropriate action when it does. * UIProcess/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::setResourceLoadStatisticsEnabled): When we enable the statistics, read in the data and then watch for changes. (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver): Add a 'delete data' handler to remove the file on disk, not just write an empty store. (WebKit::WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded): Use ASCIILiteral. (WebKit::WebResourceLoadStatisticsStore::refreshFromDisk): Convenience function. (WebKit::WebResourceLoadStatisticsStore::writeStoreToDisk): Sync with any on-disk storage before writing out. (WebKit::openAndLockFile): Convenience function. (WebKit::closeAndUnlockFile): Ditto. (WebKit::WebResourceLoadStatisticsStore::writeEncoderToDisk): Revise to lock file (on platforms that support it) before writing to disk. (WebKit::WebResourceLoadStatisticsStore::deleteStoreFromDisk): Added convenience function. (WebKit::WebResourceLoadStatisticsStore::clearInMemoryData): Ditto. (WebKit::WebResourceLoadStatisticsStore::startMonitoringStatisticsStorage): Create a file system monitor to watch for file changes. (WebKit::WebResourceLoadStatisticsStore::syncWithExistingStatisticsStorageIfNeeded): Added convenience function. (WebKit::WebResourceLoadStatisticsStore::createDecoderFromDisk): Revise to read data directly so we can control file locking. * UIProcess/WebResourceLoadStatisticsStore.h: 2017-06-28 Wenson Hsieh <wenson_hsieh@apple.com> Followup to r218885: adjust for further UIKit SPI changes https://bugs.webkit.org/show_bug.cgi?id=173927 <rdar://problem/33020792> Reviewed by Tim Horton. On ToT, UIKit now invokes -_dragInteraction:item:shouldDelaySetDownAnimationWithCompletion: before the completion block of -dragInteraction:willAnimateLiftWithAnimator:session: is called. This means we now need to store the completion block in -shouldDelaySetDownAnimationWithCompletion: and wait until the UIDragAnimating completion block in -willAnimateCancelWithAnimator: before invoking it. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView cleanUpDragSourceSessionState]): Ensure that the set-down completion block is invoked when a drag session ends (e.g., if the web content process crashes). (-[WKContentView _dragInteraction:item:shouldDelaySetDownAnimationWithCompletion:]): (-[WKContentView _api_dragInteraction:item:willAnimateCancelWithAnimator:]): Source/WTF: * wtf/DispatchPtr.h: Added (moved from WebKit2) * wtf/Platform.h: Make sure USE_FILE_LOCK is enabled. Tools: * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/WebCore/FileMonitor.cpp: Added. (TestWebKitAPI::FileMonitorTest::tempFilePath): (TestWebKitAPI::handleFileModification): (TestWebKitAPI::handleFileDeletion): (TestWebKitAPI::resetTestState): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/190777@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218901 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-06-28 23:21:11 +00:00
{
}
FileMonitor should not be ref counted https://bugs.webkit.org/show_bug.cgi?id=174166 Reviewed by Brent Fulgham. Source/WebCore: Update FileMonitor to no longer be refcounted. It was previously easy to leak it because the object would ref itself in various lambdas. The client would have to explicitely call FileMonitor::stopMonitoring() which was fragile. This patch also simplifies the code and API a bit since no longer actually requires startMonitoring() / stopMonitoring() API. No new tests, covered by API tests. * platform/FileMonitor.cpp: (WebCore::FileMonitor::FileMonitor): (WebCore::FileMonitor::~FileMonitor): (WebCore::FileMonitor::create): Deleted. (WebCore::FileMonitor::startMonitoring): Deleted. (WebCore::FileMonitor::stopMonitoring): Deleted. * platform/FileMonitor.h: * platform/cocoa/FileMonitorCocoa.mm: (WebCore::FileMonitor::FileMonitor): (WebCore::FileMonitor::~FileMonitor): (WebCore::FileMonitor::startMonitoring): Deleted. (WebCore::FileMonitor::stopMonitoring): Deleted. Source/WebKit2: Update code using FileMonitor to reflect API change. * UIProcess/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::startMonitoringStatisticsStorage): (WebKit::WebResourceLoadStatisticsStore::stopMonitoringStatisticsStorage): * UIProcess/WebResourceLoadStatisticsStore.h: Tools: Update the API tests to reflect the API change. * TestWebKitAPI/Tests/WebCore/FileMonitor.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/191062@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219219 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-07-06 21:45:04 +00:00
Use "= default" to denote default constructor or destructor https://bugs.webkit.org/show_bug.cgi?id=178528 Rubber-stamped by Andy Estes. Source/WebCore: * Modules/airplay/WebKitPlaybackTargetAvailabilityEvent.h: * Modules/applepay/ApplePayError.cpp: * Modules/applepay/ApplePayPaymentAuthorizedEvent.cpp: * Modules/applepay/ApplePayPaymentMethodSelectedEvent.cpp: * Modules/applepay/ApplePaySession.cpp: * Modules/applepay/ApplePaySessionPaymentRequest.cpp: * Modules/applepay/ApplePayShippingContactSelectedEvent.cpp: * Modules/applepay/ApplePayShippingMethodSelectedEvent.cpp: * Modules/applepay/ApplePayValidateMerchantEvent.cpp: * Modules/applepay/Payment.h: * Modules/applepay/PaymentCoordinatorClient.h: * Modules/credentials/BasicCredential.cpp: * Modules/credentials/FederatedCredential.cpp: * Modules/credentials/NavigatorCredentials.cpp: * Modules/credentials/PasswordCredential.cpp: * Modules/encryptedmedia/CDMClient.h: * Modules/encryptedmedia/legacy/LegacyCDM.cpp: * Modules/encryptedmedia/legacy/LegacyCDM.h: * Modules/encryptedmedia/legacy/LegacyCDMPrivate.h: * Modules/encryptedmedia/legacy/LegacyCDMPrivateClearKey.h: * Modules/encryptedmedia/legacy/LegacyCDMPrivateMediaPlayer.h: * Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp: * Modules/encryptedmedia/legacy/WebKitMediaKeyMessageEvent.cpp: * Modules/encryptedmedia/legacy/WebKitMediaKeyNeededEvent.cpp: * Modules/entriesapi/DOMFileSystem.cpp: * Modules/entriesapi/FileSystemDirectoryReader.cpp: * Modules/entriesapi/FileSystemEntry.cpp: * Modules/fetch/FetchLoaderClient.h: * Modules/gamepad/Gamepad.cpp: * Modules/gamepad/GamepadEvent.h: * Modules/gamepad/deprecated/Gamepad.cpp: [ truncated ] Source/WebCore/PAL: * pal/Logger.h: (PAL::Logger::Observer::~Observer): Deleted. * pal/crypto/gcrypt/CryptoDigestGCrypt.cpp: * pal/system/SleepDisabler.cpp: * pal/system/SystemSleepListener.h: Canonical link: https://commits.webkit.org/194740@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223728 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-19 23:48:45 +00:00
FileMonitor::~FileMonitor() = default;
Teach ResourceLoadStatistics to recognize changes in the file system https://bugs.webkit.org/show_bug.cgi?id=173800 <rdar://problem/32937842> Reviewed by Chris Dumez. Source/WebCore: We want to support the case where multiple UI processes choose to share the same statistics file. To support this, update the ResourceLoadStatistics logic to be aware that the statistics data file might change underneath it, and to take appropriate action when it does. * WebCore.xcodeproj/project.pbxproj: Update for new sources. * WebCore/CMakeLists.txt: Update for new FileMonitor source file. * loader/ResourceLoadStatisticsStore.cpp: (WebCore::ResourceLoadStatisticsStore::clearInMemoryAndPersistent): Use the new deletion handler for the data file instead of writing out an empty file. (WebCore::ResourceLoadStatisticsStore::setDeletePersistentStoreCallback): Added. * loader/ResourceLoadStatisticsStore.h: * platform/FileMonitor.cpp: Added. (WebCore::FileMonitor::create): (WebCore::FileMonitor::FileMonitor): Register handlers and begin monitoring file. (WebCore::FileMonitor::~FileMonitor): Stop any active file monitoring. (WebCore::FileMonitor::startMonitoringPath): Stub implementation. (WebCore::FileMonitor::stopMonitoring): Ditto. * platform/FileMonitor.h: Added. * platform/FileSystem.h: Export files needed by WebKit2. Add support for O_EVTONLY Darwin file handles. * platform/Logging.h: Add 'ResourceLoadStatistics' category. * platform/cocoa/FileMonitorCocoa.mm: Added. (WebCore::FileMonitor::startMonitoringPath): Create a new VNODE type dispatch_source to receive notifications when the specified file changes. (WebCore::FileMonitor::stopMonitoring): Cancel the dispatch_source when we are done monitoring the file. * platform/posix/FileSystemPOSIX.cpp: Update 'openFile' to understand the O_EVTONLY mode of file handles (Darwin-only). Source/WebKit2: We want to support the case where multiple UI processes choose to share the same statistics file. To support this, update the ResourceLoadStatistics logic to be aware that the statistics data file might change underneath it, and to take appropriate action when it does. * UIProcess/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::setResourceLoadStatisticsEnabled): When we enable the statistics, read in the data and then watch for changes. (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver): Add a 'delete data' handler to remove the file on disk, not just write an empty store. (WebKit::WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded): Use ASCIILiteral. (WebKit::WebResourceLoadStatisticsStore::refreshFromDisk): Convenience function. (WebKit::WebResourceLoadStatisticsStore::writeStoreToDisk): Sync with any on-disk storage before writing out. (WebKit::openAndLockFile): Convenience function. (WebKit::closeAndUnlockFile): Ditto. (WebKit::WebResourceLoadStatisticsStore::writeEncoderToDisk): Revise to lock file (on platforms that support it) before writing to disk. (WebKit::WebResourceLoadStatisticsStore::deleteStoreFromDisk): Added convenience function. (WebKit::WebResourceLoadStatisticsStore::clearInMemoryData): Ditto. (WebKit::WebResourceLoadStatisticsStore::startMonitoringStatisticsStorage): Create a file system monitor to watch for file changes. (WebKit::WebResourceLoadStatisticsStore::syncWithExistingStatisticsStorageIfNeeded): Added convenience function. (WebKit::WebResourceLoadStatisticsStore::createDecoderFromDisk): Revise to read data directly so we can control file locking. * UIProcess/WebResourceLoadStatisticsStore.h: 2017-06-28 Wenson Hsieh <wenson_hsieh@apple.com> Followup to r218885: adjust for further UIKit SPI changes https://bugs.webkit.org/show_bug.cgi?id=173927 <rdar://problem/33020792> Reviewed by Tim Horton. On ToT, UIKit now invokes -_dragInteraction:item:shouldDelaySetDownAnimationWithCompletion: before the completion block of -dragInteraction:willAnimateLiftWithAnimator:session: is called. This means we now need to store the completion block in -shouldDelaySetDownAnimationWithCompletion: and wait until the UIDragAnimating completion block in -willAnimateCancelWithAnimator: before invoking it. * UIProcess/ios/WKContentViewInteraction.h: * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView cleanUpDragSourceSessionState]): Ensure that the set-down completion block is invoked when a drag session ends (e.g., if the web content process crashes). (-[WKContentView _dragInteraction:item:shouldDelaySetDownAnimationWithCompletion:]): (-[WKContentView _api_dragInteraction:item:willAnimateCancelWithAnimator:]): Source/WTF: * wtf/DispatchPtr.h: Added (moved from WebKit2) * wtf/Platform.h: Make sure USE_FILE_LOCK is enabled. Tools: * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/WebCore/FileMonitor.cpp: Added. (TestWebKitAPI::FileMonitorTest::tempFilePath): (TestWebKitAPI::handleFileModification): (TestWebKitAPI::handleFileDeletion): (TestWebKitAPI::resetTestState): (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/190777@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218901 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-06-28 23:21:11 +00:00
#endif
} // namespace WebCore