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

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

Issue 19393004: Allow eviction of ImageBitmaps that are created from ImageElements. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Use CachedImage as the backing store for ImageBitmap. Implement O(1) decode cache. 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) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 , m_cancelTimer(this, &CachedResource::cancelTimerFired) 112 , m_cancelTimer(this, &CachedResource::cancelTimerFired)
113 , m_lastDecodedAccessTime(0) 113 , m_lastDecodedAccessTime(0)
114 , m_loadFinishTime(0) 114 , m_loadFinishTime(0)
115 , m_identifier(0) 115 , m_identifier(0)
116 , m_encodedSize(0) 116 , m_encodedSize(0)
117 , m_decodedSize(0) 117 , m_decodedSize(0)
118 , m_accessCount(0) 118 , m_accessCount(0)
119 , m_handleCount(0) 119 , m_handleCount(0)
120 , m_preloadCount(0) 120 , m_preloadCount(0)
121 , m_preloadResult(PreloadNotReferenced) 121 , m_preloadResult(PreloadNotReferenced)
122 , m_decodePriority(DecodePriorityLow)
122 , m_inLiveDecodedResourcesList(false) 123 , m_inLiveDecodedResourcesList(false)
123 , m_requestedFromNetworkingLayer(false) 124 , m_requestedFromNetworkingLayer(false)
124 , m_inCache(false) 125 , m_inCache(false)
125 , m_loading(false) 126 , m_loading(false)
126 , m_switchingClientsToRevalidatedResource(false) 127 , m_switchingClientsToRevalidatedResource(false)
127 , m_type(type) 128 , m_type(type)
128 , m_status(Pending) 129 , m_status(Pending)
129 #ifndef NDEBUG 130 #ifndef NDEBUG
130 , m_deleted(false) 131 , m_deleted(false)
131 , m_lruIndex(0) 132 , m_lruIndex(0)
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 ResourceHandle::cacheMetadata(m_response, m_cachedMetadata->serialize()); 349 ResourceHandle::cacheMetadata(m_response, m_cachedMetadata->serialize());
349 } 350 }
350 351
351 CachedMetadata* CachedResource::cachedMetadata(unsigned dataTypeID) const 352 CachedMetadata* CachedResource::cachedMetadata(unsigned dataTypeID) const
352 { 353 {
353 if (!m_cachedMetadata || m_cachedMetadata->dataTypeID() != dataTypeID) 354 if (!m_cachedMetadata || m_cachedMetadata->dataTypeID() != dataTypeID)
354 return 0; 355 return 0;
355 return m_cachedMetadata.get(); 356 return m_cachedMetadata.get();
356 } 357 }
357 358
359 void CachedResource::setDecodePriority(DecodePriority priority)
360 {
361 m_lastDecodedAccessTime = currentTime();
362 if (inCache()) {
363 if (m_inLiveDecodedResourcesList && m_decodePriority != priority) {
364 memoryCache()->removeFromLiveDecodedResourcesList(this);
365 m_decodePriority = priority;
366 memoryCache()->insertInLiveDecodedResourcesList(this);
367 }
368 memoryCache()->prune();
369 }
370 }
371
358 void CachedResource::clearLoader() 372 void CachedResource::clearLoader()
359 { 373 {
360 m_loader = 0; 374 m_loader = 0;
361 } 375 }
362 376
363 void CachedResource::addClient(CachedResourceClient* client) 377 void CachedResource::addClient(CachedResourceClient* client)
364 { 378 {
365 if (addClientToSet(client)) 379 if (addClientToSet(client))
366 didAddClient(client); 380 didAddClient(client);
367 } 381 }
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 memoryCache()->insertInLRUList(this); 558 memoryCache()->insertInLRUList(this);
545 559
546 // Update the cache's size totals. 560 // Update the cache's size totals.
547 memoryCache()->adjustSize(hasClients(), delta); 561 memoryCache()->adjustSize(hasClients(), delta);
548 } 562 }
549 } 563 }
550 564
551 void CachedResource::didAccessDecodedData(double timeStamp) 565 void CachedResource::didAccessDecodedData(double timeStamp)
552 { 566 {
553 m_lastDecodedAccessTime = timeStamp; 567 m_lastDecodedAccessTime = timeStamp;
554
Justin Novosad 2013/07/23 16:55:12 Don't do whitespace edits unless you are changing
555 if (inCache()) { 568 if (inCache()) {
556 if (m_inLiveDecodedResourcesList) { 569 if (m_inLiveDecodedResourcesList) {
557 memoryCache()->removeFromLiveDecodedResourcesList(this); 570 memoryCache()->removeFromLiveDecodedResourcesList(this);
558 memoryCache()->insertInLiveDecodedResourcesList(this); 571 memoryCache()->insertInLiveDecodedResourcesList(this);
559 } 572 }
560 memoryCache()->prune(); 573 memoryCache()->prune();
561 } 574 }
562 } 575 }
563 576
564 void CachedResource::setResourceToRevalidate(CachedResource* resource) 577 void CachedResource::setResourceToRevalidate(CachedResource* resource)
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 info.addMember(m_proxyResource, "proxyResource"); 887 info.addMember(m_proxyResource, "proxyResource");
875 info.addMember(m_handlesToRevalidate, "handlesToRevalidate"); 888 info.addMember(m_handlesToRevalidate, "handlesToRevalidate");
876 info.addMember(m_options, "options"); 889 info.addMember(m_options, "options");
877 info.addMember(m_decodedDataDeletionTimer, "decodedDataDeletionTimer"); 890 info.addMember(m_decodedDataDeletionTimer, "decodedDataDeletionTimer");
878 info.ignoreMember(m_clientsAwaitingCallback); 891 info.ignoreMember(m_clientsAwaitingCallback);
879 892
880 if (m_purgeableData && !m_purgeableData->wasPurged()) 893 if (m_purgeableData && !m_purgeableData->wasPurged())
881 info.addRawBuffer(m_purgeableData.get(), m_purgeableData->size(), "Purge ableData", "purgeableData"); 894 info.addRawBuffer(m_purgeableData.get(), m_purgeableData->size(), "Purge ableData", "purgeableData");
882 } 895 }
883 } 896 }
897
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698