Changeset 248808 in webkit


Ignore:
Timestamp:
Aug 16, 2019 6:04:53 PM (5 years ago)
Author:
Chris Dumez
Message:

LocalStorageDatabaseTracker does not need to subclass ThreadSafeRefCounted
https://bugs.webkit.org/show_bug.cgi?id=200825

Reviewed by Alex Christensen.

Source/WebKit:

LocalStorageDatabaseTracker does not need to subclass ThreadSafeRefCounted. It is currently always
ref'd / deref'd from the com.apple.WebKit.WebStorage serial WorkQueue, save from inside
LocalStorageDatabaseTracker::platformMaybeExcludeFromBackup() on iOS. However, it is probably
not a good idea to set FileSystem metadata from the main thread in platformMaybeExcludeFromBackup()
anyway.

Note that I had to get rid of an old linked-on-after check since those are currently only safe
to do on the main thread. I cleared this with Brady. It has been a while since we've shipped this
behavior now and apps have had a chance to update.

  • NetworkProcess/WebStorage/LocalStorageDatabaseTracker.cpp:

(WebKit::LocalStorageDatabaseTracker::databasePath const):

  • NetworkProcess/WebStorage/LocalStorageDatabaseTracker.h:
  • NetworkProcess/WebStorage/ios/LocalStorageDatabaseTrackerIOS.mm:

(WebKit::LocalStorageDatabaseTracker::platformMaybeExcludeFromBackup const):

  • UIProcess/Cocoa/VersionChecks.h:

Source/WebKitLegacy/mac:

  • Misc/WebKitVersionChecks.h:
  • Storage/WebStorageManager.mm:

(WebKitInitializeStorageIfNecessary):

