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

Side by Side Diff: third_party/WebKit/Source/core/loader/resource/ImageResourceContent.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
« no previous file with comments | « third_party/WebKit/Source/core/loader/resource/ImageResourceContent.h ('k') | 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/loader/resource/ImageResourceContent.h" 5 #include "core/loader/resource/ImageResourceContent.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "core/loader/resource/ImageResource.h" 9 #include "core/loader/resource/ImageResource.h"
10 #include "core/loader/resource/ImageResourceInfo.h" 10 #include "core/loader/resource/ImageResourceInfo.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 } // namespace 68 } // namespace
69 69
70 ImageResourceContent::ImageResourceContent(PassRefPtr<blink::Image> image) 70 ImageResourceContent::ImageResourceContent(PassRefPtr<blink::Image> image)
71 : is_refetchable_data_from_disk_cache_(true), image_(std::move(image)) { 71 : is_refetchable_data_from_disk_cache_(true), image_(std::move(image)) {
72 DEFINE_STATIC_LOCAL(NullImageResourceInfo, null_info, 72 DEFINE_STATIC_LOCAL(NullImageResourceInfo, null_info,
73 (new NullImageResourceInfo())); 73 (new NullImageResourceInfo()));
74 info_ = &null_info; 74 info_ = &null_info;
75 } 75 }
76 76
77 ImageResourceContent* ImageResourceContent::CreateLoaded(
78 PassRefPtr<blink::Image> image) {
79 DCHECK(image);
80 ImageResourceContent* content = new ImageResourceContent(std::move(image));
81 content->content_status_ = ResourceStatus::kCached;
82 return content;
83 }
84
77 ImageResourceContent* ImageResourceContent::Fetch(FetchParameters& params, 85 ImageResourceContent* ImageResourceContent::Fetch(FetchParameters& params,
78 ResourceFetcher* fetcher) { 86 ResourceFetcher* fetcher) {
79 // TODO(hiroshige): Remove direct references to ImageResource by making 87 // TODO(hiroshige): Remove direct references to ImageResource by making
80 // the dependencies around ImageResource and ImageResourceContent cleaner. 88 // the dependencies around ImageResource and ImageResourceContent cleaner.
81 ImageResource* resource = ImageResource::Fetch(params, fetcher); 89 ImageResource* resource = ImageResource::Fetch(params, fetcher);
82 if (!resource) 90 if (!resource)
83 return nullptr; 91 return nullptr;
84 return resource->GetContent(); 92 return resource->GetContent();
85 } 93 }
86 94
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 602
595 const ResourceResponse& ImageResourceContent::GetResponse() const { 603 const ResourceResponse& ImageResourceContent::GetResponse() const {
596 return info_->GetResponse(); 604 return info_->GetResponse();
597 } 605 }
598 606
599 const ResourceError& ImageResourceContent::GetResourceError() const { 607 const ResourceError& ImageResourceContent::GetResourceError() const {
600 return info_->GetResourceError(); 608 return info_->GetResourceError();
601 } 609 }
602 610
603 } // namespace blink 611 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/resource/ImageResourceContent.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698