Changeset 221646 in webkit
- Timestamp:
- Sep 5, 2017 4:33:49 PM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r221645 r221646 1 2017-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 1 14 2017-09-05 Chris Dumez <cdumez@apple.com> 2 15 -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r221645 r221646 2307 2307 517A534E1F54A8BA00DCDC0A /* ServiceWorkerRegistrationData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517A534B1F549D4A00DCDC0A /* ServiceWorkerRegistrationData.cpp */; }; 2308 2308 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, ); }; }; 2311 2311 517A535B1F588A4C00DCDC0A /* FetchBodyConsumer.h in Headers */ = {isa = PBXBuildFile; fileRef = 41CF8BE51D46222000707DC9 /* FetchBodyConsumer.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2312 2312 517A535D1F5899FE00DCDC0A /* ServiceWorkerFetchResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 517A535C1F5899F200DCDC0A /* ServiceWorkerFetchResult.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 11519 11519 7CBBBCC41F560567005EFAAC /* DOMMatrix2DInit.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMMatrix2DInit.idl; sourceTree = "<group>"; }; 11520 11520 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>"; }; 11523 11523 7CC2DDF81EC9415A0027B774 /* NotificationPermission.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NotificationPermission.h; sourceTree = "<group>"; }; 11524 11524 7CC2DDFA1EC9415A0027B774 /* NotificationPermission.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = NotificationPermission.idl; sourceTree = "<group>"; }; -
trunk/Source/WebCore/loader/ThreadableLoader.h
r221495 r221646 38 38 namespace WebCore { 39 39 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; 45 45 46 enum PreflightPolicy {47 ConsiderPreflight,48 ForcePreflight,49 PreventPreflight50 };46 enum PreflightPolicy { 47 ConsiderPreflight, 48 ForcePreflight, 49 PreventPreflight 50 }; 51 51 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 }; 58 58 59 enum class ResponseFilteringPolicy {60 Enable,61 Disable,62 };59 enum class ResponseFilteringPolicy { 60 Enable, 61 Disable, 62 }; 63 63 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(); 68 68 69 ThreadableLoaderOptions isolatedCopy() const;69 ThreadableLoaderOptions isolatedCopy() const; 70 70 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 }; 76 76 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()); 84 84 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(); } 88 88 89 static void logError(ScriptExecutionContext&, const ResourceError&, const String&);89 static void logError(ScriptExecutionContext&, const ResourceError&, const String&); 90 90 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 }; 97 97 98 98 } // namespace WebCore -
trunk/Source/WebCore/loader/ThreadableLoaderClient.h
r221495 r221646 33 33 namespace WebCore { 34 34 35 class ResourceError;36 class ResourceResponse;37 class ResourceTiming;35 class ResourceError; 36 class ResourceResponse; 37 class ResourceTiming; 38 38 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*/) { } 43 43 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&) { } 49 49 50 protected:51 ThreadableLoaderClient() { }52 virtual ~ThreadableLoaderClient() { }53 };50 protected: 51 ThreadableLoaderClient() { } 52 virtual ~ThreadableLoaderClient() { } 53 }; 54 54 55 55 } // namespace WebCore -
trunk/Source/WebCore/workers/service/ServiceWorkerJob.cpp
r221495 r221646 83 83 ASSERT(!m_completed); 84 84 85 m_fetchLoader = std::make_unique<FetchLoader>(*this, nullptr); 86 85 87 // FIXME: This Fetch request is set up incorrectly and without proper care. 86 88 // The ServiceWorkers spec specifics many details to apply here. 87 89 88 auto request = ResourceRequest { m_jobData.scriptURL };90 auto fetchHeaders = FetchHeaders::create(); 89 91 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); 91 95 } 92 96 93 void ServiceWorkerJob::didReceiveResponse( unsigned long,const ResourceResponse& response)97 void ServiceWorkerJob::didReceiveResponse(const ResourceResponse& response) 94 98 { 95 99 ASSERT(currentThread() == m_creationThread); 96 100 ASSERT(!m_completed); 97 ASSERT(m_ loader);101 ASSERT(m_fetchLoader); 98 102 ASSERT(!m_scriptData); 99 103 … … 106 110 } 107 111 108 void ServiceWorkerJob::didReceiveData(const char* data, int size)112 void ServiceWorkerJob::didReceiveData(const char* data, size_t size) 109 113 { 110 114 ASSERT(currentThread() == m_creationThread); 111 115 ASSERT(!m_completed); 112 ASSERT(m_ loader);116 ASSERT(m_fetchLoader); 113 117 114 118 if (!m_scriptData) … … 118 122 } 119 123 120 void ServiceWorkerJob::did FinishLoading(unsigned long)124 void ServiceWorkerJob::didSucceed() 121 125 { 122 126 ASSERT(currentThread() == m_creationThread); 123 127 ASSERT(!m_completed); 124 ASSERT(m_ loader);128 ASSERT(m_fetchLoader); 125 129 126 130 if (!m_scriptData) 127 131 m_scriptData = SharedBuffer::create(); 128 132 m_client->jobFinishedLoadingScript(*this, WTFMove(*m_scriptData)); 129 m_ loader = nullptr;133 m_fetchLoader = nullptr; 130 134 } 131 135 … … 134 138 ASSERT(currentThread() == m_creationThread); 135 139 ASSERT(!m_completed); 136 ASSERT(m_ loader);140 ASSERT(m_fetchLoader); 137 141 138 142 m_client->jobFailedLoadingScript(*this, error); 139 m_ loader = nullptr;143 m_fetchLoader = nullptr; 140 144 } 141 145 -
trunk/Source/WebCore/workers/service/ServiceWorkerJob.h
r221495 r221646 28 28 #if ENABLE(SERVICE_WORKER) 29 29 30 #include "FetchLoader.h" 31 #include "FetchLoaderClient.h" 30 32 #include "ResourceResponse.h" 31 33 #include "ServiceWorkerJobClient.h" 32 34 #include "ServiceWorkerJobData.h" 33 #include "ThreadableLoader.h"34 #include "ThreadableLoaderClient.h"35 35 #include <wtf/RefPtr.h> 36 36 #include <wtf/RunLoop.h> … … 46 46 struct ServiceWorkerRegistrationData; 47 47 48 class ServiceWorkerJob : public ThreadSafeRefCounted<ServiceWorkerJob>, public ThreadableLoaderClient {48 class ServiceWorkerJob : public ThreadSafeRefCounted<ServiceWorkerJob>, public FetchLoaderClient { 49 49 public: 50 50 static Ref<ServiceWorkerJob> create(ServiceWorkerJobClient& client, Ref<DeferredPromise>&& promise, ServiceWorkerJobData&& jobData) … … 67 67 ServiceWorkerJob(ServiceWorkerJobClient&, Ref<DeferredPromise>&&, ServiceWorkerJobData&&); 68 68 69 // ThreadableLoaderClient70 void didReceiveResponse( unsigned long identifier,const ResourceResponse&) final;71 void didReceiveData(const char* data, int length) final;72 void did FinishLoading(unsigned long identifier) final;69 // FetchLoaderClient 70 void didReceiveResponse(const ResourceResponse&) final; 71 void didReceiveData(const char*, size_t) final; 72 void didSucceed() final; 73 73 void didFail(const ResourceError&) final; 74 74 … … 80 80 81 81 Ref<RunLoop> m_runLoop { RunLoop::current() }; 82 RefPtr<ThreadableLoader> m_loader;82 std::unique_ptr<FetchLoader> m_fetchLoader; 83 83 ResourceResponse m_lastResponse; 84 84 std::optional<Ref<SharedBuffer>> m_scriptData; -
trunk/Source/WebCore/workers/service/server/SWClientConnection.cpp
r221495 r221646 32 32 #include "ServiceWorkerFetchResult.h" 33 33 #include "ServiceWorkerJobData.h" 34 #include "SharedBuffer.h"35 34 36 35 namespace WebCore {
Note: See TracChangeset
for help on using the changeset viewer.