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

Side by Side Diff: Source/core/loader/cache/CachedResource.h

Issue 19393004: Allow eviction of ImageBitmaps that are created from ImageElements. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
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, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 }; 73 };
74 74
75 enum Status { 75 enum Status {
76 Unknown, // let cache decide what to do with it 76 Unknown, // let cache decide what to do with it
77 Pending, // only partially loaded 77 Pending, // only partially loaded
78 Cached, // regular case 78 Cached, // regular case
79 LoadError, 79 LoadError,
80 DecodeError 80 DecodeError
81 }; 81 };
82 82
83 CachedResource(const ResourceRequest&, Type); 83 enum DecodeCachePriority {
Justin Novosad 2013/07/19 21:09:53 I'd call this just Priority.
84 DecodeCachePriorityLow = 0,
85 DecodeCachePriorityMedium,
86 DecodeCachePriorityHigh
87 };
88
89 CachedResource(const ResourceRequest&, Type, DecodeCachePriority = DecodeCac hePriorityMedium);
84 virtual ~CachedResource(); 90 virtual ~CachedResource();
85 91
86 virtual void load(CachedResourceLoader*, const ResourceLoaderOptions&); 92 virtual void load(CachedResourceLoader*, const ResourceLoaderOptions&);
87 93
88 virtual void setEncoding(const String&) { } 94 virtual void setEncoding(const String&) { }
89 virtual String encoding() const { return String(); } 95 virtual String encoding() const { return String(); }
90 virtual void appendData(const char*, int); 96 virtual void appendData(const char*, int);
91 virtual void error(CachedResource::Status); 97 virtual void error(CachedResource::Status);
92 98
93 void setResourceError(const ResourceError& error) { m_error = error; } 99 void setResourceError(const ResourceError& error) { m_error = error; }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 bool passesAccessControlCheck(SecurityOrigin*, String& errorDescription); 168 bool passesAccessControlCheck(SecurityOrigin*, String& errorDescription);
163 bool canBeAccessedBy(SecurityOrigin*, String& error); 169 bool canBeAccessedBy(SecurityOrigin*, String& error);
164 170
165 // Called by the cache if the object has been removed from the cache 171 // Called by the cache if the object has been removed from the cache
166 // while still being referenced. This means the object should delete itself 172 // while still being referenced. This means the object should delete itself
167 // if the number of clients observing it ever drops to 0. 173 // if the number of clients observing it ever drops to 0.
168 // The resource can be brought back to cache after successful revalidation. 174 // The resource can be brought back to cache after successful revalidation.
169 void setInCache(bool inCache) { m_inCache = inCache; } 175 void setInCache(bool inCache) { m_inCache = inCache; }
170 bool inCache() const { return m_inCache; } 176 bool inCache() const { return m_inCache; }
171 177
178 void setDecodeCachePriority(DecodeCachePriority priority) { m_decodeCachePri ority = priority; }
179 DecodeCachePriority decodeCachePriority() { return m_decodeCachePriority; }
172 bool inLiveDecodedResourcesList() { return m_inLiveDecodedResourcesList; } 180 bool inLiveDecodedResourcesList() { return m_inLiveDecodedResourcesList; }
173 181
174 void clearLoader(); 182 void clearLoader();
175 183
176 SharedBuffer* resourceBuffer() const { ASSERT(!m_purgeableData); return m_da ta.get(); } 184 SharedBuffer* resourceBuffer() const { ASSERT(!m_purgeableData); return m_da ta.get(); }
177 185
178 virtual void willSendRequest(ResourceRequest&, const ResourceResponse&) { m_ requestedFromNetworkingLayer = true; } 186 virtual void willSendRequest(ResourceRequest&, const ResourceResponse&) { m_ requestedFromNetworkingLayer = true; }
179 virtual void responseReceived(const ResourceResponse&); 187 virtual void responseReceived(const ResourceResponse&);
180 void setResponse(const ResourceResponse& response) { m_response = response; } 188 void setResponse(const ResourceResponse& response) { m_response = response; }
181 const ResourceResponse& response() const { return m_response; } 189 const ResourceResponse& response() const { return m_response; }
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 unsigned long m_identifier; 318 unsigned long m_identifier;
311 319
312 unsigned m_encodedSize; 320 unsigned m_encodedSize;
313 unsigned m_decodedSize; 321 unsigned m_decodedSize;
314 unsigned m_accessCount; 322 unsigned m_accessCount;
315 unsigned m_handleCount; 323 unsigned m_handleCount;
316 unsigned m_preloadCount; 324 unsigned m_preloadCount;
317 325
318 unsigned m_preloadResult : 2; // PreloadResult 326 unsigned m_preloadResult : 2; // PreloadResult
319 327
328 DecodeCachePriority m_decodeCachePriority;
Justin Novosad 2013/07/19 21:09:53 Put ": 2" at the end.
320 bool m_inLiveDecodedResourcesList : 1; 329 bool m_inLiveDecodedResourcesList : 1;
321 bool m_requestedFromNetworkingLayer : 1; 330 bool m_requestedFromNetworkingLayer : 1;
322 331
323 bool m_inCache : 1; 332 bool m_inCache : 1;
324 bool m_loading : 1; 333 bool m_loading : 1;
325 334
326 bool m_switchingClientsToRevalidatedResource : 1; 335 bool m_switchingClientsToRevalidatedResource : 1;
327 336
328 unsigned m_type : 4; // Type 337 unsigned m_type : 4; // Type
329 unsigned m_status : 3; // Status 338 unsigned m_status : 3; // Status
(...skipping 18 matching lines...) Expand all
348 // If this field is non-null, the resource has a proxy for checking whether it is still up to date (see m_resourceToRevalidate). 357 // If this field is non-null, the resource has a proxy for checking whether it is still up to date (see m_resourceToRevalidate).
349 CachedResource* m_proxyResource; 358 CachedResource* m_proxyResource;
350 359
351 // These handles will need to be updated to point to the m_resourceToRevalid ate in case we get 304 response. 360 // These handles will need to be updated to point to the m_resourceToRevalid ate in case we get 304 response.
352 HashSet<CachedResourceHandleBase*> m_handlesToRevalidate; 361 HashSet<CachedResourceHandleBase*> m_handlesToRevalidate;
353 }; 362 };
354 363
355 } 364 }
356 365
357 #endif 366 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698