Changeset 221646 in webkit


Ignore:
Timestamp:
Sep 5, 2017 4:33:49 PM (7 years ago)
Author:
Ryan Haddad
Message:

Unreviewed, rolling out r221495.

This change introduced assertion failures on El Capitan Debug
WK2.

Reverted changeset:

"Move ServiceWorkerJob from FetchLoader to ThreadableLoader."
https://bugs.webkit.org/show_bug.cgi?id=176231
http://trac.webkit.org/changeset/221495

Location:
trunk/Source/WebCore
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r221645 r221646  
     12017-09-05  Ryan Haddad  <ryanhaddad@apple.com>
     2
     3        Unreviewed, rolling out r221495.
     4
     5        This change introduced  assertion failures on El Capitan Debug
     6        WK2.
     7
     8        Reverted changeset:
     9
     10        "Move ServiceWorkerJob from FetchLoader to ThreadableLoader."
     11        https://bugs.webkit.org/show_bug.cgi?id=176231
     12        http://trac.webkit.org/changeset/221495
     13
    1142017-09-05  Chris Dumez  <cdumez@apple.com>
    215
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r221645 r221646  
    23072307                517A534E1F54A8BA00DCDC0A /* ServiceWorkerRegistrationData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517A534B1F549D4A00DCDC0A /* ServiceWorkerRegistrationData.cpp */; };
    23082308                517A534F1F54A8BA00DCDC0A /* ServiceWorkerRegistrationData.h in Headers */ = {isa = PBXBuildFile; fileRef = 517A534C1F549D4A00DCDC0A /* ServiceWorkerRegistrationData.h */; settings = {ATTRIBUTES = (Private, ); }; };
    2309                 517A53581F5889E800DCDC0A /* FetchLoaderClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4147E2B61C89912600A7E715 /* FetchLoaderClient.h */; };
    2310                 517A535A1F5889EF00DCDC0A /* FetchLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 4147E2B51C89912600A7E715 /* FetchLoader.h */; };
     2309                517A53581F5889E800DCDC0A /* FetchLoaderClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4147E2B61C89912600A7E715 /* FetchLoaderClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
     2310                517A535A1F5889EF00DCDC0A /* FetchLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 4147E2B51C89912600A7E715 /* FetchLoader.h */; settings = {ATTRIBUTES = (Private, ); }; };
    23112311                517A535B1F588A4C00DCDC0A /* FetchBodyConsumer.h in Headers */ = {isa = PBXBuildFile; fileRef = 41CF8BE51D46222000707DC9 /* FetchBodyConsumer.h */; settings = {ATTRIBUTES = (Private, ); }; };
    23122312                517A535D1F5899FE00DCDC0A /* ServiceWorkerFetchResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 517A535C1F5899F200DCDC0A /* ServiceWorkerFetchResult.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    1151911519                7CBBBCC41F560567005EFAAC /* DOMMatrix2DInit.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMMatrix2DInit.idl; sourceTree = "<group>"; };
    1152011520                7CBBBCC61F560568005EFAAC /* DOMMatrix2DInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMMatrix2DInit.h; sourceTree = "<group>"; };
    11521                 7CBBBCC81F5617C0005EFAAC /* JSDOMMatrix2DInit.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMMatrix2DInit.cpp; sourceTree = "<group>"; };
    11522                 7CBBBCC91F5617C0005EFAAC /* JSDOMMatrix2DInit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSDOMMatrix2DInit.h; sourceTree = "<group>"; };
     11521                7CBBBCC81F5617C0005EFAAC /* JSDOMMatrix2DInit.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = JSDOMMatrix2DInit.cpp; path = JSDOMMatrix2DInit.cpp; sourceTree = "<group>"; };
     11522                7CBBBCC91F5617C0005EFAAC /* JSDOMMatrix2DInit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = JSDOMMatrix2DInit.h; path = JSDOMMatrix2DInit.h; sourceTree = "<group>"; };
    1152311523                7CC2DDF81EC9415A0027B774 /* NotificationPermission.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NotificationPermission.h; sourceTree = "<group>"; };
    1152411524                7CC2DDFA1EC9415A0027B774 /* NotificationPermission.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = NotificationPermission.idl; sourceTree = "<group>"; };
  • trunk/Source/WebCore/loader/ThreadableLoader.h

    r221495 r221646  
    3838namespace WebCore {
    3939
    40 class ResourceError;
    41 class ResourceRequest;
    42 class ResourceResponse;
    43 class ScriptExecutionContext;
    44 class ThreadableLoaderClient;
     40    class ResourceError;
     41    class ResourceRequest;
     42    class ResourceResponse;
     43    class ScriptExecutionContext;
     44    class ThreadableLoaderClient;
    4545
    46 enum PreflightPolicy {
    47     ConsiderPreflight,
    48     ForcePreflight,
    49     PreventPreflight
    50 };
     46    enum PreflightPolicy {
     47        ConsiderPreflight,
     48        ForcePreflight,
     49        PreventPreflight
     50    };
    5151
    52 enum class ContentSecurityPolicyEnforcement {
    53     DoNotEnforce,
    54     EnforceChildSrcDirective,
    55     EnforceConnectSrcDirective,
    56     EnforceScriptSrcDirective,
    57 };
     52    enum class ContentSecurityPolicyEnforcement {
     53        DoNotEnforce,
     54        EnforceChildSrcDirective,
     55        EnforceConnectSrcDirective,
     56        EnforceScriptSrcDirective,
     57    };
    5858
    59 enum class ResponseFilteringPolicy {
    60     Enable,
    61     Disable,
    62 };
     59    enum class ResponseFilteringPolicy {
     60        Enable,
     61        Disable,
     62    };
    6363
    64 struct ThreadableLoaderOptions : ResourceLoaderOptions {
    65     ThreadableLoaderOptions();
    66     ThreadableLoaderOptions(const ResourceLoaderOptions&, PreflightPolicy, ContentSecurityPolicyEnforcement, String&& initiator, ResponseFilteringPolicy);
    67     ~ThreadableLoaderOptions();
     64    struct ThreadableLoaderOptions : ResourceLoaderOptions {
     65        ThreadableLoaderOptions();
     66        ThreadableLoaderOptions(const ResourceLoaderOptions&, PreflightPolicy, ContentSecurityPolicyEnforcement, String&& initiator, ResponseFilteringPolicy);
     67        ~ThreadableLoaderOptions();
    6868
    69     ThreadableLoaderOptions isolatedCopy() const;
     69        ThreadableLoaderOptions isolatedCopy() const;
    7070
    71     PreflightPolicy preflightPolicy { ConsiderPreflight };
    72     ContentSecurityPolicyEnforcement contentSecurityPolicyEnforcement { ContentSecurityPolicyEnforcement::EnforceConnectSrcDirective };
    73     String initiator; // This cannot be an AtomicString, as isolatedCopy() wouldn't create an object that's safe for passing to another thread.
    74     ResponseFilteringPolicy filteringPolicy { ResponseFilteringPolicy::Disable };
    75 };
     71        PreflightPolicy preflightPolicy { ConsiderPreflight };
     72        ContentSecurityPolicyEnforcement contentSecurityPolicyEnforcement { ContentSecurityPolicyEnforcement::EnforceConnectSrcDirective };
     73        String initiator; // This cannot be an AtomicString, as isolatedCopy() wouldn't create an object that's safe for passing to another thread.
     74        ResponseFilteringPolicy filteringPolicy { ResponseFilteringPolicy::Disable };
     75    };
    7676
    77 // Useful for doing loader operations from any thread (not threadsafe,
    78 // just able to run on threads other than the main thread).
    79 class ThreadableLoader {
    80     WTF_MAKE_NONCOPYABLE(ThreadableLoader);
    81 public:
    82     static void loadResourceSynchronously(ScriptExecutionContext&, ResourceRequest&&, ThreadableLoaderClient&, const ThreadableLoaderOptions&);
    83     static RefPtr<ThreadableLoader> create(ScriptExecutionContext&, ThreadableLoaderClient&, ResourceRequest&&, const ThreadableLoaderOptions&, String&& referrer = String());
     77    // Useful for doing loader operations from any thread (not threadsafe,
     78    // just able to run on threads other than the main thread).
     79    class ThreadableLoader {
     80        WTF_MAKE_NONCOPYABLE(ThreadableLoader);
     81    public:
     82        static void loadResourceSynchronously(ScriptExecutionContext&, ResourceRequest&&, ThreadableLoaderClient&, const ThreadableLoaderOptions&);
     83        static RefPtr<ThreadableLoader> create(ScriptExecutionContext&, ThreadableLoaderClient&, ResourceRequest&&, const ThreadableLoaderOptions&, String&& referrer = String());
    8484
    85     virtual void cancel() = 0;
    86     void ref() { refThreadableLoader(); }
    87     void deref() { derefThreadableLoader(); }
     85        virtual void cancel() = 0;
     86        void ref() { refThreadableLoader(); }
     87        void deref() { derefThreadableLoader(); }
    8888
    89     static void logError(ScriptExecutionContext&, const ResourceError&, const String&);
     89        static void logError(ScriptExecutionContext&, const ResourceError&, const String&);
    9090
    91 protected:
    92     ThreadableLoader() { }
    93     virtual ~ThreadableLoader() { }
    94     virtual void refThreadableLoader() = 0;
    95     virtual void derefThreadableLoader() = 0;
    96 };
     91    protected:
     92        ThreadableLoader() { }
     93        virtual ~ThreadableLoader() { }
     94        virtual void refThreadableLoader() = 0;
     95        virtual void derefThreadableLoader() = 0;
     96    };
    9797
    9898} // namespace WebCore
  • trunk/Source/WebCore/loader/ThreadableLoaderClient.h

    r221495 r221646  
    3333namespace WebCore {
    3434
    35 class ResourceError;
    36 class ResourceResponse;
    37 class ResourceTiming;
     35    class ResourceError;
     36    class ResourceResponse;
     37    class ResourceTiming;
    3838
    39 class ThreadableLoaderClient {
    40     WTF_MAKE_NONCOPYABLE(ThreadableLoaderClient);
    41 public:
    42     virtual void didSendData(unsigned long long /*bytesSent*/, unsigned long long /*totalBytesToBeSent*/) { }
     39    class ThreadableLoaderClient {
     40        WTF_MAKE_NONCOPYABLE(ThreadableLoaderClient); WTF_MAKE_FAST_ALLOCATED;
     41    public:
     42        virtual void didSendData(unsigned long long /*bytesSent*/, unsigned long long /*totalBytesToBeSent*/) { }
    4343
    44     virtual void didReceiveResponse(unsigned long /*identifier*/, const ResourceResponse&) { }
    45     virtual void didReceiveData(const char*, int /*dataLength*/) { }
    46     virtual void didFinishLoading(unsigned long /*identifier*/) { }
    47     virtual void didFail(const ResourceError&) { }
    48     virtual void didFinishTiming(const ResourceTiming&) { }
     44        virtual void didReceiveResponse(unsigned long /*identifier*/, const ResourceResponse&) { }
     45        virtual void didReceiveData(const char*, int /*dataLength*/) { }
     46        virtual void didFinishLoading(unsigned long /*identifier*/) { }
     47        virtual void didFail(const ResourceError&) { }
     48        virtual void didFinishTiming(const ResourceTiming&) { }
    4949
    50 protected:
    51     ThreadableLoaderClient() { }
    52     virtual ~ThreadableLoaderClient() { }
    53 };
     50    protected:
     51        ThreadableLoaderClient() { }
     52        virtual ~ThreadableLoaderClient() { }
     53    };
    5454
    5555} // namespace WebCore
  • trunk/Source/WebCore/workers/service/ServiceWorkerJob.cpp

    r221495 r221646  
    8383    ASSERT(!m_completed);
    8484
     85    m_fetchLoader = std::make_unique<FetchLoader>(*this, nullptr);
     86
    8587    // FIXME: This Fetch request is set up incorrectly and without proper care.
    8688    // The ServiceWorkers spec specifics many details to apply here.
    8789
    88     auto request = ResourceRequest { m_jobData.scriptURL };
     90    auto fetchHeaders = FetchHeaders::create();
    8991    auto referrer = m_jobData.clientCreationURL.string();
    90     m_loader = ThreadableLoader::create(context, *this, WTFMove(request), { }, WTFMove(referrer));
     92    auto fetchRequest = FetchRequest::create(context, std::nullopt, WTFMove(fetchHeaders), { m_jobData.scriptURL }, { }, WTFMove(referrer));
     93
     94    m_fetchLoader->start(context, fetchRequest);
    9195}
    9296
    93 void ServiceWorkerJob::didReceiveResponse(unsigned long, const ResourceResponse& response)
     97void ServiceWorkerJob::didReceiveResponse(const ResourceResponse& response)
    9498{
    9599    ASSERT(currentThread() == m_creationThread);
    96100    ASSERT(!m_completed);
    97     ASSERT(m_loader);
     101    ASSERT(m_fetchLoader);
    98102    ASSERT(!m_scriptData);
    99103
     
    106110}
    107111
    108 void ServiceWorkerJob::didReceiveData(const char* data, int size)
     112void ServiceWorkerJob::didReceiveData(const char* data, size_t size)
    109113{
    110114    ASSERT(currentThread() == m_creationThread);
    111115    ASSERT(!m_completed);
    112     ASSERT(m_loader);
     116    ASSERT(m_fetchLoader);
    113117
    114118    if (!m_scriptData)
     
    118122}
    119123
    120 void ServiceWorkerJob::didFinishLoading(unsigned long)
     124void ServiceWorkerJob::didSucceed()
    121125{
    122126    ASSERT(currentThread() == m_creationThread);
    123127    ASSERT(!m_completed);
    124     ASSERT(m_loader);
     128    ASSERT(m_fetchLoader);
    125129
    126130    if (!m_scriptData)
    127131        m_scriptData = SharedBuffer::create();
    128132    m_client->jobFinishedLoadingScript(*this, WTFMove(*m_scriptData));
    129     m_loader = nullptr;
     133    m_fetchLoader = nullptr;
    130134}
    131135
     
    134138    ASSERT(currentThread() == m_creationThread);
    135139    ASSERT(!m_completed);
    136     ASSERT(m_loader);
     140    ASSERT(m_fetchLoader);
    137141
    138142    m_client->jobFailedLoadingScript(*this, error);
    139     m_loader = nullptr;
     143    m_fetchLoader = nullptr;
    140144}
    141145
  • trunk/Source/WebCore/workers/service/ServiceWorkerJob.h

    r221495 r221646  
    2828#if ENABLE(SERVICE_WORKER)
    2929
     30#include "FetchLoader.h"
     31#include "FetchLoaderClient.h"
    3032#include "ResourceResponse.h"
    3133#include "ServiceWorkerJobClient.h"
    3234#include "ServiceWorkerJobData.h"
    33 #include "ThreadableLoader.h"
    34 #include "ThreadableLoaderClient.h"
    3535#include <wtf/RefPtr.h>
    3636#include <wtf/RunLoop.h>
     
    4646struct ServiceWorkerRegistrationData;
    4747
    48 class ServiceWorkerJob : public ThreadSafeRefCounted<ServiceWorkerJob>, public ThreadableLoaderClient {
     48class ServiceWorkerJob : public ThreadSafeRefCounted<ServiceWorkerJob>, public FetchLoaderClient {
    4949public:
    5050    static Ref<ServiceWorkerJob> create(ServiceWorkerJobClient& client, Ref<DeferredPromise>&& promise, ServiceWorkerJobData&& jobData)
     
    6767    ServiceWorkerJob(ServiceWorkerJobClient&, Ref<DeferredPromise>&&, ServiceWorkerJobData&&);
    6868
    69     // ThreadableLoaderClient
    70     void didReceiveResponse(unsigned long identifier, const ResourceResponse&) final;
    71     void didReceiveData(const char* data, int length) final;
    72     void didFinishLoading(unsigned long identifier) final;
     69    // FetchLoaderClient
     70    void didReceiveResponse(const ResourceResponse&) final;
     71    void didReceiveData(const char*, size_t) final;
     72    void didSucceed() final;
    7373    void didFail(const ResourceError&) final;
    7474
     
    8080
    8181    Ref<RunLoop> m_runLoop { RunLoop::current() };
    82     RefPtr<ThreadableLoader> m_loader;
     82    std::unique_ptr<FetchLoader> m_fetchLoader;
    8383    ResourceResponse m_lastResponse;
    8484    std::optional<Ref<SharedBuffer>> m_scriptData;
  • trunk/Source/WebCore/workers/service/server/SWClientConnection.cpp

    r221495 r221646  
    3232#include "ServiceWorkerFetchResult.h"
    3333#include "ServiceWorkerJobData.h"
    34 #include "SharedBuffer.h"
    3534
    3635namespace WebCore {
Note: See TracChangeset for help on using the changeset viewer.