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

Side by Side Diff: third_party/WebKit/Source/core/loader/resource/ImageResource.cpp

Issue 2869733004: Fix ImageResourceContent::Create()'s GetContentStatus() (Closed)
Patch Set: Rebase 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
OLDNEW
1 /* 1 /*
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
6 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 6 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 class ImageResource::ImageResourceFactory : public ResourceFactory { 127 class ImageResource::ImageResourceFactory : public ResourceFactory {
128 STACK_ALLOCATED(); 128 STACK_ALLOCATED();
129 129
130 public: 130 public:
131 ImageResourceFactory(const FetchParameters& fetch_params) 131 ImageResourceFactory(const FetchParameters& fetch_params)
132 : ResourceFactory(Resource::kImage), fetch_params_(&fetch_params) {} 132 : ResourceFactory(Resource::kImage), fetch_params_(&fetch_params) {}
133 133
134 Resource* Create(const ResourceRequest& request, 134 Resource* Create(const ResourceRequest& request,
135 const ResourceLoaderOptions& options, 135 const ResourceLoaderOptions& options,
136 const String&) const override { 136 const String&) const override {
137 return new ImageResource(request, options, ImageResourceContent::Create(), 137 return new ImageResource(request, options,
138 ImageResourceContent::CreateNotStarted(),
138 fetch_params_->GetPlaceholderImageRequestType() == 139 fetch_params_->GetPlaceholderImageRequestType() ==
139 FetchParameters::kAllowPlaceholder); 140 FetchParameters::kAllowPlaceholder);
140 } 141 }
141 142
142 private: 143 private:
143 // Weak, unowned pointer. Must outlive |this|. 144 // Weak, unowned pointer. Must outlive |this|.
144 const FetchParameters* fetch_params_; 145 const FetchParameters* fetch_params_;
145 }; 146 };
146 147
147 ImageResource* ImageResource::Fetch(FetchParameters& params, 148 ImageResource* ImageResource::Fetch(FetchParameters& params,
(...skipping 28 matching lines...) Expand all
176 // placeholder, then do not reuse this resource. 177 // placeholder, then do not reuse this resource.
177 if (params.GetPlaceholderImageRequestType() != 178 if (params.GetPlaceholderImageRequestType() !=
178 FetchParameters::kAllowPlaceholder && 179 FetchParameters::kAllowPlaceholder &&
179 placeholder_option_ != PlaceholderOption::kDoNotReloadPlaceholder) 180 placeholder_option_ != PlaceholderOption::kDoNotReloadPlaceholder)
180 return false; 181 return false;
181 return true; 182 return true;
182 } 183 }
183 184
184 ImageResource* ImageResource::Create(const ResourceRequest& request) { 185 ImageResource* ImageResource::Create(const ResourceRequest& request) {
185 return new ImageResource(request, ResourceLoaderOptions(), 186 return new ImageResource(request, ResourceLoaderOptions(),
186 ImageResourceContent::Create(), false); 187 ImageResourceContent::CreateNotStarted(), false);
187 } 188 }
188 189
189 ImageResource::ImageResource(const ResourceRequest& resource_request, 190 ImageResource::ImageResource(const ResourceRequest& resource_request,
190 const ResourceLoaderOptions& options, 191 const ResourceLoaderOptions& options,
191 ImageResourceContent* content, 192 ImageResourceContent* content,
192 bool is_placeholder) 193 bool is_placeholder)
193 : Resource(resource_request, kImage, options), 194 : Resource(resource_request, kImage, options),
194 content_(content), 195 content_(content),
195 device_pixel_ratio_header_value_(1.0), 196 device_pixel_ratio_header_value_(1.0),
196 has_device_pixel_ratio_header_value_(false), 197 has_device_pixel_ratio_header_value_(false),
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 // reloading in Step 3 due to notifyObservers()'s 600 // reloading in Step 3 due to notifyObservers()'s
600 // schedulingReloadOrShouldReloadBrokenPlaceholder() check. 601 // schedulingReloadOrShouldReloadBrokenPlaceholder() check.
601 // 3. reloadIfLoFiOrPlaceholderImage() is called via ResourceFetcher 602 // 3. reloadIfLoFiOrPlaceholderImage() is called via ResourceFetcher
602 // (a) via didFinishLoading() called in decodeError(), or 603 // (a) via didFinishLoading() called in decodeError(), or
603 // (b) after returning ImageResource::updateImage(). 604 // (b) after returning ImageResource::updateImage().
604 DecodeError(all_data_received); 605 DecodeError(all_data_received);
605 } 606 }
606 } 607 }
607 608
608 } // namespace blink 609 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698