| Index: third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
|
| diff --git a/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp b/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
|
| index 8c34ea90b7adca781799ab40528b5f1a96055a91..226e10b05a91d3102d8723bdfcad8c092c4bf825 100644
|
| --- a/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
|
| +++ b/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
|
| @@ -30,6 +30,7 @@
|
| #include "core/animation/DocumentAnimations.h"
|
| #include "core/animation/DocumentTimeline.h"
|
| #include "core/dom/NodeTraversal.h"
|
| +#include "core/dom/TaskRunnerHelper.h"
|
| #include "core/dom/shadow/FlatTreeTraversal.h"
|
| #include "core/frame/FrameView.h"
|
| #include "core/frame/LocalFrame.h"
|
| @@ -640,8 +641,16 @@ void SVGImage::LoadCompleted() {
|
|
|
| case kWaitingForAsyncLoadCompletion:
|
| load_state_ = kLoadCompleted;
|
| - if (GetImageObserver())
|
| - GetImageObserver()->AsyncLoadCompleted(this);
|
| +
|
| + // Because LoadCompleted() is called synchronously from
|
| + // Document::ImplicitClose(), we defer AsyncLoadCompleted() to avoid
|
| + // potential bugs and timing dependencies around ImplicitClose() and
|
| + // to make LoadEventFinished() true when AsyncLoadCompleted() is called.
|
| + TaskRunnerHelper::Get(TaskType::kUnspecedLoading,
|
| + ToLocalFrame(page_->MainFrame()))
|
| + ->PostTask(BLINK_FROM_HERE,
|
| + WTF::Bind(&SVGImage::NotifyAsyncLoadCompleted,
|
| + RefPtr<SVGImage>(this)));
|
| break;
|
|
|
| case kDataChangedNotStarted:
|
| @@ -651,6 +660,11 @@ void SVGImage::LoadCompleted() {
|
| }
|
| }
|
|
|
| +void SVGImage::NotifyAsyncLoadCompleted() {
|
| + if (GetImageObserver())
|
| + GetImageObserver()->AsyncLoadCompleted(this);
|
| +}
|
| +
|
| Image::SizeAvailability SVGImage::DataChanged(bool all_data_received) {
|
| TRACE_EVENT0("blink", "SVGImage::dataChanged");
|
|
|
|
|