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

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: Name change. Created 7 years, 4 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 // Determines the order in which CachedResources are evicted
84 // from the decoded resources cache.
85 enum CacheLiveResourcePriority {
86 CacheLiveResourcePriorityLow = 0,
87 CacheLiveResourcePriorityHigh
88 };
89
83 CachedResource(const ResourceRequest&, Type); 90 CachedResource(const ResourceRequest&, Type);
84 virtual ~CachedResource(); 91 virtual ~CachedResource();
85 92
86 virtual void load(ResourceFetcher*, const ResourceLoaderOptions&); 93 virtual void load(ResourceFetcher*, const ResourceLoaderOptions&);
87 94
88 virtual void setEncoding(const String&) { } 95 virtual void setEncoding(const String&) { }
89 virtual String encoding() const { return String(); } 96 virtual String encoding() const { return String(); }
90 virtual void appendData(const char*, int); 97 virtual void appendData(const char*, int);
91 virtual void error(CachedResource::Status); 98 virtual void error(CachedResource::Status);
92 99
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 bool passesAccessControlCheck(SecurityOrigin*); 167 bool passesAccessControlCheck(SecurityOrigin*);
161 bool passesAccessControlCheck(SecurityOrigin*, String& errorDescription); 168 bool passesAccessControlCheck(SecurityOrigin*, String& errorDescription);
162 169
163 // Called by the cache if the object has been removed from the cache 170 // Called by the cache if the object has been removed from the cache
164 // while still being referenced. This means the object should delete itself 171 // while still being referenced. This means the object should delete itself
165 // if the number of clients observing it ever drops to 0. 172 // if the number of clients observing it ever drops to 0.
166 // The resource can be brought back to cache after successful revalidation. 173 // The resource can be brought back to cache after successful revalidation.
167 void setInCache(bool inCache) { m_inCache = inCache; } 174 void setInCache(bool inCache) { m_inCache = inCache; }
168 bool inCache() const { return m_inCache; } 175 bool inCache() const { return m_inCache; }
169 176
177 void setCacheLiveResourcePriority(CacheLiveResourcePriority);
178 unsigned cacheLiveResourcePriority() const { return m_cacheLiveResourcePrior ity; }
170 bool inLiveDecodedResourcesList() { return m_inLiveDecodedResourcesList; } 179 bool inLiveDecodedResourcesList() { return m_inLiveDecodedResourcesList; }
171 180
172 void clearLoader(); 181 void clearLoader();
173 182
174 SharedBuffer* resourceBuffer() const { ASSERT(!m_purgeableData); return m_da ta.get(); } 183 SharedBuffer* resourceBuffer() const { ASSERT(!m_purgeableData); return m_da ta.get(); }
175 184
176 virtual void willSendRequest(ResourceRequest&, const ResourceResponse&) { m_ requestedFromNetworkingLayer = true; } 185 virtual void willSendRequest(ResourceRequest&, const ResourceResponse&) { m_ requestedFromNetworkingLayer = true; }
177 virtual void responseReceived(const ResourceResponse&); 186 virtual void responseReceived(const ResourceResponse&);
178 void setResponse(const ResourceResponse& response) { m_response = response; } 187 void setResponse(const ResourceResponse& response) { m_response = response; }
179 const ResourceResponse& response() const { return m_response; } 188 const ResourceResponse& response() const { return m_response; }
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 312
304 unsigned long m_identifier; 313 unsigned long m_identifier;
305 314
306 unsigned m_encodedSize; 315 unsigned m_encodedSize;
307 unsigned m_decodedSize; 316 unsigned m_decodedSize;
308 unsigned m_accessCount; 317 unsigned m_accessCount;
309 unsigned m_handleCount; 318 unsigned m_handleCount;
310 unsigned m_preloadCount; 319 unsigned m_preloadCount;
311 320
312 unsigned m_preloadResult : 2; // PreloadResult 321 unsigned m_preloadResult : 2; // PreloadResult
322 unsigned m_cacheLiveResourcePriority : 2; // CacheLiveResourcePriority
313 323
314 bool m_inLiveDecodedResourcesList : 1; 324 bool m_inLiveDecodedResourcesList : 1;
315 bool m_requestedFromNetworkingLayer : 1; 325 bool m_requestedFromNetworkingLayer : 1;
316 326
317 bool m_inCache : 1; 327 bool m_inCache : 1;
318 bool m_loading : 1; 328 bool m_loading : 1;
319 329
320 bool m_switchingClientsToRevalidatedResource : 1; 330 bool m_switchingClientsToRevalidatedResource : 1;
321 331
322 unsigned m_type : 4; // Type 332 unsigned m_type : 4; // Type
(...skipping 19 matching lines...) Expand all
342 // If this field is non-null, the resource has a proxy for checking whether it is still up to date (see m_resourceToRevalidate). 352 // If this field is non-null, the resource has a proxy for checking whether it is still up to date (see m_resourceToRevalidate).
343 CachedResource* m_proxyResource; 353 CachedResource* m_proxyResource;
344 354
345 // These handles will need to be updated to point to the m_resourceToRevalid ate in case we get 304 response. 355 // These handles will need to be updated to point to the m_resourceToRevalid ate in case we get 304 response.
346 HashSet<CachedResourceHandleBase*> m_handlesToRevalidate; 356 HashSet<CachedResourceHandleBase*> m_handlesToRevalidate;
347 }; 357 };
348 358
349 } 359 }
350 360
351 #endif 361 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698