Changeset 263238 in webkit
- Timestamp:
- Jun 18, 2020, 3:53:36 PM (6 years ago)
- Location:
- branches/safari-610.1.17-branch
- Files:
-
- 2 deleted
- 15 edited
- 2 moved
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/webgl/preparation-removed-from-document-expected.txt (deleted)
-
LayoutTests/webgl/preparation-removed-from-document.html (deleted)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/Sources.txt (modified) (1 diff)
-
Source/WebCore/WebCore.xcodeproj/project.pbxproj (modified) (8 diffs)
-
Source/WebCore/dom/Document.cpp (modified) (2 diffs)
-
Source/WebCore/dom/Document.h (modified) (1 diff)
-
Source/WebCore/html/FileInputType.cpp (modified) (3 diffs)
-
Source/WebCore/html/FileInputType.h (modified) (3 diffs)
-
Source/WebCore/html/FileListCreator.cpp (moved) (moved from branches/safari-610.1.17-branch/Source/WebCore/html/DirectoryFileListCreator.cpp ) (5 diffs)
-
Source/WebCore/html/FileListCreator.h (moved) (moved from branches/safari-610.1.17-branch/Source/WebCore/html/DirectoryFileListCreator.h ) (1 diff)
-
Source/WebCore/html/HTMLCanvasElement.cpp (modified) (3 diffs)
-
Source/WebCore/inspector/InspectorInstrumentation.cpp (modified) (1 diff)
-
Source/WebCore/inspector/InspectorInstrumentation.h (modified) (4 diffs)
-
Source/WebCore/inspector/InspectorInstrumentationWebKit.cpp (modified) (1 diff)
-
Source/WebCore/inspector/InspectorInstrumentationWebKit.h (modified) (4 diffs)
-
Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp (modified) (1 diff)
-
Source/WebCore/inspector/agents/InspectorNetworkAgent.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-610.1.17-branch/LayoutTests/ChangeLog
r263213 r263238 1 2020-06-18 Alan Coon <alancoon@apple.com>2 3 Cherry-pick r263128. rdar://problem/644928374 5 REGRESSION (r262643): DumpRenderTree at com.apple.WebCore: WebCore::Document::prepareCanvasesForDisplayIfNeeded6 https://bugs.webkit.org/show_bug.cgi?id=2132217 rdar://642604008 9 Reviewed by Simon Fraser.10 11 Source/WebCore:12 13 A Document could still be holding a pointer to an HTMLCanvasElement after the14 canvas had been deleted because the CanvasObserver protocol was disconnected15 too early. The fix is to explicitly clear the canvas from the Document as it16 stops observing.17 18 Test: webgl/preparation-removed-from-document.html19 20 * dom/Document.cpp:21 (WebCore::Document::prepareCanvasesForDisplayIfNeeded): Copy the HashSet to a Vector22 just in case something weird happens to the set during iteration.23 (WebCore::Document::clearCanvasPreparation): Remove the canvas from the list of24 of elements that need preparation.25 * dom/Document.h: Add the new clearCanvasPreparation method.26 27 * html/HTMLCanvasElement.cpp:28 (WebCore::HTMLCanvasElement::~HTMLCanvasElement): Clear the document.29 (WebCore::HTMLCanvasElement::didMoveToNewDocument): Ditto.30 (WebCore::HTMLCanvasElement::removedFromAncestor): Ditto.31 32 LayoutTests:33 34 Test that triggers a rendering on a canvas, then rips it out of35 the document before drawing.36 37 * webgl/preparation-removed-from-document-expected.txt: Added.38 * webgl/preparation-removed-from-document.html: Added.39 40 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@263128 268f45cc-cd09-0410-ab3c-d52691b4dbfc41 42 2020-06-16 Dean Jackson <dino@apple.com>43 44 REGRESSION (r262643): DumpRenderTree at com.apple.WebCore: WebCore::Document::prepareCanvasesForDisplayIfNeeded45 https://bugs.webkit.org/show_bug.cgi?id=21322146 rdar://6426040047 48 Reviewed by Simon Fraser.49 50 Test that triggers a rendering on a canvas, then rips it out of51 the document before drawing.52 53 * webgl/preparation-removed-from-document-expected.txt: Added.54 * webgl/preparation-removed-from-document.html: Added.55 56 1 2020-06-15 Megan Gardner <megan_gardner@apple.com> 57 2 -
branches/safari-610.1.17-branch/Source/WebCore/ChangeLog
r263214 r263238 1 2020-06-18 Alan Coon <alancoon@apple.com>2 3 Cherry-pick r263129. rdar://problem/644928264 5 FileListCreator should only be used for resolving directories6 https://bugs.webkit.org/show_bug.cgi?id=2132597 <rdar://problem/64375709>8 9 Reviewed by David Kilzer.10 11 Depending on whether directories should be resolved, FileListCreator::create would either12 synchronously execute its completion handler then return nullptr or asynchronously dispatch13 its completion handler then return a non-null RefPtr. Interfaces with sometimes-synchronous14 callbacks can be hard to use correctly; e.g., r262962 fixes a problem where15 FileInputType::m_fileListCreator was being modified in an unexpected order.16 17 This patch makes the interface between FileInputType and FileListCreator less error-prone18 and more explicit by renaming FileListCreator to DirectoryFileListCreator, making its job19 solely to create directory FileLists on a background queue, and giving it an explicit start20 member function. For non-directories, FileInputType::filesChosen now bypasses21 DirectoryFileListCreator and directly converts from Vector<FileChooserFileInfo> to FileList.22 23 Covered by existing tests.24 25 * Sources.txt:26 * WebCore.xcodeproj/project.pbxproj:27 28 * html/DirectoryFileListCreator.cpp: Renamed from html/FileListCreator.cpp.29 (WebCore::createFileList): Removed the template and ShouldResolveDirectories parameter.30 (WebCore::DirectoryFileListCreator::DirectoryFileListCreator): Moved the work queue31 dispatching to DirectoryFileListCreator::start.32 (WebCore::DirectoryFileListCreator::start): Added; moved the work queue dispatching here33 from the ctor.34 35 * html/DirectoryFileListCreator.h: Renamed from html/FileListCreator.h.36 (WebCore::DirectoryFileListCreator::create): Stopped performing non-directory creation and37 changed the return value back to Ref<>.38 39 * html/FileInputType.cpp:40 (WebCore::FileInputType::filesChosen): Moved most of the work done in the FileListCreator41 completion handler to didCreateFileList. When !FileInputType::allowsDirectories, used42 Vector::map to convert paths to a Vector<Ref<File>>, used that to create a FileList, then43 called didCreateFileList. Otherwise, created and started a DirectoryFileListCreator that44 calls didCreateFileList in its completion handler.45 (WebCore::FileInputType::didCreateFileList): Added; sets the new file list and icon and46 clears m_directoryFileListCreator.47 48 * html/FileInputType.h:49 50 51 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@263129 268f45cc-cd09-0410-ab3c-d52691b4dbfc52 53 2020-06-16 Andy Estes <aestes@apple.com>54 55 FileListCreator should only be used for resolving directories56 https://bugs.webkit.org/show_bug.cgi?id=21325957 <rdar://problem/64375709>58 59 Reviewed by David Kilzer.60 61 Depending on whether directories should be resolved, FileListCreator::create would either62 synchronously execute its completion handler then return nullptr or asynchronously dispatch63 its completion handler then return a non-null RefPtr. Interfaces with sometimes-synchronous64 callbacks can be hard to use correctly; e.g., r262962 fixes a problem where65 FileInputType::m_fileListCreator was being modified in an unexpected order.66 67 This patch makes the interface between FileInputType and FileListCreator less error-prone68 and more explicit by renaming FileListCreator to DirectoryFileListCreator, making its job69 solely to create directory FileLists on a background queue, and giving it an explicit start70 member function. For non-directories, FileInputType::filesChosen now bypasses71 DirectoryFileListCreator and directly converts from Vector<FileChooserFileInfo> to FileList.72 73 Covered by existing tests.74 75 * Sources.txt:76 * WebCore.xcodeproj/project.pbxproj:77 78 * html/DirectoryFileListCreator.cpp: Renamed from html/FileListCreator.cpp.79 (WebCore::createFileList): Removed the template and ShouldResolveDirectories parameter.80 (WebCore::DirectoryFileListCreator::DirectoryFileListCreator): Moved the work queue81 dispatching to DirectoryFileListCreator::start.82 (WebCore::DirectoryFileListCreator::start): Added; moved the work queue dispatching here83 from the ctor.84 85 * html/DirectoryFileListCreator.h: Renamed from html/FileListCreator.h.86 (WebCore::DirectoryFileListCreator::create): Stopped performing non-directory creation and87 changed the return value back to Ref<>.88 89 * html/FileInputType.cpp:90 (WebCore::FileInputType::filesChosen): Moved most of the work done in the FileListCreator91 completion handler to didCreateFileList. When !FileInputType::allowsDirectories, used92 Vector::map to convert paths to a Vector<Ref<File>>, used that to create a FileList, then93 called didCreateFileList. Otherwise, created and started a DirectoryFileListCreator that94 calls didCreateFileList in its completion handler.95 (WebCore::FileInputType::didCreateFileList): Added; sets the new file list and icon and96 clears m_directoryFileListCreator.97 98 * html/FileInputType.h:99 100 2020-06-18 Alan Coon <alancoon@apple.com>101 102 Cherry-pick r263128. rdar://problem/64492837103 104 REGRESSION (r262643): DumpRenderTree at com.apple.WebCore: WebCore::Document::prepareCanvasesForDisplayIfNeeded105 https://bugs.webkit.org/show_bug.cgi?id=213221106 rdar://64260400107 108 Reviewed by Simon Fraser.109 110 Source/WebCore:111 112 A Document could still be holding a pointer to an HTMLCanvasElement after the113 canvas had been deleted because the CanvasObserver protocol was disconnected114 too early. The fix is to explicitly clear the canvas from the Document as it115 stops observing.116 117 Test: webgl/preparation-removed-from-document.html118 119 * dom/Document.cpp:120 (WebCore::Document::prepareCanvasesForDisplayIfNeeded): Copy the HashSet to a Vector121 just in case something weird happens to the set during iteration.122 (WebCore::Document::clearCanvasPreparation): Remove the canvas from the list of123 of elements that need preparation.124 * dom/Document.h: Add the new clearCanvasPreparation method.125 126 * html/HTMLCanvasElement.cpp:127 (WebCore::HTMLCanvasElement::~HTMLCanvasElement): Clear the document.128 (WebCore::HTMLCanvasElement::didMoveToNewDocument): Ditto.129 (WebCore::HTMLCanvasElement::removedFromAncestor): Ditto.130 131 LayoutTests:132 133 Test that triggers a rendering on a canvas, then rips it out of134 the document before drawing.135 136 * webgl/preparation-removed-from-document-expected.txt: Added.137 * webgl/preparation-removed-from-document.html: Added.138 139 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@263128 268f45cc-cd09-0410-ab3c-d52691b4dbfc140 141 2020-06-16 Dean Jackson <dino@apple.com>142 143 REGRESSION (r262643): DumpRenderTree at com.apple.WebCore: WebCore::Document::prepareCanvasesForDisplayIfNeeded144 https://bugs.webkit.org/show_bug.cgi?id=213221145 rdar://64260400146 147 Reviewed by Simon Fraser.148 149 A Document could still be holding a pointer to an HTMLCanvasElement after the150 canvas had been deleted because the CanvasObserver protocol was disconnected151 too early. The fix is to explicitly clear the canvas from the Document as it152 stops observing.153 154 Test: webgl/preparation-removed-from-document.html155 156 * dom/Document.cpp:157 (WebCore::Document::prepareCanvasesForDisplayIfNeeded): Copy the HashSet to a Vector158 just in case something weird happens to the set during iteration.159 (WebCore::Document::clearCanvasPreparation): Remove the canvas from the list of160 of elements that need preparation.161 * dom/Document.h: Add the new clearCanvasPreparation method.162 163 * html/HTMLCanvasElement.cpp:164 (WebCore::HTMLCanvasElement::~HTMLCanvasElement): Clear the document.165 (WebCore::HTMLCanvasElement::didMoveToNewDocument): Ditto.166 (WebCore::HTMLCanvasElement::removedFromAncestor): Ditto.167 168 2020-06-18 Alan Coon <alancoon@apple.com>169 170 Cherry-pick r263119. rdar://problem/64492834171 172 Web Inspector: replace completion handler with a function in interception.173 https://bugs.webkit.org/show_bug.cgi?id=213252174 175 Patch by Pavel Feldman <pavel.feldman@gmail.com> on 2020-06-16176 Reviewed by Devin Rousso.177 178 Don't use a `CompletionHandler` as it asserts that it's been called when it's destroyed.179 Both `Network.interceptRequestWithResponse` and `Network.interceptRequestWithError` essentially180 "skip" the network pipeline, so the `CompletionHandler` is not invoked for those commands.181 182 * inspector/InspectorInstrumentation.cpp:183 (WebCore::InspectorInstrumentation::interceptRequestImpl):184 * inspector/InspectorInstrumentation.h:185 (WebCore::InspectorInstrumentation::interceptRequest):186 * inspector/InspectorInstrumentationWebKit.cpp:187 (WebCore::InspectorInstrumentationWebKit::interceptRequestInternal):188 * inspector/InspectorInstrumentationWebKit.h:189 (WebCore::InspectorInstrumentationWebKit::interceptRequest):190 * inspector/agents/InspectorNetworkAgent.cpp:191 (WebCore::InspectorNetworkAgent::interceptRequest):192 (WebCore::InspectorNetworkAgent::interceptRequestWithResponse):193 (WebCore::InspectorNetworkAgent::interceptRequestWithError):194 * inspector/agents/InspectorNetworkAgent.h:195 (WebCore::InspectorNetworkAgent::PendingInterceptRequest::PendingInterceptRequest):196 (WebCore::InspectorNetworkAgent::PendingInterceptRequest::continueAsHandled):197 198 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@263119 268f45cc-cd09-0410-ab3c-d52691b4dbfc199 200 2020-06-16 Pavel Feldman <pavel.feldman@gmail.com>201 202 Web Inspector: replace completion handler with a function in interception.203 https://bugs.webkit.org/show_bug.cgi?id=213252204 205 Reviewed by Devin Rousso.206 207 Don't use a `CompletionHandler` as it asserts that it's been called when it's destroyed.208 Both `Network.interceptRequestWithResponse` and `Network.interceptRequestWithError` essentially209 "skip" the network pipeline, so the `CompletionHandler` is not invoked for those commands.210 211 * inspector/InspectorInstrumentation.cpp:212 (WebCore::InspectorInstrumentation::interceptRequestImpl):213 * inspector/InspectorInstrumentation.h:214 (WebCore::InspectorInstrumentation::interceptRequest):215 * inspector/InspectorInstrumentationWebKit.cpp:216 (WebCore::InspectorInstrumentationWebKit::interceptRequestInternal):217 * inspector/InspectorInstrumentationWebKit.h:218 (WebCore::InspectorInstrumentationWebKit::interceptRequest):219 * inspector/agents/InspectorNetworkAgent.cpp:220 (WebCore::InspectorNetworkAgent::interceptRequest):221 (WebCore::InspectorNetworkAgent::interceptRequestWithResponse):222 (WebCore::InspectorNetworkAgent::interceptRequestWithError):223 * inspector/agents/InspectorNetworkAgent.h:224 (WebCore::InspectorNetworkAgent::PendingInterceptRequest::PendingInterceptRequest):225 (WebCore::InspectorNetworkAgent::PendingInterceptRequest::continueAsHandled):226 227 1 2020-06-15 Megan Gardner <megan_gardner@apple.com> 228 2 -
branches/safari-610.1.17-branch/Source/WebCore/Sources.txt
r263214 r263238 1135 1135 html/DateTimeInputType.cpp 1136 1136 html/DateTimeLocalInputType.cpp 1137 html/DirectoryFileListCreator.cpp1138 1137 html/EmailInputType.cpp 1139 1138 html/EnterKeyHint.cpp 1140 1139 html/FTPDirectoryDocument.cpp 1140 html/FileListCreator.cpp 1141 1141 html/FeaturePolicy.cpp 1142 1142 html/FileInputType.cpp -
branches/safari-610.1.17-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r263214 r263238 2432 2432 835D2D781F5F1FBD00141DED /* HTMLInputElementEntriesAPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 835D2D751F5F1FB800141DED /* HTMLInputElementEntriesAPI.h */; }; 2433 2433 835D363719FF6193004C93AB /* StyleBuilderCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = 835D363619FF6193004C93AB /* StyleBuilderCustom.h */; }; 2434 835D54C51F4DE53800E60671 /* DirectoryFileListCreator.h in Headers */ = {isa = PBXBuildFile; fileRef = 835D54C21F4DE53400E60671 /* DirectoryFileListCreator.h */; };2434 835D54C51F4DE53800E60671 /* FileListCreator.h in Headers */ = {isa = PBXBuildFile; fileRef = 835D54C21F4DE53400E60671 /* FileListCreator.h */; }; 2435 2435 8362E8C120CEF9CB00245886 /* ShouldTreatAsContinuingLoad.h in Headers */ = {isa = PBXBuildFile; fileRef = 8362E8BF20CEF9CB00245886 /* ShouldTreatAsContinuingLoad.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2436 2436 836589DE1F54A76900DC31F4 /* JSFileSystemDirectoryReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 836589D91F54A76200DC31F4 /* JSFileSystemDirectoryReader.h */; }; … … 10359 10359 835D2D761F5F1FB800141DED /* HTMLInputElementEntriesAPI.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLInputElementEntriesAPI.cpp; sourceTree = "<group>"; }; 10360 10360 835D363619FF6193004C93AB /* StyleBuilderCustom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleBuilderCustom.h; sourceTree = "<group>"; }; 10361 835D54C11F4DE53400E60671 /* DirectoryFileListCreator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DirectoryFileListCreator.cpp; sourceTree = "<group>"; };10362 835D54C21F4DE53400E60671 /* DirectoryFileListCreator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirectoryFileListCreator.h; sourceTree = "<group>"; };10361 835D54C11F4DE53400E60671 /* FileListCreator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileListCreator.cpp; sourceTree = "<group>"; }; 10362 835D54C21F4DE53400E60671 /* FileListCreator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileListCreator.h; sourceTree = "<group>"; }; 10363 10363 835F8B261D2D90BA00E408EC /* Slotable.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Slotable.idl; sourceTree = "<group>"; }; 10364 10364 8362E8BF20CEF9CB00245886 /* ShouldTreatAsContinuingLoad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShouldTreatAsContinuingLoad.h; sourceTree = "<group>"; }; … … 22258 22258 F55B3D851251F12D003EF269 /* DateTimeLocalInputType.cpp */, 22259 22259 F55B3D861251F12D003EF269 /* DateTimeLocalInputType.h */, 22260 835D54C11F4DE53400E60671 /* DirectoryFileListCreator.cpp */,22261 835D54C21F4DE53400E60671 /* DirectoryFileListCreator.h */,22262 22260 2ED609BA1145B07100C8684E /* DOMFormData.cpp */, 22263 22261 2ED609BB1145B07100C8684E /* DOMFormData.h */, … … 22277 22275 F55B3D891251F12D003EF269 /* FileInputType.cpp */, 22278 22276 F55B3D8A1251F12D003EF269 /* FileInputType.h */, 22277 835D54C11F4DE53400E60671 /* FileListCreator.cpp */, 22278 835D54C21F4DE53400E60671 /* FileListCreator.h */, 22279 22279 4A0DA2FC129B241900AB61E1 /* FormAssociatedElement.cpp */, 22280 22280 4A0DA2FD129B241900AB61E1 /* FormAssociatedElement.h */, … … 29993 29993 7CAC6AE9247F082F00E61D59 /* ColorMatrix.h in Headers */, 29994 29994 9382DF5810A8D5C900925652 /* ColorSpace.h in Headers */, 29995 7C029C6E2493C8F800268204 /* ColorTypes.h in Headers */,29996 29995 0FEAF66B23BFC39E004030DA /* ColorUtilities.h in Headers */, 29997 29996 BCDD454E1236C95C009A7985 /* ColumnInfo.h in Headers */, … … 30358 30357 2D5646B01B8F8493003C4994 /* DictionaryPopupInfo.h in Headers */, 30359 30358 FDAF19991513D131008DB0C3 /* DirectConvolver.h in Headers */, 30360 835D54C51F4DE53800E60671 /* DirectoryFileListCreator.h in Headers */,30361 30359 F47A09D120A93A9700240FAE /* DisabledAdaptations.h in Headers */, 30362 30360 7EDAAFC919A2CCDC0034DFD1 /* DiskCacheMonitorCocoa.h in Headers */, … … 30591 30589 F55B3DBE1251F12D003EF269 /* FileInputType.h in Headers */, 30592 30590 976D6C86122B8A3D001FD1F7 /* FileList.h in Headers */, 30591 835D54C51F4DE53800E60671 /* FileListCreator.h in Headers */, 30593 30592 7A09CEF11F02069B00E93BDB /* FileMonitor.h in Headers */, 30594 30593 976D6C89122B8A3D001FD1F7 /* FileReader.h in Headers */, … … 33112 33111 FE36FD1716C7826500F887C1 /* SQLTransactionStateMachine.h in Headers */, 33113 33112 1A2E6E5A0CC55213004A2062 /* SQLValue.h in Headers */, 33113 7C029C6E2493C8F800268204 /* ColorTypes.h in Headers */, 33114 33114 93F1996308245E59001E9ABC /* SSLKeyGenerator.h in Headers */, 33115 33115 26B999911803B3C900D01121 /* StackAllocator.h in Headers */, -
branches/safari-610.1.17-branch/Source/WebCore/dom/Document.cpp
r263213 r263238 8590 8590 // Some canvas contexts need to do work when rendering has finished but 8591 8591 // before their content is composited. 8592 for (auto* canvas : copyToVector(m_canvasesNeedingDisplayPreparation)) {8592 for (auto* canvas : m_canvasesNeedingDisplayPreparation) { 8593 8593 // However, if they are not in the document body, then they won't 8594 8594 // be composited and thus don't need preparation. Unfortunately they … … 8604 8604 } 8605 8605 8606 void Document::clearCanvasPreparation(HTMLCanvasElement* canvas)8607 {8608 m_canvasesNeedingDisplayPreparation.remove(canvas);8609 }8610 8611 8606 void Document::canvasChanged(CanvasBase& canvasBase, const FloatRect&) 8612 8607 { -
branches/safari-610.1.17-branch/Source/WebCore/dom/Document.h
r263213 r263238 1597 1597 1598 1598 void prepareCanvasesForDisplayIfNeeded(); 1599 void clearCanvasPreparation(HTMLCanvasElement*);1600 1599 void canvasChanged(CanvasBase&, const FloatRect&) final; 1601 1600 void canvasResized(CanvasBase&) final { }; -
branches/safari-610.1.17-branch/Source/WebCore/html/FileInputType.cpp
r263214 r263238 25 25 #include "Chrome.h" 26 26 #include "DOMFormData.h" 27 #include "DirectoryFileListCreator.h"28 27 #include "DragData.h" 29 28 #include "ElementChildIterator.h" … … 31 30 #include "File.h" 32 31 #include "FileList.h" 32 #include "FileListCreator.h" 33 33 #include "FormController.h" 34 34 #include "Frame.h" … … 410 410 m_displayString = displayString; 411 411 412 if (m_directoryFileListCreator) 413 m_directoryFileListCreator->cancel(); 414 415 if (!allowsDirectories()) { 416 auto files = paths.map([](auto& fileInfo) { 417 return File::create(fileInfo.path, fileInfo.displayName); 418 }); 419 didCreateFileList(FileList::create(WTFMove(files)), icon); 420 return; 421 } 422 423 m_directoryFileListCreator = DirectoryFileListCreator::create([this, weakThis = makeWeakPtr(*this), icon = makeRefPtr(icon)](Ref<FileList>&& fileList) mutable { 424 ASSERT(isMainThread()); 425 if (!weakThis) 412 if (m_fileListCreator) 413 m_fileListCreator->cancel(); 414 415 auto shouldResolveDirectories = allowsDirectories() ? FileListCreator::ShouldResolveDirectories::Yes : FileListCreator::ShouldResolveDirectories::No; 416 m_fileListCreator = FileListCreator::create(paths, shouldResolveDirectories, [this, weakThis = makeWeakPtr(*this), icon = makeRefPtr(icon)](Ref<FileList>&& fileList) mutable { 417 auto protectedThis = makeRefPtr(weakThis.get()); 418 if (!protectedThis) 426 419 return; 427 didCreateFileList(WTFMove(fileList), WTFMove(icon)); 420 setFiles(WTFMove(fileList), icon ? RequestIcon::Yes : RequestIcon::No); 421 if (icon && !m_fileList->isEmpty() && element()) 422 iconLoaded(WTFMove(icon)); 423 m_fileListCreator = nullptr; 428 424 }); 429 m_directoryFileListCreator->start(paths);430 }431 432 void FileInputType::didCreateFileList(Ref<FileList>&& fileList, RefPtr<Icon>&& icon)433 {434 auto protectedThis = makeRef(*this);435 436 ASSERT(!allowsDirectories() || m_directoryFileListCreator);437 m_directoryFileListCreator = nullptr;438 439 setFiles(WTFMove(fileList), icon ? RequestIcon::Yes : RequestIcon::No);440 if (icon && !m_fileList->isEmpty() && element())441 iconLoaded(WTFMove(icon));442 425 } 443 426 -
branches/safari-610.1.17-branch/Source/WebCore/html/FileInputType.h
r263214 r263238 40 40 namespace WebCore { 41 41 42 class DirectoryFileListCreator;43 42 class DragData; 44 43 class FileList; 44 class FileListCreator; 45 45 class Icon; 46 46 … … 87 87 void iconLoaded(RefPtr<Icon>&&) final; 88 88 89 void requestIcon(const Vector<String>&); 90 89 91 void applyFileChooserSettings(const FileChooserSettings&); 90 void didCreateFileList(Ref<FileList>&&, RefPtr<Icon>&&);91 void requestIcon(const Vector<String>&);92 92 93 93 bool allowsDirectories() const; … … 97 97 98 98 Ref<FileList> m_fileList; 99 RefPtr< DirectoryFileListCreator> m_directoryFileListCreator;99 RefPtr<FileListCreator> m_fileListCreator; 100 100 RefPtr<Icon> m_icon; 101 101 String m_displayString; -
branches/safari-610.1.17-branch/Source/WebCore/html/FileListCreator.cpp
r263214 r263238 25 25 26 26 #include "config.h" 27 #include " DirectoryFileListCreator.h"27 #include "FileListCreator.h" 28 28 29 29 #include "FileChooser.h" … … 35 35 namespace WebCore { 36 36 37 DirectoryFileListCreator::~DirectoryFileListCreator()37 FileListCreator::~FileListCreator() 38 38 { 39 39 ASSERT(!m_completionHandler); … … 58 58 } 59 59 60 template<FileListCreator::ShouldResolveDirectories shouldResolveDirectories> 60 61 static Ref<FileList> createFileList(const Vector<FileChooserFileInfo>& paths) 61 62 { 62 63 Vector<Ref<File>> fileObjects; 63 64 for (auto& info : paths) { 64 if ( FileSystem::fileIsDirectory(info.path, FileSystem::ShouldFollowSymbolicLinks::No))65 if (shouldResolveDirectories == FileListCreator::ShouldResolveDirectories::Yes && FileSystem::fileIsDirectory(info.path, FileSystem::ShouldFollowSymbolicLinks::No)) 65 66 appendDirectoryFiles(info.path, FileSystem::pathGetFileName(info.path), fileObjects); 66 67 else … … 70 71 } 71 72 72 DirectoryFileListCreator::DirectoryFileListCreator(CompletionHandler&& completionHandler) 73 : m_workQueue(WorkQueue::create("DirectoryFileListCreator Work Queue")) 74 , m_completionHandler(WTFMove(completionHandler)) 73 RefPtr<FileListCreator> FileListCreator::create(const Vector<FileChooserFileInfo>& paths, ShouldResolveDirectories shouldResolveDirectories, CompletionHandler&& completionHandler) 75 74 { 75 if (shouldResolveDirectories == ShouldResolveDirectories::No) { 76 completionHandler(createFileList<ShouldResolveDirectories::No>(paths)); 77 return nullptr; 78 } 79 80 return adoptRef(*new FileListCreator(paths, WTFMove(completionHandler))); 76 81 } 77 82 78 void DirectoryFileListCreator::start(const Vector<FileChooserFileInfo>& paths) 83 FileListCreator::FileListCreator(const Vector<FileChooserFileInfo>& paths, CompletionHandler&& completionHandler) 84 : m_workQueue(WorkQueue::create("FileListCreator Work Queue")) 85 , m_completionHandler(WTFMove(completionHandler)) 79 86 { 80 87 // Resolve directories on a background thread to avoid blocking the main thread. 81 88 m_workQueue->dispatch([this, protectedThis = makeRef(*this), paths = crossThreadCopy(paths)]() mutable { 82 callOnMainThread([this, protectedThis = WTFMove(protectedThis), fileList = createFileList(paths)]() mutable { 83 if (auto completionHandler = std::exchange(m_completionHandler, nullptr)) 89 auto fileList = createFileList<ShouldResolveDirectories::Yes>(paths); 90 callOnMainThread([this, protectedThis = WTFMove(protectedThis), fileList = WTFMove(fileList)]() mutable { 91 if (auto completionHandler = WTFMove(m_completionHandler)) 84 92 completionHandler(WTFMove(fileList)); 85 93 }); … … 87 95 } 88 96 89 void DirectoryFileListCreator::cancel()97 void FileListCreator::cancel() 90 98 { 91 99 m_completionHandler = nullptr; -
branches/safari-610.1.17-branch/Source/WebCore/html/FileListCreator.h
r263214 r263238 37 37 class FileList; 38 38 39 class DirectoryFileListCreator : public ThreadSafeRefCounted<DirectoryFileListCreator> {39 class FileListCreator : public ThreadSafeRefCounted<FileListCreator> { 40 40 public: 41 41 using CompletionHandler = Function<void(Ref<FileList>&&)>; 42 42 43 static Ref<DirectoryFileListCreator> create(CompletionHandler&& completionHandler) 44 { 45 return adoptRef(*new DirectoryFileListCreator(WTFMove(completionHandler))); 46 } 43 enum class ShouldResolveDirectories { No, Yes }; 44 static RefPtr<FileListCreator> create(const Vector<FileChooserFileInfo>&, ShouldResolveDirectories, CompletionHandler&&); 47 45 48 ~ DirectoryFileListCreator();46 ~FileListCreator(); 49 47 50 void start(const Vector<FileChooserFileInfo>&);51 48 void cancel(); 52 49 53 50 private: 54 explicit DirectoryFileListCreator(CompletionHandler&&);51 FileListCreator(const Vector<FileChooserFileInfo>&, CompletionHandler&&); 55 52 56 53 RefPtr<WorkQueue> m_workQueue; -
branches/safari-610.1.17-branch/Source/WebCore/html/HTMLCanvasElement.cpp
r263213 r263238 147 147 // downcasts the CanvasBase object to HTMLCanvasElement. That invokes virtual methods, which should be 148 148 // avoided in destructors, but works as long as it's done before HTMLCanvasElement destructs completely. 149 // This will also cause the document to remove itself as an observer. 149 150 notifyObserversCanvasDestroyed(); 150 document().clearCanvasPreparation(this);151 151 152 152 m_context = nullptr; // Ensure this goes away before the ImageBuffer. … … 1002 1002 void HTMLCanvasElement::didMoveToNewDocument(Document& oldDocument, Document& newDocument) 1003 1003 { 1004 oldDocument.clearCanvasPreparation(this);1005 1004 removeObserver(oldDocument); 1006 1005 addObserver(newDocument); … … 1011 1010 void HTMLCanvasElement::removedFromAncestor(RemovalType removalType, ContainerNode& oldParentOfRemovedTree) 1012 1011 { 1013 if (removalType.disconnectedFromDocument) { 1014 oldParentOfRemovedTree.document().clearCanvasPreparation(this); 1012 if (removalType.disconnectedFromDocument) 1015 1013 removeObserver(oldParentOfRemovedTree.document()); 1016 }1017 1014 1018 1015 HTMLElement::removedFromAncestor(removalType, oldParentOfRemovedTree); -
branches/safari-610.1.17-branch/Source/WebCore/inspector/InspectorInstrumentation.cpp
r263212 r263238 833 833 } 834 834 835 void InspectorInstrumentation::interceptRequestImpl(InstrumentingAgents& instrumentingAgents, ResourceLoader& loader, Function<void(const ResourceRequest&)>&& handler)835 void InspectorInstrumentation::interceptRequestImpl(InstrumentingAgents& instrumentingAgents, ResourceLoader& loader, CompletionHandler<void(const ResourceRequest&)>&& handler) 836 836 { 837 837 if (auto* networkAgent = instrumentingAgents.enabledNetworkAgent()) -
branches/safari-610.1.17-branch/Source/WebCore/inspector/InspectorInstrumentation.h
r263212 r263238 53 53 #include <initializer_list> 54 54 #include <wtf/CompletionHandler.h> 55 #include <wtf/Function.h>56 55 #include <wtf/MemoryPressureHandler.h> 57 56 #include <wtf/RefPtr.h> … … 240 239 static bool shouldInterceptRequest(const Frame&, const ResourceRequest&); 241 240 static bool shouldInterceptResponse(const Frame&, const ResourceResponse&); 242 static void interceptRequest(ResourceLoader&, Function<void(const ResourceRequest&)>&&);241 static void interceptRequest(ResourceLoader&, CompletionHandler<void(const ResourceRequest&)>&&); 243 242 static void interceptResponse(const Frame&, const ResourceResponse&, unsigned long identifier, CompletionHandler<void(const ResourceResponse&, RefPtr<SharedBuffer>)>&&); 244 243 … … 450 449 static bool shouldInterceptRequestImpl(InstrumentingAgents&, const ResourceRequest&); 451 450 static bool shouldInterceptResponseImpl(InstrumentingAgents&, const ResourceResponse&); 452 static void interceptRequestImpl(InstrumentingAgents&, ResourceLoader&, Function<void(const ResourceRequest&)>&&);451 static void interceptRequestImpl(InstrumentingAgents&, ResourceLoader&, CompletionHandler<void(const ResourceRequest&)>&&); 453 452 static void interceptResponseImpl(InstrumentingAgents&, const ResourceResponse&, unsigned long identifier, CompletionHandler<void(const ResourceResponse&, RefPtr<SharedBuffer>)>&&); 454 453 … … 1288 1287 } 1289 1288 1290 inline void InspectorInstrumentation::interceptRequest(ResourceLoader& loader, Function<void(const ResourceRequest&)>&& handler)1289 inline void InspectorInstrumentation::interceptRequest(ResourceLoader& loader, CompletionHandler<void(const ResourceRequest&)>&& handler) 1291 1290 { 1292 1291 ASSERT(InspectorInstrumentation::shouldInterceptRequest(*loader.frame(), loader.request())); -
branches/safari-610.1.17-branch/Source/WebCore/inspector/InspectorInstrumentationWebKit.cpp
r263212 r263238 41 41 } 42 42 43 void InspectorInstrumentationWebKit::interceptRequestInternal(ResourceLoader& loader, Function<void(const ResourceRequest&)>&& handler)43 void InspectorInstrumentationWebKit::interceptRequestInternal(ResourceLoader& loader, CompletionHandler<void(const ResourceRequest&)>&& handler) 44 44 { 45 45 InspectorInstrumentation::interceptRequest(loader, WTFMove(handler)); -
branches/safari-610.1.17-branch/Source/WebCore/inspector/InspectorInstrumentationWebKit.h
r263212 r263238 28 28 #include "InspectorInstrumentationPublic.h" 29 29 #include <wtf/CompletionHandler.h> 30 #include <wtf/Function.h>31 30 32 31 namespace WebCore { … … 40 39 static bool shouldInterceptRequest(const Frame*, const ResourceRequest&); 41 40 static bool shouldInterceptResponse(const Frame*, const ResourceResponse&); 42 static void interceptRequest(ResourceLoader&, Function<void(const ResourceRequest&)>&&);41 static void interceptRequest(ResourceLoader&, CompletionHandler<void(const ResourceRequest&)>&&); 43 42 static void interceptResponse(const Frame*, const ResourceResponse&, unsigned long identifier, CompletionHandler<void(const ResourceResponse&, RefPtr<SharedBuffer>)>&&); 44 43 … … 46 45 static bool shouldInterceptRequestInternal(const Frame&, const ResourceRequest&); 47 46 static bool shouldInterceptResponseInternal(const Frame&, const ResourceResponse&); 48 static void interceptRequestInternal(ResourceLoader&, Function<void(const ResourceRequest&)>&&);47 static void interceptRequestInternal(ResourceLoader&, CompletionHandler<void(const ResourceRequest&)>&&); 49 48 static void interceptResponseInternal(const Frame&, const ResourceResponse&, unsigned long identifier, CompletionHandler<void(const ResourceResponse&, RefPtr<SharedBuffer>)>&&); 50 49 }; … … 68 67 } 69 68 70 inline void InspectorInstrumentationWebKit::interceptRequest(ResourceLoader& loader, Function<void(const ResourceRequest&)>&& handler)69 inline void InspectorInstrumentationWebKit::interceptRequest(ResourceLoader& loader, CompletionHandler<void(const ResourceRequest&)>&& handler) 71 70 { 72 71 ASSERT(InspectorInstrumentationWebKit::shouldInterceptRequest(loader.frame(), loader.request())); -
branches/safari-610.1.17-branch/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp
r263212 r263238 1115 1115 } 1116 1116 1117 void InspectorNetworkAgent::interceptRequest(ResourceLoader& loader, Function<void(const ResourceRequest&)>&& handler)1117 void InspectorNetworkAgent::interceptRequest(ResourceLoader& loader, CompletionHandler<void(const ResourceRequest&)>&& handler) 1118 1118 { 1119 1119 ASSERT(m_enabled); -
branches/safari-610.1.17-branch/Source/WebCore/inspector/agents/InspectorNetworkAgent.h
r263212 r263238 126 126 bool shouldInterceptResponse(const ResourceResponse&); 127 127 void interceptResponse(const ResourceResponse&, unsigned long identifier, CompletionHandler<void(const ResourceResponse&, RefPtr<SharedBuffer>)>&&); 128 void interceptRequest(ResourceLoader&, Function<void(const ResourceRequest&)>&&);128 void interceptRequest(ResourceLoader&, CompletionHandler<void(const ResourceRequest&)>&&); 129 129 130 130 void searchOtherRequests(const JSC::Yarr::RegularExpression&, RefPtr<JSON::ArrayOf<Inspector::Protocol::Page::SearchResult>>&); … … 165 165 WTF_MAKE_FAST_ALLOCATED; 166 166 public: 167 PendingInterceptRequest(RefPtr<ResourceLoader> loader, Function<void(const ResourceRequest&)>&& callback)167 PendingInterceptRequest(RefPtr<ResourceLoader> loader, CompletionHandler<void(const ResourceRequest&)>&& completionHandler) 168 168 : m_loader(loader) 169 , m_completion Callback(WTFMove(callback))169 , m_completionHandler(WTFMove(completionHandler)) 170 170 { } 171 171 … … 173 173 { 174 174 if (!m_loader->reachedTerminalState()) 175 m_completion Callback(m_loader->request());175 m_completionHandler(m_loader->request()); 176 176 } 177 177 178 178 void continueWithRequest(const ResourceRequest& request) 179 179 { 180 m_completion Callback(request);180 m_completionHandler(request); 181 181 } 182 182 183 183 PendingInterceptRequest() = default; 184 184 RefPtr<ResourceLoader> m_loader; 185 Function<void(const ResourceRequest&)> m_completionCallback;185 CompletionHandler<void(const ResourceRequest&)> m_completionHandler; 186 186 }; 187 187
Note:
See TracChangeset
for help on using the changeset viewer.