Location:
trunk/Source
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r248804 r248808  
     12019-08-16  Chris Dumez  <cdumez@apple.com>
     2
     3        LocalStorageDatabaseTracker does not need to subclass ThreadSafeRefCounted
     4        https://bugs.webkit.org/show_bug.cgi?id=200825
     5
     6        Reviewed by Alex Christensen.
     7
     8        LocalStorageDatabaseTracker does not need to subclass ThreadSafeRefCounted. It is currently always
     9        ref'd / deref'd from the com.apple.WebKit.WebStorage serial WorkQueue, save from inside
     10        LocalStorageDatabaseTracker::platformMaybeExcludeFromBackup() on iOS. However, it is probably
     11        not a good idea to set FileSystem metadata from the main thread in platformMaybeExcludeFromBackup()
     12        anyway.
     13
     14        Note that I had to get rid of an old linked-on-after check since those are currently only safe
     15        to do on the main thread. I cleared this with Brady. It has been a while since we've shipped this
     16        behavior now and apps have had a chance to update.
     17
     18        * NetworkProcess/WebStorage/LocalStorageDatabaseTracker.cpp:
     19        (WebKit::LocalStorageDatabaseTracker::databasePath const):
     20        * NetworkProcess/WebStorage/LocalStorageDatabaseTracker.h:
     21        * NetworkProcess/WebStorage/ios/LocalStorageDatabaseTrackerIOS.mm:
     22        (WebKit::LocalStorageDatabaseTracker::platformMaybeExcludeFromBackup const):
     23        * UIProcess/Cocoa/VersionChecks.h:
     24
    1252019-08-16  Chris Dumez  <cdumez@apple.com>
    226
  • trunk/Source/WebKit/NetworkProcess/WebStorage/LocalStorageDatabaseTracker.cpp

    r248779 r248808  
    161161
    162162#if PLATFORM(IOS_FAMILY)
    163     RunLoop::main().dispatch([this, protectedThis = makeRef(*this)]() mutable {
    164         platformMaybeExcludeFromBackup();
    165     });
     163    platformMaybeExcludeFromBackup();
    166164#endif
    167165
  • trunk/Source/WebKit/NetworkProcess/WebStorage/LocalStorageDatabaseTracker.h

    r248779 r248808  
    2828#include <WebCore/SecurityOriginData.h>
    2929#include <wtf/Markable.h>
    30 #include <wtf/RefPtr.h>
    31 #include <wtf/ThreadSafeRefCounted.h>
     30#include <wtf/RefCounted.h>
    3231#include <wtf/WallTime.h>
    3332#include <wtf/WorkQueue.h>
     
    3635namespace WebKit {
    3736
    38 class LocalStorageDatabaseTracker : public ThreadSafeRefCounted<LocalStorageDatabaseTracker> {
     37class LocalStorageDatabaseTracker : public RefCounted<LocalStorageDatabaseTracker> {
    3938public:
    4039    static Ref<LocalStorageDatabaseTracker> create(String&& localStorageDirectory);
  • trunk/Source/WebKit/NetworkProcess/WebStorage/ios/LocalStorageDatabaseTrackerIOS.mm

    r247250 r248808  
    3535void LocalStorageDatabaseTracker::platformMaybeExcludeFromBackup() const
    3636{
     37    ASSERT(!RunLoop::isMain());
    3738    if (m_hasExcludedFromBackup)
    3839        return;
     
    4041    m_hasExcludedFromBackup = true;
    4142
    42     if (linkedOnOrAfter(SDKVersion::FirstToExcludeLocalStorageFromBackup))
    43         [[NSURL fileURLWithPath:(NSString *)localStorageDirectory() isDirectory:YES] setResourceValue:@YES forKey:NSURLIsExcludedFromBackupKey error:nil];
     43    [[NSURL fileURLWithPath:(NSString *)localStorageDirectory() isDirectory:YES] setResourceValue:@YES forKey:NSURLIsExcludedFromBackupKey error:nil];
    4444}
    4545
  • trunk/Source/WebKit/UIProcess/Cocoa/VersionChecks.h

    r247793 r248808  
    6666    FirstWithMediaTypesRequiringUserActionForPlayback = DYLD_IOS_VERSION_10_0,
    6767    FirstWithExceptionsForDuplicateCompletionHandlerCalls = DYLD_IOS_VERSION_11_0,
    68     FirstToExcludeLocalStorageFromBackup = DYLD_IOS_VERSION_11_0,
    6968    FirstWithExpiredOnlyReloadBehavior = DYLD_IOS_VERSION_11_0,
    7069    FirstThatDisallowsSettingAnyXHRHeaderFromFileURLs = DYLD_IOS_VERSION_11_3,
  • trunk/Source/WebKitLegacy/mac/ChangeLog

    r248784 r248808  
     12019-08-16  Chris Dumez  <cdumez@apple.com>
     2
     3        LocalStorageDatabaseTracker does not need to subclass ThreadSafeRefCounted
     4        https://bugs.webkit.org/show_bug.cgi?id=200825
     5
     6        Reviewed by Alex Christensen.
     7
     8        * Misc/WebKitVersionChecks.h:
     9        * Storage/WebStorageManager.mm:
     10        (WebKitInitializeStorageIfNecessary):
     11
    1122019-08-16  Ryosuke Niwa  <rniwa@webkit.org>
    213
  • trunk/Source/WebKitLegacy/mac/Misc/WebKitVersionChecks.h

    r237266 r248808  
    7575enum class SDKVersion : uint32_t {
    7676#if PLATFORM(IOS_FAMILY)
    77     FirstToExcludeLocalStorageFromBackup = DYLD_IOS_VERSION_11_0,
    7877    FirstThatDefaultsToPassiveTouchListenersOnDocument = DYLD_IOS_VERSION_11_3,
    7978#else
  • trunk/Source/WebKitLegacy/mac/Storage/WebStorageManager.mm

    r237266 r248808  
    140140
    141141#if PLATFORM(IOS_FAMILY)
    142     if (linkedOnOrAfter(SDKVersion::FirstToExcludeLocalStorageFromBackup))
    143         [[NSURL fileURLWithPath:storagePath] setResourceValue:@YES forKey:NSURLIsExcludedFromBackupKey error:nil];
     142    [[NSURL fileURLWithPath:storagePath] setResourceValue:@YES forKey:NSURLIsExcludedFromBackupKey error:nil];
    144143#endif
    145144
Note: See TracChangeset for help on using the changeset viewer.