Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(404)

Side by Side Diff: third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp

Issue 2897533002: Make ImageObserver::AsyncLoadCompleted() called asynchronously (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org> 2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org>
3 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. 3 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
4 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 4 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 12 matching lines...) Expand all
23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28 #include "core/svg/graphics/SVGImage.h" 28 #include "core/svg/graphics/SVGImage.h"
29 29
30 #include "core/animation/DocumentAnimations.h" 30 #include "core/animation/DocumentAnimations.h"
31 #include "core/animation/DocumentTimeline.h" 31 #include "core/animation/DocumentTimeline.h"
32 #include "core/dom/NodeTraversal.h" 32 #include "core/dom/NodeTraversal.h"
33 #include "core/dom/TaskRunnerHelper.h"
33 #include "core/dom/shadow/FlatTreeTraversal.h" 34 #include "core/dom/shadow/FlatTreeTraversal.h"
34 #include "core/frame/FrameView.h" 35 #include "core/frame/FrameView.h"
35 #include "core/frame/LocalFrame.h" 36 #include "core/frame/LocalFrame.h"
36 #include "core/frame/LocalFrameClient.h" 37 #include "core/frame/LocalFrameClient.h"
37 #include "core/frame/Settings.h" 38 #include "core/frame/Settings.h"
38 #include "core/layout/LayoutView.h" 39 #include "core/layout/LayoutView.h"
39 #include "core/layout/svg/LayoutSVGRoot.h" 40 #include "core/layout/svg/LayoutSVGRoot.h"
40 #include "core/loader/FrameLoadRequest.h" 41 #include "core/loader/FrameLoadRequest.h"
41 #include "core/paint/FloatClipRecorder.h" 42 #include "core/paint/FloatClipRecorder.h"
42 #include "core/paint/TransformRecorder.h" 43 #include "core/paint/TransformRecorder.h"
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 } 634 }
634 635
635 void SVGImage::LoadCompleted() { 636 void SVGImage::LoadCompleted() {
636 switch (load_state_) { 637 switch (load_state_) {
637 case kInDataChanged: 638 case kInDataChanged:
638 load_state_ = kLoadCompleted; 639 load_state_ = kLoadCompleted;
639 break; 640 break;
640 641
641 case kWaitingForAsyncLoadCompletion: 642 case kWaitingForAsyncLoadCompletion:
642 load_state_ = kLoadCompleted; 643 load_state_ = kLoadCompleted;
643 if (GetImageObserver()) 644 if (GetImageObserver()) {
644 GetImageObserver()->AsyncLoadCompleted(this); 645 TaskRunnerHelper::Get(TaskType::kDOMManipulation,
fs 2017/05/19 09:06:49 Since this is a task posted on a task runner belon
hiroshige 2017/05/19 20:28:52 This is because - The frame etc. of the "client/in
646 ToLocalFrame(page_->MainFrame())->GetDocument())
kouhei (in TOK) 2017/05/19 05:20:54 ->GetDocument() not needed. TaskRunnerHelper::Get
hiroshige 2017/05/19 20:28:52 Done.
647 ->PostTask(
648 BLINK_FROM_HERE,
649 WTF::Bind(&ImageObserver::AsyncLoadCompleted,
650 WeakPersistent<ImageObserver>(GetImageObserver()),
yhirano 2017/05/19 06:55:29 Why weak?
hiroshige 2017/05/19 20:28:52 I think Persistent will also work well here. I mad
651 RefPtr<SVGImage>(this)));
652 }
645 break; 653 break;
646 654
647 case kDataChangedNotStarted: 655 case kDataChangedNotStarted:
648 case kLoadCompleted: 656 case kLoadCompleted:
649 CHECK(false); 657 CHECK(false);
650 break; 658 break;
651 } 659 }
652 } 660 }
653 661
654 Image::SizeAvailability SVGImage::DataChanged(bool all_data_received) { 662 Image::SizeAvailability SVGImage::DataChanged(bool all_data_received) {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 767
760 NOTREACHED(); 768 NOTREACHED();
761 return kSizeAvailable; 769 return kSizeAvailable;
762 } 770 }
763 771
764 String SVGImage::FilenameExtension() const { 772 String SVGImage::FilenameExtension() const {
765 return "svg"; 773 return "svg";
766 } 774 }
767 775
768 } // namespace blink 776 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698