Changeset 263279 in webkit
- Timestamp:
- Jun 19, 2020, 12:39:08 PM (6 years ago)
- Location:
- branches/safari-610.1.17-branch
- Files:
-
- 2 added
- 15 edited
- 2 moved
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/webgl/preparation-removed-from-document-expected.txt (added)
-
LayoutTests/webgl/preparation-removed-from-document.html (added)
-
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/DirectoryFileListCreator.cpp (moved) (moved from branches/safari-610.1.17-branch/Source/WebCore/html/FileListCreator.cpp ) (5 diffs)
-
Source/WebCore/html/DirectoryFileListCreator.h (moved) (moved from branches/safari-610.1.17-branch/Source/WebCore/html/FileListCreator.h ) (1 diff)
-
Source/WebCore/html/FileInputType.cpp (modified) (3 diffs)
-
Source/WebCore/html/FileInputType.h (modified) (3 diffs)
-
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
r263238 r263279 1 2020-06-18 Alan Coon <alancoon@apple.com> 2 3 Cherry-pick r263128. rdar://problem/64492837 4 5 REGRESSION (r262643): DumpRenderTree at com.apple.WebCore: WebCore::Document::prepareCanvasesForDisplayIfNeeded 6 https://bugs.webkit.org/show_bug.cgi?id=213221 7 rdar://64260400 8 9 Reviewed by Simon Fraser. 10 11 Source/WebCore: 12 13 A Document could still be holding a pointer to an HTMLCanvasElement after the 14 canvas had been deleted because the CanvasObserver protocol was disconnected 15 too early. The fix is to explicitly clear the canvas from the Document as it 16 stops observing. 17 18 Test: webgl/preparation-removed-from-document.html 19 20 * dom/Document.cpp: 21 (WebCore::Document::prepareCanvasesForDisplayIfNeeded): Copy the HashSet to a Vector 22 just in case something weird happens to the set during iteration. 23 (WebCore::Document::clearCanvasPreparation): Remove the canvas from the list of 24 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 of 35 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-d52691b4dbfc 41 42 2020-06-16 Dean Jackson <dino@apple.com> 43 44 REGRESSION (r262643): DumpRenderTree at com.apple.WebCore: WebCore::Document::prepareCanvasesForDisplayIfNeeded 45 https://bugs.webkit.org/show_bug.cgi?id=213221 46 rdar://64260400 47 48 Reviewed by Simon Fraser. 49 50 Test that triggers a rendering on a canvas, then rips it out of 51 the document before drawing. 52 53 * webgl/preparation-removed-from-document-expected.txt: Added. 54 * webgl/preparation-removed-from-document.html: Added. 55 1 56 2020-06-15 Megan Gardner <megan_gardner@apple.com> 2 57 -
branches/safari-610.1.17-branch/Source/WebCore/ChangeLog
r263238 r263279 1 2020-06-18 Alan Coon <alancoon@apple.com> 2 3 Cherry-pick r263129. rdar://problem/64492826 4 5 FileListCreator should only be used for resolving directories 6 https://bugs.webkit.org/show_bug.cgi?id=213259 7 <rdar://problem/64375709> 8 9 Reviewed by David Kilzer. 10 11 Depending on whether directories should be resolved, FileListCreator::create would either 12 synchronously execute its completion handler then return nullptr or asynchronously dispatch 13 its completion handler then return a non-null RefPtr. Interfaces with sometimes-synchronous 14 callbacks can be hard to use correctly; e.g., r262962 fixes a problem where 15 FileInputType::m_fileListCreator was being modified in an unexpected order. 16 17 This patch makes the interface between FileInputType and FileListCreator less error-prone 18 and more explicit by renaming FileListCreator to DirectoryFileListCreator, making its job 19 solely to create directory FileLists on a background queue, and giving it an explicit start 20 member function. For non-directories, FileInputType::filesChosen now bypasses 21 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 queue 31 dispatching to DirectoryFileListCreator::start. 32 (WebCore::DirectoryFileListCreator::start): Added; moved the work queue dispatching here 33 from the ctor. 34 35 * html/DirectoryFileListCreator.h: Renamed from html/FileListCreator.h. 36 (WebCore::DirectoryFileListCreator::create): Stopped performing non-directory creation and 37 changed the return value back to Ref<>. 38 39 * html/FileInputType.cpp: 40 (WebCore::FileInputType::filesChosen): Moved most of the work done in the FileListCreator 41 completion handler to didCreateFileList. When !FileInputType::allowsDirectories, used 42 Vector::map to convert paths to a Vector<Ref<File>>, used that to create a FileList, then 43 called didCreateFileList. Otherwise, created and started a DirectoryFileListCreator that 44 calls didCreateFileList in its completion handler. 45 (WebCore::FileInputType::didCreateFileList): Added; sets the new file list and icon and 46 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-d52691b4dbfc 52 53 2020-06-16 Andy Estes <aestes@apple.com> 54 55 FileListCreator should only be used for resolving directories 56 https://bugs.webkit.org/show_bug.cgi?id=213259 57 <rdar://problem/64375709> 58 59 Reviewed by David Kilzer. 60 61 Depending on whether directories should be resolved, FileListCreator::create would either 62 synchronously execute its completion handler then return nullptr or asynchronously dispatch 63 its completion handler then return a non-null RefPtr. Interfaces with sometimes-synchronous 64 callbacks can be hard to use correctly; e.g., r262962 fixes a problem where 65 FileInputType::m_fileListCreator was being modified in an unexpected order. 66 67 This patch makes the interface between FileInputType and FileListCreator less error-prone 68 and more explicit by renaming FileListCreator to DirectoryFileListCreator, making its job 69 solely to create directory FileLists on a background queue, and giving it an explicit start 70 member function. For non-directories, FileInputType::filesChosen now bypasses 71 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 queue 81 dispatching to DirectoryFileListCreator::start. 82 (WebCore::DirectoryFileListCreator::start): Added; moved the work queue dispatching here 83 from the ctor. 84 85 * html/DirectoryFileListCreator.h: Renamed from html/FileListCreator.h. 86 (WebCore::DirectoryFileListCreator::create): Stopped performing non-directory creation and 87 changed the return value back to Ref<>. 88 89 * html/FileInputType.cpp: 90 (WebCore::FileInputType::filesChosen): Moved most of the work done in the FileListCreator 91 completion handler to didCreateFileList. When !FileInputType::allowsDirectories, used 92 Vector::map to convert paths to a Vector<Ref<File>>, used that to create a FileList, then 93 called didCreateFileList. Otherwise, created and started a DirectoryFileListCreator that 94 calls didCreateFileList in its completion handler. 95 (WebCore::FileInputType::didCreateFileList): Added; sets the new file list and icon and 96 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/64492837 103 104 REGRESSION (r262643): DumpRenderTree at com.apple.WebCore: WebCore::Document::prepareCanvasesForDisplayIfNeeded 105 https://bugs.webkit.org/show_bug.cgi?id=213221 106 rdar://64260400 107 108 Reviewed by Simon Fraser. 109 110 Source/WebCore: 111 112 A Document could still be holding a pointer to an HTMLCanvasElement after the 113 canvas had been deleted because the CanvasObserver protocol was disconnected 114 too early. The fix is to explicitly clear the canvas from the Document as it 115 stops observing. 116 117 Test: webgl/preparation-removed-from-document.html 118 119 * dom/Document.cpp: 120 (WebCore::Document::prepareCanvasesForDisplayIfNeeded): Copy the HashSet to a Vector 121 just in case something weird happens to the set during iteration. 122 (WebCore::Document::clearCanvasPreparation): Remove the canvas from the list of 123 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 of 134 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-d52691b4dbfc 140 141 2020-06-16 Dean Jackson <dino@apple.com> 142 143 REGRESSION (r262643): DumpRenderTree at com.apple.WebCore: WebCore::Document::prepareCanvasesForDisplayIfNeeded 144 https://bugs.webkit.org/show_bug.cgi?id=213221 145 rdar://64260400 146 147 Reviewed by Simon Fraser. 148 149 A Document could still be holding a pointer to an HTMLCanvasElement after the 150 canvas had been deleted because the CanvasObserver protocol was disconnected 151 too early. The fix is to explicitly clear the canvas from the Document as it 152 stops observing. 153 154 Test: webgl/preparation-removed-from-document.html 155 156 * dom/Document.cpp: 157 (WebCore::Document::prepareCanvasesForDisplayIfNeeded): Copy the HashSet to a Vector 158 just in case something weird happens to the set during iteration. 159 (WebCore::Document::clearCanvasPreparation): Remove the canvas from the list of 160 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/64492834 171 172 Web Inspector: replace completion handler with a function in interception. 173 https://bugs.webkit.org/show_bug.cgi?id=213252 174 175 Patch by Pavel Feldman <pavel.feldman@gmail.com> on 2020-06-16 176 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` essentially 180 "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-d52691b4dbfc 199 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=213252 204 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` essentially 209 "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 1 227 2020-06-15 Megan Gardner <megan_gardner@apple.com> 2 228 -
branches/safari-610.1.17-branch/Source/WebCore/Sources.txt
r263238 r263279 1135 1135 html/DateTimeInputType.cpp 1136 1136 html/DateTimeLocalInputType.cpp 1137 html/DirectoryFileListCreator.cpp 1137 1138 html/EmailInputType.cpp 1138 1139 html/EnterKeyHint.cpp 1139 1140 html/FTPDirectoryDocument.cpp 1140 html/FileListCreator.cpp1141 1141 html/FeaturePolicy.cpp 1142 1142 html/FileInputType.cpp -
branches/safari-610.1.17-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r263238 r263279 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 /* FileListCreator.h in Headers */ = {isa = PBXBuildFile; fileRef = 835D54C21F4DE53400E60671 /*FileListCreator.h */; };2434 835D54C51F4DE53800E60671 /* DirectoryFileListCreator.h in Headers */ = {isa = PBXBuildFile; fileRef = 835D54C21F4DE53400E60671 /* DirectoryFileListCreator.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 /* 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>"; };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>"; }; 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 */, 22260 22262 2ED609BA1145B07100C8684E /* DOMFormData.cpp */, 22261 22263 2ED609BB1145B07100C8684E /* DOMFormData.h */, … … 22275 22277 F55B3D891251F12D003EF269 /* FileInputType.cpp */, 22276 22278 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 */, 29995 29996 0FEAF66B23BFC39E004030DA /* ColorUtilities.h in Headers */, 29996 29997 BCDD454E1236C95C009A7985 /* ColumnInfo.h in Headers */, … … 30357 30358 2D5646B01B8F8493003C4994 /* DictionaryPopupInfo.h in Headers */, 30358 30359 FDAF19991513D131008DB0C3 /* DirectConvolver.h in Headers */, 30360 835D54C51F4DE53800E60671 /* DirectoryFileListCreator.h in Headers */, 30359 30361 F47A09D120A93A9700240FAE /* DisabledAdaptations.h in Headers */, 30360 30362 7EDAAFC919A2CCDC0034DFD1 /* DiskCacheMonitorCocoa.h in Headers */, … … 30589 30591 F55B3DBE1251F12D003EF269 /* FileInputType.h in Headers */, 30590 30592 976D6C86122B8A3D001FD1F7 /* FileList.h in Headers */, 30591 835D54C51F4DE53800E60671 /* FileListCreator.h in Headers */,30592 30593 7A09CEF11F02069B00E93BDB /* FileMonitor.h in Headers */, 30593 30594 976D6C89122B8A3D001FD1F7 /* FileReader.h in Headers */, … … 33111 33112 FE36FD1716C7826500F887C1 /* SQLTransactionStateMachine.h in Headers */, 33112 33113 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
r263238 r263279 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 : m_canvasesNeedingDisplayPreparation) {8592 for (auto* canvas : copyToVector(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 8606 8611 void Document::canvasChanged(CanvasBase& canvasBase, const FloatRect&) 8607 8612 { -
branches/safari-610.1.17-branch/Source/WebCore/dom/Document.h
r263238 r263279 1597 1597 1598 1598 void prepareCanvasesForDisplayIfNeeded(); 1599 void clearCanvasPreparation(HTMLCanvasElement*); 1599 1600 void canvasChanged(CanvasBase&, const FloatRect&) final; 1600 1601 void canvasResized(CanvasBase&) final { }; -
branches/safari-610.1.17-branch/Source/WebCore/html/DirectoryFileListCreator.cpp
r263239 r263279 25 25 26 26 #include "config.h" 27 #include " FileListCreator.h"27 #include "DirectoryFileListCreator.h" 28 28 29 29 #include "FileChooser.h" … … 35 35 namespace WebCore { 36 36 37 FileListCreator::~FileListCreator()37 DirectoryFileListCreator::~DirectoryFileListCreator() 38 38 { 39 39 ASSERT(!m_completionHandler); … … 58 58 } 59 59 60 template<FileListCreator::ShouldResolveDirectories shouldResolveDirectories>61 60 static Ref<FileList> createFileList(const Vector<FileChooserFileInfo>& paths) 62 61 { 63 62 Vector<Ref<File>> fileObjects; 64 63 for (auto& info : paths) { 65 if ( shouldResolveDirectories == FileListCreator::ShouldResolveDirectories::Yes &&FileSystem::fileIsDirectory(info.path, FileSystem::ShouldFollowSymbolicLinks::No))64 if (FileSystem::fileIsDirectory(info.path, FileSystem::ShouldFollowSymbolicLinks::No)) 66 65 appendDirectoryFiles(info.path, FileSystem::pathGetFileName(info.path), fileObjects); 67 66 else … … 71 70 } 72 71 73 RefPtr<FileListCreator> FileListCreator::create(const Vector<FileChooserFileInfo>& paths, ShouldResolveDirectories shouldResolveDirectories, CompletionHandler&& completionHandler) 72 DirectoryFileListCreator::DirectoryFileListCreator(CompletionHandler&& completionHandler) 73 : m_workQueue(WorkQueue::create("DirectoryFileListCreator Work Queue")) 74 , m_completionHandler(WTFMove(completionHandler)) 74 75 { 75 if (shouldResolveDirectories == ShouldResolveDirectories::No) {76 completionHandler(createFileList<ShouldResolveDirectories::No>(paths));77 return nullptr;78 }79 80 return adoptRef(*new FileListCreator(paths, WTFMove(completionHandler)));81 76 } 82 77 83 FileListCreator::FileListCreator(const Vector<FileChooserFileInfo>& paths, CompletionHandler&& completionHandler) 84 : m_workQueue(WorkQueue::create("FileListCreator Work Queue")) 85 , m_completionHandler(WTFMove(completionHandler)) 78 void DirectoryFileListCreator::start(const Vector<FileChooserFileInfo>& paths) 86 79 { 87 80 // Resolve directories on a background thread to avoid blocking the main thread. 88 81 m_workQueue->dispatch([this, protectedThis = makeRef(*this), paths = crossThreadCopy(paths)]() mutable { 89 auto fileList = createFileList<ShouldResolveDirectories::Yes>(paths); 90 callOnMainThread([this, protectedThis = WTFMove(protectedThis), fileList = WTFMove(fileList)]() mutable { 91 if (auto completionHandler = WTFMove(m_completionHandler)) 82 callOnMainThread([this, protectedThis = WTFMove(protectedThis), fileList = createFileList(paths)]() mutable { 83 if (auto completionHandler = std::exchange(m_completionHandler, nullptr)) 92 84 completionHandler(WTFMove(fileList)); 93 85 }); … … 95 87 } 96 88 97 void FileListCreator::cancel()89 void DirectoryFileListCreator::cancel() 98 90 { 99 91 m_completionHandler = nullptr; -
branches/safari-610.1.17-branch/Source/WebCore/html/DirectoryFileListCreator.h
r263239 r263279 37 37 class FileList; 38 38 39 class FileListCreator : public ThreadSafeRefCounted<FileListCreator> {39 class DirectoryFileListCreator : public ThreadSafeRefCounted<DirectoryFileListCreator> { 40 40 public: 41 41 using CompletionHandler = Function<void(Ref<FileList>&&)>; 42 42 43 enum class ShouldResolveDirectories { No, Yes }; 44 static RefPtr<FileListCreator> create(const Vector<FileChooserFileInfo>&, ShouldResolveDirectories, CompletionHandler&&); 43 static Ref<DirectoryFileListCreator> create(CompletionHandler&& completionHandler) 44 { 45 return adoptRef(*new DirectoryFileListCreator(WTFMove(completionHandler))); 46 } 45 47 46 ~ FileListCreator();48 ~DirectoryFileListCreator(); 47 49 50 void start(const Vector<FileChooserFileInfo>&); 48 51 void cancel(); 49 52 50 53 private: 51 FileListCreator(const Vector<FileChooserFileInfo>&,CompletionHandler&&);54 explicit DirectoryFileListCreator(CompletionHandler&&); 52 55 53 56 RefPtr<WorkQueue> m_workQueue; -
branches/safari-610.1.17-branch/Source/WebCore/html/FileInputType.cpp
r263238 r263279 25 25 #include "Chrome.h" 26 26 #include "DOMFormData.h" 27 #include "DirectoryFileListCreator.h" 27 28 #include "DragData.h" 28 29 #include "ElementChildIterator.h" … … 30 31 #include "File.h" 31 32 #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_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) 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) 419 426 return; 420 setFiles(WTFMove(fileList), icon ? RequestIcon::Yes : RequestIcon::No); 421 if (icon && !m_fileList->isEmpty() && element()) 422 iconLoaded(WTFMove(icon)); 423 m_fileListCreator = nullptr; 427 didCreateFileList(WTFMove(fileList), WTFMove(icon)); 424 428 }); 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)); 425 442 } 426 443 -
branches/safari-610.1.17-branch/Source/WebCore/html/FileInputType.h
r263238 r263279 40 40 namespace WebCore { 41 41 42 class DirectoryFileListCreator; 42 43 class DragData; 43 44 class FileList; 44 class FileListCreator;45 45 class Icon; 46 46 … … 87 87 void iconLoaded(RefPtr<Icon>&&) final; 88 88 89 void applyFileChooserSettings(const FileChooserSettings&); 90 void didCreateFileList(Ref<FileList>&&, RefPtr<Icon>&&); 89 91 void requestIcon(const Vector<String>&); 90 91 void applyFileChooserSettings(const FileChooserSettings&);92 92 93 93 bool allowsDirectories() const; … … 97 97 98 98 Ref<FileList> m_fileList; 99 RefPtr< FileListCreator> m_fileListCreator;99 RefPtr<DirectoryFileListCreator> m_directoryFileListCreator; 100 100 RefPtr<Icon> m_icon; 101 101 String m_displayString; -
branches/safari-610.1.17-branch/Source/WebCore/html/HTMLCanvasElement.cpp
r263238 r263279 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.150 149 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); 1004 1005 removeObserver(oldDocument); 1005 1006 addObserver(newDocument); … … 1010 1011 void HTMLCanvasElement::removedFromAncestor(RemovalType removalType, ContainerNode& oldParentOfRemovedTree) 1011 1012 { 1012 if (removalType.disconnectedFromDocument) 1013 if (removalType.disconnectedFromDocument) { 1014 oldParentOfRemovedTree.document().clearCanvasPreparation(this); 1013 1015 removeObserver(oldParentOfRemovedTree.document()); 1016 } 1014 1017 1015 1018 HTMLElement::removedFromAncestor(removalType, oldParentOfRemovedTree); -
branches/safari-610.1.17-branch/Source/WebCore/inspector/InspectorInstrumentation.cpp
r263238 r263279 833 833 } 834 834 835 void InspectorInstrumentation::interceptRequestImpl(InstrumentingAgents& instrumentingAgents, ResourceLoader& loader, CompletionHandler<void(const ResourceRequest&)>&& handler)835 void InspectorInstrumentation::interceptRequestImpl(InstrumentingAgents& instrumentingAgents, ResourceLoader& loader, Function<void(const ResourceRequest&)>&& handler) 836 836 { 837 837 if (auto* networkAgent = instrumentingAgents.enabledNetworkAgent()) -
branches/safari-610.1.17-branch/Source/WebCore/inspector/InspectorInstrumentation.h
r263238 r263279 53 53 #include <initializer_list> 54 54 #include <wtf/CompletionHandler.h> 55 #include <wtf/Function.h> 55 56 #include <wtf/MemoryPressureHandler.h> 56 57 #include <wtf/RefPtr.h> … … 239 240 static bool shouldInterceptRequest(const Frame&, const ResourceRequest&); 240 241 static bool shouldInterceptResponse(const Frame&, const ResourceResponse&); 241 static void interceptRequest(ResourceLoader&, CompletionHandler<void(const ResourceRequest&)>&&);242 static void interceptRequest(ResourceLoader&, Function<void(const ResourceRequest&)>&&); 242 243 static void interceptResponse(const Frame&, const ResourceResponse&, unsigned long identifier, CompletionHandler<void(const ResourceResponse&, RefPtr<SharedBuffer>)>&&); 243 244 … … 449 450 static bool shouldInterceptRequestImpl(InstrumentingAgents&, const ResourceRequest&); 450 451 static bool shouldInterceptResponseImpl(InstrumentingAgents&, const ResourceResponse&); 451 static void interceptRequestImpl(InstrumentingAgents&, ResourceLoader&, CompletionHandler<void(const ResourceRequest&)>&&);452 static void interceptRequestImpl(InstrumentingAgents&, ResourceLoader&, Function<void(const ResourceRequest&)>&&); 452 453 static void interceptResponseImpl(InstrumentingAgents&, const ResourceResponse&, unsigned long identifier, CompletionHandler<void(const ResourceResponse&, RefPtr<SharedBuffer>)>&&); 453 454 … … 1287 1288 } 1288 1289 1289 inline void InspectorInstrumentation::interceptRequest(ResourceLoader& loader, CompletionHandler<void(const ResourceRequest&)>&& handler)1290 inline void InspectorInstrumentation::interceptRequest(ResourceLoader& loader, Function<void(const ResourceRequest&)>&& handler) 1290 1291 { 1291 1292 ASSERT(InspectorInstrumentation::shouldInterceptRequest(*loader.frame(), loader.request())); -
branches/safari-610.1.17-branch/Source/WebCore/inspector/InspectorInstrumentationWebKit.cpp
r263238 r263279 41 41 } 42 42 43 void InspectorInstrumentationWebKit::interceptRequestInternal(ResourceLoader& loader, CompletionHandler<void(const ResourceRequest&)>&& handler)43 void InspectorInstrumentationWebKit::interceptRequestInternal(ResourceLoader& loader, Function<void(const ResourceRequest&)>&& handler) 44 44 { 45 45 InspectorInstrumentation::interceptRequest(loader, WTFMove(handler)); -
branches/safari-610.1.17-branch/Source/WebCore/inspector/InspectorInstrumentationWebKit.h
r263238 r263279 28 28 #include "InspectorInstrumentationPublic.h" 29 29 #include <wtf/CompletionHandler.h> 30 #include <wtf/Function.h> 30 31 31 32 namespace WebCore { … … 39 40 static bool shouldInterceptRequest(const Frame*, const ResourceRequest&); 40 41 static bool shouldInterceptResponse(const Frame*, const ResourceResponse&); 41 static void interceptRequest(ResourceLoader&, CompletionHandler<void(const ResourceRequest&)>&&);42 static void interceptRequest(ResourceLoader&, Function<void(const ResourceRequest&)>&&); 42 43 static void interceptResponse(const Frame*, const ResourceResponse&, unsigned long identifier, CompletionHandler<void(const ResourceResponse&, RefPtr<SharedBuffer>)>&&); 43 44 … … 45 46 static bool shouldInterceptRequestInternal(const Frame&, const ResourceRequest&); 46 47 static bool shouldInterceptResponseInternal(const Frame&, const ResourceResponse&); 47 static void interceptRequestInternal(ResourceLoader&, CompletionHandler<void(const ResourceRequest&)>&&);48 static void interceptRequestInternal(ResourceLoader&, Function<void(const ResourceRequest&)>&&); 48 49 static void interceptResponseInternal(const Frame&, const ResourceResponse&, unsigned long identifier, CompletionHandler<void(const ResourceResponse&, RefPtr<SharedBuffer>)>&&); 49 50 }; … … 67 68 } 68 69 69 inline void InspectorInstrumentationWebKit::interceptRequest(ResourceLoader& loader, CompletionHandler<void(const ResourceRequest&)>&& handler)70 inline void InspectorInstrumentationWebKit::interceptRequest(ResourceLoader& loader, Function<void(const ResourceRequest&)>&& handler) 70 71 { 71 72 ASSERT(InspectorInstrumentationWebKit::shouldInterceptRequest(loader.frame(), loader.request())); -
branches/safari-610.1.17-branch/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp
r263238 r263279 1115 1115 } 1116 1116 1117 void InspectorNetworkAgent::interceptRequest(ResourceLoader& loader, CompletionHandler<void(const ResourceRequest&)>&& handler)1117 void InspectorNetworkAgent::interceptRequest(ResourceLoader& loader, Function<void(const ResourceRequest&)>&& handler) 1118 1118 { 1119 1119 ASSERT(m_enabled); -
branches/safari-610.1.17-branch/Source/WebCore/inspector/agents/InspectorNetworkAgent.h
r263238 r263279 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&, CompletionHandler<void(const ResourceRequest&)>&&);128 void interceptRequest(ResourceLoader&, Function<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, CompletionHandler<void(const ResourceRequest&)>&& completionHandler)167 PendingInterceptRequest(RefPtr<ResourceLoader> loader, Function<void(const ResourceRequest&)>&& callback) 168 168 : m_loader(loader) 169 , m_completion Handler(WTFMove(completionHandler))169 , m_completionCallback(WTFMove(callback)) 170 170 { } 171 171 … … 173 173 { 174 174 if (!m_loader->reachedTerminalState()) 175 m_completion Handler(m_loader->request());175 m_completionCallback(m_loader->request()); 176 176 } 177 177 178 178 void continueWithRequest(const ResourceRequest& request) 179 179 { 180 m_completion Handler(request);180 m_completionCallback(request); 181 181 } 182 182 183 183 PendingInterceptRequest() = default; 184 184 RefPtr<ResourceLoader> m_loader; 185 CompletionHandler<void(const ResourceRequest&)> m_completionHandler;185 Function<void(const ResourceRequest&)> m_completionCallback; 186 186 }; 187 187
Note:
See TracChangeset
for help on using the changeset viewer.