Changeset 273300 in webkit


Ignore:
Timestamp:
Feb 23, 2021, 12:20:01 AM (5 years ago)
Author:
rniwa@webkit.org
Message:

Handle Page::didFinishLoadingImageForElement asynchronously
https://bugs.webkit.org/show_bug.cgi?id=221390

Reviewed by Antti Koivisto.

Use EventLoop instead of RunLoop::main() to be thread safe in iOS WebKit1.

  • page/Page.cpp:

(WebCore::Page::didFinishLoadingImageForElement):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r273299 r273300  
     12021-02-23  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Handle Page::didFinishLoadingImageForElement asynchronously
     4        https://bugs.webkit.org/show_bug.cgi?id=221390
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Use EventLoop instead of RunLoop::main() to be thread safe in iOS WebKit1.
     9
     10        * page/Page.cpp:
     11        (WebCore::Page::didFinishLoadingImageForElement):
     12
    1132021-02-22  Don Olmstead  <don.olmstead@sony.com>
    214
  • trunk/Source/WebCore/page/Page.cpp

    r273231 r273300  
    5555#include "Event.h"
    5656#include "EventHandler.h"
     57#include "EventLoop.h"
    5758#include "EventNames.h"
    5859#include "ExtensionStyleSheets.h"
     
    33373338void Page::didFinishLoadingImageForElement(HTMLImageElement& element)
    33383339{
    3339     RunLoop::main().dispatch([this, weakThis = makeWeakPtr(*this), element = makeRef(element)]() {
    3340         if (!weakThis)
     3340    element.document().eventLoop().queueTask(TaskSource::Networking, [element = makeRef(element)]() {
     3341        auto frame = makeRefPtr(element->document().frame());
     3342        if (!frame)
    33413343            return;
    33423344
    3343         if (auto frame = makeRefPtr(element->document().frame()))
    3344             frame->editor().revealSelectionIfNeededAfterLoadingImageForElement(element);
    3345         chrome().client().didFinishLoadingImageForElement(element);
     3345        frame->editor().revealSelectionIfNeededAfterLoadingImageForElement(element);
     3346        if (auto* page = frame->page(); element->document().frame() == frame)
     3347            page->chrome().client().didFinishLoadingImageForElement(element);
    33463348    });
    33473349}
Note: See TracChangeset for help on using the changeset viewer.