Changeset 201594 in webkit
- Timestamp:
- Jun 1, 2016, 10:47:12 PM (10 years ago)
- Location:
- trunk/Source
- Files:
-
- 10 edited
-
WTF/ChangeLog (modified) (1 diff)
-
WTF/wtf/text/WTFString.h (modified) (2 diffs)
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/dom/Document.cpp (modified) (2 diffs)
-
WebCore/dom/ScriptExecutionContext.h (modified) (1 diff)
-
WebCore/loader/DocumentLoader.cpp (modified) (1 diff)
-
WebCore/loader/WorkerThreadableLoader.cpp (modified) (1 diff)
-
WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm (modified) (1 diff)
-
WebCore/workers/WorkerGlobalScope.cpp (modified) (3 diffs)
-
WebCore/workers/WorkerMessagingProxy.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r201586 r201594 1 2016-06-01 Brady Eidson <beidson@apple.com> 2 3 Get rid of StringCapture. 4 https://bugs.webkit.org/show_bug.cgi?id=158285 5 6 Reviewed by Chris Dumez. 7 8 * wtf/text/WTFString.h: 9 (WTF::StringCapture::StringCapture): Deleted. 10 (WTF::StringCapture::string): Deleted. 11 (WTF::StringCapture::releaseString): Deleted. 12 (WTF::StringCapture::operator=): Deleted. 13 1 14 2016-06-01 Benjamin Poulain <bpoulain@apple.com> 2 15 -
trunk/Source/WTF/wtf/text/WTFString.h
r200626 r201594 689 689 private: 690 690 const char* m_characters; 691 };692 693 // For thread-safe lambda capture:694 // StringCapture stringCapture(string);695 // auto lambdaThatRunsInOtherThread = [stringCapture] { String string = stringCapture.string(); ... }696 // FIXME: Remove when we can use C++14 initialized lambda capture: [string = string.isolatedCopy()].697 class StringCapture {698 public:699 StringCapture() { }700 StringCapture(const String& string) : m_string(string) { }701 explicit StringCapture(String&& string) : m_string(string) { }702 StringCapture(const StringCapture& other) : m_string(other.m_string.isolatedCopy()) { }703 const String& string() const { return m_string; }704 String releaseString() { return WTFMove(m_string); }705 706 void operator=(const StringCapture& other) { m_string = other.m_string.isolatedCopy(); }707 708 private:709 String m_string;710 691 }; 711 692 … … 759 740 using WTF::reverseFind; 760 741 using WTF::ASCIILiteral; 761 using WTF::StringCapture;762 742 763 743 #include <wtf/text/AtomicString.h> -
trunk/Source/WebCore/ChangeLog
r201588 r201594 1 2016-06-01 Brady Eidson <beidson@apple.com> 2 3 Get rid of StringCapture. 4 https://bugs.webkit.org/show_bug.cgi?id=158285 5 6 Reviewed by Chris Dumez. 7 8 No new tests (Refactor, no behavior change). 9 10 * dom/Document.cpp: 11 (WebCore::Document::addConsoleMessage): 12 (WebCore::Document::addMessage): 13 14 * dom/ScriptExecutionContext.h: 15 (WebCore::ScriptExecutionContext::AddConsoleMessageTask::AddConsoleMessageTask): 16 17 * loader/DocumentLoader.cpp: 18 (WebCore::DocumentLoader::installContentFilterUnblockHandler): 19 20 * loader/WorkerThreadableLoader.cpp: 21 (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge): 22 23 * platform/ios/WebVideoFullscreenControllerAVKit.mm: 24 (WebVideoFullscreenControllerContext::setExternalPlayback): 25 26 * workers/WorkerGlobalScope.cpp: 27 (WebCore::WorkerGlobalScope::addConsoleMessage): 28 (WebCore::WorkerGlobalScope::addMessage): 29 30 * workers/WorkerMessagingProxy.cpp: 31 (WebCore::WorkerMessagingProxy::postExceptionToWorkerObject): 32 (WebCore::WorkerMessagingProxy::postConsoleMessageToWorkerObject): 33 1 34 2016-05-31 Darin Adler <darin@apple.com> 2 35 -
trunk/Source/WebCore/dom/Document.cpp
r201534 r201594 5334 5334 { 5335 5335 if (!isContextThread()) { 5336 postTask(AddConsoleMessageTask(source, level, StringCapture(message)));5336 postTask(AddConsoleMessageTask(source, level, message)); 5337 5337 return; 5338 5338 } … … 5345 5345 { 5346 5346 if (!isContextThread()) { 5347 postTask(AddConsoleMessageTask(source, level, StringCapture(message)));5347 postTask(AddConsoleMessageTask(source, level, message)); 5348 5348 return; 5349 5349 } -
trunk/Source/WebCore/dom/ScriptExecutionContext.h
r201518 r201594 211 211 class AddConsoleMessageTask : public Task { 212 212 public: 213 AddConsoleMessageTask(MessageSource source, MessageLevel level, const String Capture& message)214 : Task([source, level, message ](ScriptExecutionContext& context) {215 context.addConsoleMessage(source, level, message .string());213 AddConsoleMessageTask(MessageSource source, MessageLevel level, const String& message) 214 : Task([source, level, message = message.isolatedCopy()](ScriptExecutionContext& context) { 215 context.addConsoleMessage(source, level, message); 216 216 }) 217 217 { -
trunk/Source/WebCore/loader/DocumentLoader.cpp
r201354 r201594 1704 1704 if (!unblockRequestDeniedScript.isEmpty() && frame) { 1705 1705 static_assert(std::is_base_of<ThreadSafeRefCounted<Frame>, Frame>::value, "Frame must be ThreadSafeRefCounted."); 1706 StringCapture capturedScript { unblockRequestDeniedScript }; 1707 unblockHandler.wrapWithDecisionHandler([frame, capturedScript](bool unblocked) { 1706 unblockHandler.wrapWithDecisionHandler([frame = WTFMove(frame), script = unblockRequestDeniedScript.isolatedCopy()](bool unblocked) { 1708 1707 if (!unblocked) 1709 frame->script().executeScript( capturedScript.string());1708 frame->script().executeScript(script); 1710 1709 }); 1711 1710 } -
trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp
r201354 r201594 91 91 , m_taskMode(taskMode.isolatedCopy()) 92 92 { 93 auto* requestData = request.copyData().release();94 auto* optionsCopy = options.isolatedCopy().release();95 96 93 ASSERT(securityOrigin); 97 94 ASSERT(contentSecurityPolicy); 98 auto* contentSecurityPolicyCopy = std::make_unique<ContentSecurityPolicy>(*securityOrigin).release(); 95 96 auto contentSecurityPolicyCopy = std::make_unique<ContentSecurityPolicy>(*securityOrigin); 99 97 contentSecurityPolicyCopy->copyStateFrom(contentSecurityPolicy); 100 98 101 StringCapture capturedOutgoingReferrer(outgoingReferrer); 102 m_loaderProxy.postTaskToLoader([this, requestData, optionsCopy, contentSecurityPolicyCopy, capturedOutgoingReferrer](ScriptExecutionContext& context) { 99 m_loaderProxy.postTaskToLoader([this, requestData = request.copyData(), options = options.isolatedCopy(), contentSecurityPolicyCopy = WTFMove(contentSecurityPolicyCopy), outgoingReferrer = outgoingReferrer.isolatedCopy()](ScriptExecutionContext& context) mutable { 103 100 ASSERT(isMainThread()); 104 101 Document& document = downcast<Document>(context); 105 102 106 auto request = ResourceRequest::adopt(std::unique_ptr<CrossThreadResourceRequestData>(requestData)); 107 request->setHTTPReferrer(capturedOutgoingReferrer.string()); 108 109 auto options = std::unique_ptr<ThreadableLoaderOptions>(optionsCopy); 103 auto request = ResourceRequest::adopt(WTFMove(requestData)); 104 request->setHTTPReferrer(outgoingReferrer); 110 105 111 106 // FIXME: If the a site requests a local resource, then this will return a non-zero value but the sync path 112 107 // will return a 0 value. Either this should return 0 or the other code path should do a callback with 113 108 // a failure. 114 m_mainThreadLoader = DocumentThreadableLoader::create(document, *this, *request, *options, std::unique_ptr<ContentSecurityPolicy>(contentSecurityPolicyCopy));109 m_mainThreadLoader = DocumentThreadableLoader::create(document, *this, *request, *options, WTFMove(contentSecurityPolicyCopy)); 115 110 ASSERT(m_mainThreadLoader || m_loadingFinished); 116 111 }); -
trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm
r201588 r201594 435 435 { 436 436 ASSERT(WebThreadIsCurrent()); 437 RefPtr<WebVideoFullscreenControllerContext> protectedThis(this); 438 StringCapture capturedLocalizedDeviceName(localizedDeviceName); 439 dispatch_async(dispatch_get_main_queue(), [protectedThis, this, enabled, type, capturedLocalizedDeviceName] { 440 if (m_interface) 441 m_interface->setExternalPlayback(enabled, type, capturedLocalizedDeviceName.string()); 437 callOnMainThread([protectedThis = Ref<WebVideoFullscreenControllerContext>(*this), this, enabled, type, localizedDeviceName = localizedDeviceName.isolatedCopy()] { 438 if (m_interface) 439 m_interface->setExternalPlayback(enabled, type, localizedDeviceName); 442 440 }); 443 441 } -
trunk/Source/WebCore/workers/WorkerGlobalScope.cpp
r201496 r201594 254 254 { 255 255 if (!isContextThread()) { 256 postTask(AddConsoleMessageTask(message->source(), message->level(), StringCapture(message->message())));256 postTask(AddConsoleMessageTask(message->source(), message->level(), message->message())); 257 257 return; 258 258 } … … 265 265 { 266 266 if (!isContextThread()) { 267 postTask(AddConsoleMessageTask(source, level, StringCapture(message)));267 postTask(AddConsoleMessageTask(source, level, message)); 268 268 return; 269 269 } … … 276 276 { 277 277 if (!isContextThread()) { 278 postTask(AddConsoleMessageTask(source, level, StringCapture(message)));278 postTask(AddConsoleMessageTask(source, level, message)); 279 279 return; 280 280 } -
trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp
r201354 r201594 142 142 void WorkerMessagingProxy::postExceptionToWorkerObject(const String& errorMessage, int lineNumber, int columnNumber, const String& sourceURL) 143 143 { 144 StringCapture capturedErrorMessage(errorMessage); 145 StringCapture capturedSourceURL(sourceURL); 146 m_scriptExecutionContext->postTask([this, capturedErrorMessage, capturedSourceURL, lineNumber, columnNumber] (ScriptExecutionContext& context) { 144 m_scriptExecutionContext->postTask([this, errorMessage = errorMessage.isolatedCopy(), sourceURL = sourceURL.isolatedCopy(), lineNumber, columnNumber] (ScriptExecutionContext& context) { 147 145 Worker* workerObject = this->workerObject(); 148 146 if (!workerObject) … … 152 150 // This is intentionally different than the behavior in MessageWorkerTask, because terminated workers no longer deliver messages (section 4.6 of the WebWorker spec), but they do report exceptions. 153 151 154 bool errorHandled = !workerObject->dispatchEvent(ErrorEvent::create( capturedErrorMessage.string(), capturedSourceURL.string(), lineNumber, columnNumber));152 bool errorHandled = !workerObject->dispatchEvent(ErrorEvent::create(errorMessage, sourceURL, lineNumber, columnNumber)); 155 153 if (!errorHandled) 156 context.reportException( capturedErrorMessage.string(), lineNumber, columnNumber, capturedSourceURL.string(), 0);154 context.reportException(errorMessage, lineNumber, columnNumber, sourceURL, 0); 157 155 }); 158 156 } … … 160 158 void WorkerMessagingProxy::postConsoleMessageToWorkerObject(MessageSource source, MessageLevel level, const String& message, int lineNumber, int columnNumber, const String& sourceURL) 161 159 { 162 StringCapture capturedMessage(message); 163 StringCapture capturedSourceURL(sourceURL); 164 m_scriptExecutionContext->postTask([this, source, level, capturedMessage, capturedSourceURL, lineNumber, columnNumber] (ScriptExecutionContext& context) { 160 m_scriptExecutionContext->postTask([this, source, level, message = message.isolatedCopy(), sourceURL = sourceURL.isolatedCopy(), lineNumber, columnNumber] (ScriptExecutionContext& context) { 165 161 if (askedToTerminate()) 166 162 return; 167 context.addConsoleMessage(source, level, capturedMessage.string(), capturedSourceURL.string(), lineNumber, columnNumber);163 context.addConsoleMessage(source, level, message, sourceURL, lineNumber, columnNumber); 168 164 }); 169 165 }
Note:
See TracChangeset
for help on using the changeset viewer.