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

Side by Side Diff: third_party/WebKit/Source/core/fetch/ImageResource.h

Issue 2499263002: Add UMA to estimate deroppable memory usage of encoded data size in Resources (Closed)
Patch Set: Use platform/Histgram.h instead of adding depencency from core to base Created 4 years, 1 month 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 | third_party/WebKit/Source/core/fetch/ImageResource.cpp » ('j') | 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) 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) 2006 Samuel Weinig (sam.weinig@gmail.com) 4 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
5 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 5 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 void onePartInMultipartReceived(const ResourceResponse&) final; 153 void onePartInMultipartReceived(const ResourceResponse&) final;
154 void multipartDataReceived(const char*, size_t) final; 154 void multipartDataReceived(const char*, size_t) final;
155 155
156 // Used by tests. 156 // Used by tests.
157 bool isPlaceholder() const { return m_isPlaceholder; } 157 bool isPlaceholder() const { return m_isPlaceholder; }
158 158
159 bool shouldReloadBrokenPlaceholder() const { 159 bool shouldReloadBrokenPlaceholder() const {
160 return m_isPlaceholder && willPaintBrokenImage(); 160 return m_isPlaceholder && willPaintBrokenImage();
161 } 161 }
162 162
163 void setNotRefetchableDataFromDiskCache() {
164 m_isRefetchableDataFromDiskCache = false;
165 }
166
163 DECLARE_VIRTUAL_TRACE(); 167 DECLARE_VIRTUAL_TRACE();
164 168
165 private: 169 private:
166 explicit ImageResource(blink::Image*, const ResourceLoaderOptions&); 170 explicit ImageResource(blink::Image*, const ResourceLoaderOptions&);
167 171
168 enum class MultipartParsingState : uint8_t { 172 enum class MultipartParsingState : uint8_t {
169 WaitingForFirstPart, 173 WaitingForFirstPart,
170 ParsingFirstPart, 174 ParsingFirstPart,
171 FinishedParsingFirstPart, 175 FinishedParsingFirstPart,
172 }; 176 };
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 // because reloadIfLoFi() was called. 221 // because reloadIfLoFi() was called.
218 bool m_isSchedulingReload; 222 bool m_isSchedulingReload;
219 223
220 // Indicates if this ImageResource is either attempting to load a placeholder 224 // Indicates if this ImageResource is either attempting to load a placeholder
221 // image, or is a (possibly broken) placeholder image. 225 // image, or is a (possibly broken) placeholder image.
222 bool m_isPlaceholder; 226 bool m_isPlaceholder;
223 227
224 Timer<ImageResource> m_flushTimer; 228 Timer<ImageResource> m_flushTimer;
225 double m_lastFlushTime = 0.; 229 double m_lastFlushTime = 0.;
226 Image::SizeAvailability m_sizeAvailable = Image::SizeUnavailable; 230 Image::SizeAvailability m_sizeAvailable = Image::SizeUnavailable;
231
232 // Indicates if this resource's encoded image data can be purged and refetched
233 // from disk cache to save memory usage. See crbug/664437.
234 bool m_isRefetchableDataFromDiskCache;
227 }; 235 };
228 236
229 DEFINE_RESOURCE_TYPE_CASTS(Image); 237 DEFINE_RESOURCE_TYPE_CASTS(Image);
230 238
231 } // namespace blink 239 } // namespace blink
232 240
233 #endif 241 #endif
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/fetch/ImageResource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698