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

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

Issue 17436003: Evict CachedResources if they are cancelled due to last client being removed. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 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
« no previous file with comments | « Source/core/loader/cache/CachedImageTest.cpp ('k') | no next file » | 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) 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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 if (url().protocolIs("https")) 440 if (url().protocolIs("https"))
441 memoryCache()->remove(this); 441 memoryCache()->remove(this);
442 } else 442 } else
443 memoryCache()->prune(); 443 memoryCache()->prune();
444 } 444 }
445 // This object may be dead here. 445 // This object may be dead here.
446 } 446 }
447 447
448 void CachedResource::allClientsRemoved() 448 void CachedResource::allClientsRemoved()
449 { 449 {
450 if (!m_loader)
451 return;
450 if (m_type == MainResource || m_type == RawResource) 452 if (m_type == MainResource || m_type == RawResource)
451 cancelTimerFired(&m_cancelTimer); 453 cancelTimerFired(&m_cancelTimer);
452 else if (!m_cancelTimer.isActive()) 454 else if (!m_cancelTimer.isActive())
453 m_cancelTimer.startOneShot(0); 455 m_cancelTimer.startOneShot(0);
454 } 456 }
455 457
456 void CachedResource::cancelTimerFired(Timer<CachedResource>* timer) 458 void CachedResource::cancelTimerFired(Timer<CachedResource>* timer)
457 { 459 {
458 ASSERT_UNUSED(timer, timer == &m_cancelTimer); 460 ASSERT_UNUSED(timer, timer == &m_cancelTimer);
459 if (hasClients() || !m_loader) 461 if (hasClients() || !m_loader)
460 return; 462 return;
461 m_loader->cancelIfNotFinishing(); 463 m_loader->cancelIfNotFinishing();
464 if (m_status != Cached)
465 memoryCache()->remove(this);
462 } 466 }
463 467
464 void CachedResource::destroyDecodedDataIfNeeded() 468 void CachedResource::destroyDecodedDataIfNeeded()
465 { 469 {
466 if (!m_decodedSize) 470 if (!m_decodedSize)
467 return; 471 return;
468 472
469 if (double interval = memoryCache()->deadDecodedDataDeletionInterval()) 473 if (double interval = memoryCache()->deadDecodedDataDeletionInterval())
470 m_decodedDataDeletionTimer.startOneShot(interval); 474 m_decodedDataDeletionTimer.startOneShot(interval);
471 } 475 }
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 info.addMember(m_proxyResource, "proxyResource"); 886 info.addMember(m_proxyResource, "proxyResource");
883 info.addMember(m_handlesToRevalidate, "handlesToRevalidate"); 887 info.addMember(m_handlesToRevalidate, "handlesToRevalidate");
884 info.addMember(m_options, "options"); 888 info.addMember(m_options, "options");
885 info.addMember(m_decodedDataDeletionTimer, "decodedDataDeletionTimer"); 889 info.addMember(m_decodedDataDeletionTimer, "decodedDataDeletionTimer");
886 info.ignoreMember(m_clientsAwaitingCallback); 890 info.ignoreMember(m_clientsAwaitingCallback);
887 891
888 if (m_purgeableData && !m_purgeableData->wasPurged()) 892 if (m_purgeableData && !m_purgeableData->wasPurged())
889 info.addRawBuffer(m_purgeableData.get(), m_purgeableData->size(), "Purge ableData", "purgeableData"); 893 info.addRawBuffer(m_purgeableData.get(), m_purgeableData->size(), "Purge ableData", "purgeableData");
890 } 894 }
891 } 895 }
OLDNEW
« no previous file with comments | « Source/core/loader/cache/CachedImageTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698