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

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: Fix drawImage out of bounds src rect. 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 enum CachePriority {
84 CachePriorityLow = 0,
85 CachePriorityMedium,
86 CachePriorityHigh
87 };
88
83 CachedResource(const ResourceRequest&, Type); 89 CachedResource(const ResourceRequest&, Type);
84 virtual ~CachedResource(); 90 virtual ~CachedResource();
85 91
86 virtual void load(ResourceFetcher*, const ResourceLoaderOptions&); 92 virtual void load(ResourceFetcher*, 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
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 bool passesAccessControlCheck(SecurityOrigin*); 166 bool passesAccessControlCheck(SecurityOrigin*);
161 bool passesAccessControlCheck(SecurityOrigin*, String& errorDescription); 167 bool passesAccessControlCheck(SecurityOrigin*, String& errorDescription);
162 168
163 // Called by the cache if the object has been removed from the cache 169 // 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 170 // while still being referenced. This means the object should delete itself
165 // if the number of clients observing it ever drops to 0. 171 // if the number of clients observing it ever drops to 0.
166 // The resource can be brought back to cache after successful revalidation. 172 // The resource can be brought back to cache after successful revalidation.
167 void setInCache(bool inCache) { m_inCache = inCache; } 173 void setInCache(bool inCache) { m_inCache = inCache; }
168 bool inCache() const { return m_inCache; } 174 bool inCache() const { return m_inCache; }
169 175
176 void setCachePriority(CachePriority);
177 unsigned cachePriority() const { return m_cachePriority; }
170 bool inLiveDecodedResourcesList() { return m_inLiveDecodedResourcesList; } 178 bool inLiveDecodedResourcesList() { return m_inLiveDecodedResourcesList; }
171 179
172 void clearLoader(); 180 void clearLoader();
173 181
174 SharedBuffer* resourceBuffer() const { ASSERT(!m_purgeableData); return m_da ta.get(); } 182 SharedBuffer* resourceBuffer() const { ASSERT(!m_purgeableData); return m_da ta.get(); }
175 183
176 virtual void willSendRequest(ResourceRequest&, const ResourceResponse&) { m_ requestedFromNetworkingLayer = true; } 184 virtual void willSendRequest(ResourceRequest&, const ResourceResponse&) { m_ requestedFromNetworkingLayer = true; }
177 virtual void responseReceived(const ResourceResponse&); 185 virtual void responseReceived(const ResourceResponse&);
178 void setResponse(const ResourceResponse& response) { m_response = response; } 186 void setResponse(const ResourceResponse& response) { m_response = response; }
179 const ResourceResponse& response() const { return m_response; } 187 const ResourceResponse& response() const { return m_response; }
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 311
304 unsigned long m_identifier; 312 unsigned long m_identifier;
305 313
306 unsigned m_encodedSize; 314 unsigned m_encodedSize;
307 unsigned m_decodedSize; 315 unsigned m_decodedSize;
308 unsigned m_accessCount; 316 unsigned m_accessCount;
309 unsigned m_handleCount; 317 unsigned m_handleCount;
310 unsigned m_preloadCount; 318 unsigned m_preloadCount;
311 319
312 unsigned m_preloadResult : 2; // PreloadResult 320 unsigned m_preloadResult : 2; // PreloadResult
321 unsigned m_cachePriority : 2; // CachePriority
313 322
314 bool m_inLiveDecodedResourcesList : 1; 323 bool m_inLiveDecodedResourcesList : 1;
315 bool m_requestedFromNetworkingLayer : 1; 324 bool m_requestedFromNetworkingLayer : 1;
316 325
317 bool m_inCache : 1; 326 bool m_inCache : 1;
318 bool m_loading : 1; 327 bool m_loading : 1;
319 328
320 bool m_switchingClientsToRevalidatedResource : 1; 329 bool m_switchingClientsToRevalidatedResource : 1;
321 330
322 unsigned m_type : 4; // Type 331 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). 351 // 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; 352 CachedResource* m_proxyResource;
344 353
345 // These handles will need to be updated to point to the m_resourceToRevalid ate in case we get 304 response. 354 // 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; 355 HashSet<CachedResourceHandleBase*> m_handlesToRevalidate;
347 }; 356 };
348 357
349 } 358 }
350 359
351 #endif 360 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698