OLD | NEW |
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 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
883 if (!m_data) | 883 if (!m_data) |
884 return true; | 884 return true; |
885 if (m_data->isLocked()) | 885 if (m_data->isLocked()) |
886 return true; | 886 return true; |
887 | 887 |
888 ASSERT(!hasClients()); | 888 ASSERT(!hasClients()); |
889 | 889 |
890 // If locking fails, our buffer has been purged. There's no point | 890 // If locking fails, our buffer has been purged. There's no point |
891 // in leaving a purged resource in MemoryCache. | 891 // in leaving a purged resource in MemoryCache. |
892 if (!m_data->lock()) { | 892 if (!m_data->lock()) { |
| 893 m_data.clear(); |
| 894 setEncodedSize(0); |
893 memoryCache()->remove(this); | 895 memoryCache()->remove(this); |
894 return false; | 896 return false; |
895 } | 897 } |
896 return true; | 898 return true; |
897 } | 899 } |
898 | 900 |
899 size_t Resource::overheadSize() const | 901 size_t Resource::overheadSize() const |
900 { | 902 { |
901 static const int kAverageClientsHashMapSize = 384; | 903 static const int kAverageClientsHashMapSize = 384; |
902 return sizeof(Resource) + m_response.memoryUsage() + kAverageClientsHashMapS
ize + m_resourceRequest.url().getString().length() * 2; | 904 return sizeof(Resource) + m_response.memoryUsage() + kAverageClientsHashMapS
ize + m_resourceRequest.url().getString().length() * 2; |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1098 case Resource::Media: | 1100 case Resource::Media: |
1099 return "Media"; | 1101 return "Media"; |
1100 case Resource::Manifest: | 1102 case Resource::Manifest: |
1101 return "Manifest"; | 1103 return "Manifest"; |
1102 } | 1104 } |
1103 ASSERT_NOT_REACHED(); | 1105 ASSERT_NOT_REACHED(); |
1104 return "Unknown"; | 1106 return "Unknown"; |
1105 } | 1107 } |
1106 | 1108 |
1107 } // namespace blink | 1109 } // namespace blink |
OLD | NEW |