OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Apple Inc. All rights | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Apple Inc. All rights |
5 * reserved. | 5 * reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
489 } | 489 } |
490 | 490 |
491 void ImageLoader::ImageNotifyFinished(ImageResourceContent* resource) { | 491 void ImageLoader::ImageNotifyFinished(ImageResourceContent* resource) { |
492 RESOURCE_LOADING_DVLOG(1) | 492 RESOURCE_LOADING_DVLOG(1) |
493 << "ImageLoader::imageNotifyFinished " << this | 493 << "ImageLoader::imageNotifyFinished " << this |
494 << "; m_hasPendingLoadEvent=" << has_pending_load_event_; | 494 << "; m_hasPendingLoadEvent=" << has_pending_load_event_; |
495 | 495 |
496 DCHECK(failed_load_url_.IsEmpty()); | 496 DCHECK(failed_load_url_.IsEmpty()); |
497 DCHECK_EQ(resource, image_.Get()); | 497 DCHECK_EQ(resource, image_.Get()); |
498 | 498 |
499 if (loading_image_document_) { | |
500 CHECK(image_complete_); | |
501 } else { | |
502 CHECK(!image_complete_); | |
503 } | |
kinuko
2017/05/08 05:34:34
nit: no braces for one-block line for consistency
hiroshige
2017/05/08 18:56:42
Done.
| |
504 | |
499 image_complete_ = true; | 505 image_complete_ = true; |
500 delay_until_image_notify_finished_ = nullptr; | 506 delay_until_image_notify_finished_ = nullptr; |
501 | 507 |
502 // Update ImageAnimationPolicy for m_image. | 508 // Update ImageAnimationPolicy for m_image. |
503 if (image_) | 509 if (image_) |
504 image_->UpdateImageAnimationPolicy(); | 510 image_->UpdateImageAnimationPolicy(); |
505 | 511 |
506 UpdateLayoutObject(); | 512 UpdateLayoutObject(); |
507 | 513 |
508 if (image_ && image_->GetImage() && image_->GetImage()->IsSVGImage()) | 514 if (image_ && image_->GetImage() && image_->GetImage()->IsSVGImage()) |
509 ToSVGImage(image_->GetImage()) | 515 ToSVGImage(image_->GetImage()) |
510 ->UpdateUseCounters(GetElement()->GetDocument()); | 516 ->UpdateUseCounters(GetElement()->GetDocument()); |
511 | 517 |
512 if (!has_pending_load_event_) | 518 if (loading_image_document_) { |
519 CHECK(!has_pending_load_event_); | |
513 return; | 520 return; |
521 } | |
522 | |
523 CHECK(has_pending_load_event_); | |
514 | 524 |
515 if (resource->ErrorOccurred()) { | 525 if (resource->ErrorOccurred()) { |
516 LoadEventSender().CancelEvent(this); | 526 LoadEventSender().CancelEvent(this); |
517 has_pending_load_event_ = false; | 527 has_pending_load_event_ = false; |
518 | 528 |
519 if (resource->GetResourceError().IsAccessCheck()) { | 529 if (resource->GetResourceError().IsAccessCheck()) { |
520 CrossSiteOrCSPViolationOccurred( | 530 CrossSiteOrCSPViolationOccurred( |
521 AtomicString(resource->GetResourceError().FailingURL())); | 531 AtomicString(resource->GetResourceError().FailingURL())); |
522 } | 532 } |
523 | 533 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
603 DCHECK(event_sender == &LoadEventSender() || | 613 DCHECK(event_sender == &LoadEventSender() || |
604 event_sender == &ErrorEventSender()); | 614 event_sender == &ErrorEventSender()); |
605 const AtomicString& event_type = event_sender->EventType(); | 615 const AtomicString& event_type = event_sender->EventType(); |
606 if (event_type == EventTypeNames::load) | 616 if (event_type == EventTypeNames::load) |
607 DispatchPendingLoadEvent(); | 617 DispatchPendingLoadEvent(); |
608 if (event_type == EventTypeNames::error) | 618 if (event_type == EventTypeNames::error) |
609 DispatchPendingErrorEvent(); | 619 DispatchPendingErrorEvent(); |
610 } | 620 } |
611 | 621 |
612 void ImageLoader::DispatchPendingLoadEvent() { | 622 void ImageLoader::DispatchPendingLoadEvent() { |
613 if (!has_pending_load_event_) | 623 CHECK(has_pending_load_event_); |
614 return; | |
615 if (!image_) | 624 if (!image_) |
616 return; | 625 return; |
626 CHECK(image_complete_); | |
617 has_pending_load_event_ = false; | 627 has_pending_load_event_ = false; |
618 if (GetElement()->GetDocument().GetFrame()) | 628 if (GetElement()->GetDocument().GetFrame()) |
619 DispatchLoadEvent(); | 629 DispatchLoadEvent(); |
620 | 630 |
621 // Only consider updating the protection ref-count of the Element immediately | 631 // Only consider updating the protection ref-count of the Element immediately |
622 // before returning from this function as doing so might result in the | 632 // before returning from this function as doing so might result in the |
623 // destruction of this ImageLoader. | 633 // destruction of this ImageLoader. |
624 UpdatedHasPendingEvent(); | 634 UpdatedHasPendingEvent(); |
625 } | 635 } |
626 | 636 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
661 } | 671 } |
662 if (delay_until_image_notify_finished_) { | 672 if (delay_until_image_notify_finished_) { |
663 delay_until_image_notify_finished_->DocumentChanged( | 673 delay_until_image_notify_finished_->DocumentChanged( |
664 element_->GetDocument()); | 674 element_->GetDocument()); |
665 } | 675 } |
666 ClearFailedLoadURL(); | 676 ClearFailedLoadURL(); |
667 SetImage(0); | 677 SetImage(0); |
668 } | 678 } |
669 | 679 |
670 } // namespace blink | 680 } // namespace blink |
OLD | NEW |