Changeset 250782 in webkit
- Timestamp:
- Oct 7, 2019 11:58:23 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r250781 r250782 1 2019-10-07 Chris Dumez <cdumez@apple.com> 2 3 PendingImageBitmap should not prevent entering the back/forward cache 4 https://bugs.webkit.org/show_bug.cgi?id=202585 5 6 Reviewed by Tim Horton. 7 8 Add layout test coverage. 9 10 * TestExpectations: 11 * fast/history/page-cache-createImageBitmap-expected.txt: Added. 12 * fast/history/page-cache-createImageBitmap.html: Added. 13 1 14 2019-10-07 Antoine Quint <graouts@apple.com> 2 15 -
trunk/LayoutTests/TestExpectations
r250772 r250782 263 263 imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-protocol-setter-non-broken-weird.html [ DumpJSConsoleLogInStdErr ] 264 264 imported/w3c/web-platform-tests/service-workers/service-worker/fetch-cors-xhr.https.html [ DumpJSConsoleLogInStdErr ] 265 fast/history/page-cache-createImageBitmap.html [ DumpJSConsoleLogInStdErr ] 265 266 266 267 webkit.org/b/202495 imported/w3c/web-platform-tests/shadow-dom/directionality-002.tentative.html [ ImageOnlyFailure ] -
trunk/Source/WebCore/ChangeLog
r250778 r250782 1 2019-10-07 Chris Dumez <cdumez@apple.com> 2 3 PendingImageBitmap should not prevent entering the back/forward cache 4 https://bugs.webkit.org/show_bug.cgi?id=202585 5 6 Reviewed by Tim Horton. 7 8 Add PageCache support to PendingImageBitmap by doing the promise resolution on a 9 SuspendableTimer (which properly gets paused while in PageCache). 10 11 Test: fast/history/page-cache-createImageBitmap.html 12 13 * html/ImageBitmap.cpp: 14 1 15 2019-10-07 Dirk Schulze <krit@webkit.org> 2 16 -
trunk/Source/WebCore/html/ImageBitmap.cpp
r250735 r250782 46 46 #include "RenderElement.h" 47 47 #include "SharedBuffer.h" 48 #include "SuspendableTimer.h" 48 49 #include "TypedOMCSSImageValue.h" 49 50 #include <wtf/IsoMallocInlines.h> 50 51 #include <wtf/Optional.h> 52 #include <wtf/Scope.h> 51 53 #include <wtf/StdLibExtras.h> 52 54 #include <wtf/Variant.h> … … 526 528 527 529 class PendingImageBitmap final : public ActiveDOMObject, public FileReaderLoaderClient { 530 WTF_MAKE_FAST_ALLOCATED; 528 531 public: 529 532 static void fetch(ScriptExecutionContext& scriptExecutionContext, RefPtr<Blob>&& blob, ImageBitmapOptions&& options, Optional<IntRect> rect, ImageBitmap::Promise&& promise) … … 541 544 , m_rect(WTFMove(rect)) 542 545 , m_promise(WTFMove(promise)) 546 , m_createImageBitmapTimer(&scriptExecutionContext, *this, &PendingImageBitmap::createImageBitmapAndResolvePromise) 543 547 { 544 548 suspendIfNeeded(); 549 m_createImageBitmapTimer.suspendIfNeeded(); 545 550 } 546 551 … … 552 557 // ActiveDOMObject 553 558 554 const char* activeDOMObjectName() const override559 const char* activeDOMObjectName() const final 555 560 { 556 561 return "PendingImageBitmap"; 557 562 } 558 563 559 bool canSuspendForDocumentSuspension() const override 560 { 561 // FIXME: Deal with suspension. 562 return false; 564 bool canSuspendForDocumentSuspension() const final 565 { 566 return true; 567 } 568 569 void stop() final 570 { 571 delete this; 563 572 } 564 573 … … 575 584 void didFinishLoading() override 576 585 { 577 createImageBitmap(m_blobLoader.arrayBufferResult()); 578 delete this; 586 createImageBitmapAndResolvePromiseSoon(m_blobLoader.arrayBufferResult()); 579 587 } 580 588 581 589 void didFail(int) override 582 590 { 583 createImageBitmap(nullptr); 584 delete this; 585 } 586 587 void createImageBitmap(RefPtr<ArrayBuffer>&& arrayBuffer) 588 { 589 if (!arrayBuffer) { 591 createImageBitmapAndResolvePromiseSoon(nullptr); 592 } 593 594 void createImageBitmapAndResolvePromiseSoon(RefPtr<ArrayBuffer>&& arrayBuffer) 595 { 596 ASSERT(!m_createImageBitmapTimer.isActive()); 597 m_arrayBufferToProcess = WTFMove(arrayBuffer); 598 m_createImageBitmapTimer.startOneShot(0_s); 599 } 600 601 void createImageBitmapAndResolvePromise() 602 { 603 auto destroyOnExit = makeScopeExit([this] { 604 delete this; 605 }); 606 607 if (!m_arrayBufferToProcess) { 590 608 m_promise.reject(InvalidStateError, "An error occured reading the Blob argument to createImageBitmap"); 591 609 return; 592 610 } 593 611 594 ImageBitmap::createFromBuffer( arrayBuffer.releaseNonNull(), m_blob->type(), m_blob->size(), m_blobLoader.url(), WTFMove(m_options), WTFMove(m_rect), WTFMove(m_promise));612 ImageBitmap::createFromBuffer(m_arrayBufferToProcess.releaseNonNull(), m_blob->type(), m_blob->size(), m_blobLoader.url(), WTFMove(m_options), WTFMove(m_rect), WTFMove(m_promise)); 595 613 } 596 614 … … 600 618 Optional<IntRect> m_rect; 601 619 ImageBitmap::Promise m_promise; 620 SuspendableTimer m_createImageBitmapTimer; 621 RefPtr<ArrayBuffer> m_arrayBufferToProcess; 602 622 }; 603 623
Note: See TracChangeset
for help on using the changeset viewer.