Commit c978c765 authored by Hiroshige Hayashizaki's avatar Hiroshige Hayashizaki Committed by Commit Bot

Revert "Add CHECK()s to investigate Issue 737392"

This reverts commit 95176184.

Reason for revert: Revert code for investigation before going to beta,
as planned.

Original change's description:
> Add CHECK()s to investigate Issue 737392
> 
> ImageResourceContent::content_status_ is suspected to be reset to
> kNotStarted (i.e. 0) during ImageResourceContent::UpdateImage(),
> but therer is no code that sets content_status_ to kNotStarted
> explicitly.
> 
> This CL adds CHECKs() to
> - Check whether |this| is garbage collected unexpectedly during
>   UpdateImage(), and
> - Investigate where |content_status_| becomes kNotStarted precisely.
> 
> This is to be reverted before going to beta.
> 
> Bug: 737392
> Change-Id: I2879bc54771a295a2dd77fed6808c1c08668e262
> Reviewed-on: https://chromium-review.googlesource.com/572036
> Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
> Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
> Reviewed-by: Kentaro Hara <haraken@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#486986}

TBR=kinuko@chromium.org,yoav@yoav.ws,haraken@chromium.org,hiroshige@chromium.org,japhet@chromium.org,kouhei@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 737392
Change-Id: Ia13efe886e50873f3ad0c2375ac12819a0cfb46f
Reviewed-on: https://chromium-review.googlesource.com/580427Reviewed-by: default avatarHiroshige Hayashizaki <hiroshige@chromium.org>
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Cr-Commit-Position: refs/heads/master@{#488468}
parent 4fa9fb7b
......@@ -92,12 +92,6 @@ ImageResourceContent* ImageResourceContent::Fetch(FetchParameters& params,
return resource->GetContent();
}
ImageResourceContent::~ImageResourceContent() {
// For investigation of crbug.com/737392.
// TODO(hiroshige): Remove this before going to beta.
CHECK(!is_update_image_being_called_);
}
void ImageResourceContent::SetImageResourceInfo(ImageResourceInfo* info) {
info_ = info;
}
......@@ -328,18 +322,13 @@ PassRefPtr<Image> ImageResourceContent::CreateImage(bool is_multipart) {
void ImageResourceContent::ClearImage() {
if (!image_)
return;
CHECK_NE(GetContentStatus(), ResourceStatus::kNotStarted);
int64_t length = image_->Data() ? image_->Data()->size() : 0;
CHECK_NE(GetContentStatus(), ResourceStatus::kNotStarted);
v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-length);
CHECK_NE(GetContentStatus(), ResourceStatus::kNotStarted);
// If our Image has an observer, it's always us so we need to clear the back
// pointer before dropping our reference.
image_->ClearImageObserver();
CHECK_NE(GetContentStatus(), ResourceStatus::kNotStarted);
image_.Clear();
CHECK_NE(GetContentStatus(), ResourceStatus::kNotStarted);
size_available_ = Image::kSizeUnavailable;
}
......@@ -349,8 +338,6 @@ void ImageResourceContent::UpdateToLoadedContentStatus(
// When |ShouldNotifyFinish|, we set content_status_
// to a loaded ResourceStatus.
CHECK_NE(GetContentStatus(), ResourceStatus::kNotStarted);
// Checks |new_status| (i.e. Resource's current status).
switch (new_status) {
case ResourceStatus::kCached:
......@@ -434,8 +421,10 @@ ImageResourceContent::UpdateImageResult ImageResourceContent::UpdateImage(
bool is_multipart) {
TRACE_EVENT0("blink", "ImageResourceContent::updateImage");
CHECK(!is_update_image_being_called_);
#if DCHECK_IS_ON()
DCHECK(!is_update_image_being_called_);
AutoReset<bool> scope(&is_update_image_being_called_, true);
#endif
CHECK_NE(GetContentStatus(), ResourceStatus::kNotStarted);
......@@ -464,9 +453,7 @@ ImageResourceContent::UpdateImageResult ImageResourceContent::UpdateImage(
if (!image_)
image_ = CreateImage(is_multipart);
DCHECK(image_);
CHECK_NE(GetContentStatus(), ResourceStatus::kNotStarted);
size_available_ = image_->SetData(std::move(data), all_data_received);
CHECK_NE(GetContentStatus(), ResourceStatus::kNotStarted);
DCHECK(all_data_received ||
size_available_ !=
Image::kSizeAvailableAndLoadingAsynchronously);
......
......@@ -57,8 +57,6 @@ class CORE_EXPORT ImageResourceContent final
static ImageResourceContent* Fetch(FetchParameters&, ResourceFetcher*);
~ImageResourceContent() override;
// Returns the nullImage() if the image is not available yet.
blink::Image* GetImage();
bool HasImage() const { return image_.Get(); }
......@@ -228,7 +226,9 @@ class CORE_EXPORT ImageResourceContent final
HashCountedSet<ImageResourceObserver*> observers_;
HashCountedSet<ImageResourceObserver*> finished_observers_;
#if DCHECK_IS_ON()
bool is_update_image_being_called_ = false;
#endif
};
} // namespace blink
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment