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

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

Issue 16379004: Android should be able to discard CachedResources (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase 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/CachedResource.h ('k') | Source/core/platform/PurgePriority.h » ('j') | 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 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 828
829 // Should not make buffer purgeable if it has refs other than this since we don't want two copies. 829 // Should not make buffer purgeable if it has refs other than this since we don't want two copies.
830 if (!m_data->hasOneRef()) 830 if (!m_data->hasOneRef())
831 return false; 831 return false;
832 832
833 m_data->createPurgeableBuffer(); 833 m_data->createPurgeableBuffer();
834 if (!m_data->hasPurgeableBuffer()) 834 if (!m_data->hasPurgeableBuffer())
835 return false; 835 return false;
836 836
837 m_purgeableData = m_data->releasePurgeableBuffer(); 837 m_purgeableData = m_data->releasePurgeableBuffer();
838 m_purgeableData->setPurgePriority(purgePriority()); 838 m_purgeableData->unlock();
839 m_purgeableData->makePurgeable(true);
840 m_data.clear(); 839 m_data.clear();
841 return true; 840 return true;
842 } 841 }
843 842
844 if (!m_purgeableData) 843 if (!m_purgeableData)
845 return true; 844 return true;
845
846 ASSERT(!m_data); 846 ASSERT(!m_data);
847 ASSERT(!hasClients()); 847 ASSERT(!hasClients());
848 848
849 if (!m_purgeableData->makePurgeable(false)) 849 if (!m_purgeableData->lock())
850 return false; 850 return false;
851 851
852 m_data = SharedBuffer::adoptPurgeableBuffer(m_purgeableData.release()); 852 m_data = SharedBuffer::adoptPurgeableBuffer(m_purgeableData.release());
853 return true; 853 return true;
854 } 854 }
855 855
856 bool CachedResource::isPurgeable() const 856 bool CachedResource::isPurgeable() const
857 { 857 {
858 return m_purgeableData && m_purgeableData->isPurgeable(); 858 return m_purgeableData && m_purgeableData->isPurgeable();
859 } 859 }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 info.addMember(m_proxyResource, "proxyResource"); 920 info.addMember(m_proxyResource, "proxyResource");
921 info.addMember(m_handlesToRevalidate, "handlesToRevalidate"); 921 info.addMember(m_handlesToRevalidate, "handlesToRevalidate");
922 info.addMember(m_options, "options"); 922 info.addMember(m_options, "options");
923 info.addMember(m_decodedDataDeletionTimer, "decodedDataDeletionTimer"); 923 info.addMember(m_decodedDataDeletionTimer, "decodedDataDeletionTimer");
924 info.ignoreMember(m_clientsAwaitingCallback); 924 info.ignoreMember(m_clientsAwaitingCallback);
925 925
926 if (m_purgeableData && !m_purgeableData->wasPurged()) 926 if (m_purgeableData && !m_purgeableData->wasPurged())
927 info.addRawBuffer(m_purgeableData.get(), m_purgeableData->size(), "Purge ableData", "purgeableData"); 927 info.addRawBuffer(m_purgeableData.get(), m_purgeableData->size(), "Purge ableData", "purgeableData");
928 } 928 }
929 } 929 }
OLDNEW
« no previous file with comments | « Source/core/loader/cache/CachedResource.h ('k') | Source/core/platform/PurgePriority.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698