| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 if (isPurging) | 139 if (isPurging) |
| 140 return false; | 140 return false; |
| 141 | 141 |
| 142 isPurging = true; | 142 isPurging = true; |
| 143 | 143 |
| 144 Vector<RefPtr<SimpleFontData>, 20> fontDataToDelete; | 144 Vector<RefPtr<SimpleFontData>, 20> fontDataToDelete; |
| 145 ListHashSet<RefPtr<SimpleFontData>>::iterator end = m_inactiveFontData.end(); | 145 ListHashSet<RefPtr<SimpleFontData>>::iterator end = m_inactiveFontData.end(); |
| 146 ListHashSet<RefPtr<SimpleFontData>>::iterator it = m_inactiveFontData.begin(); | 146 ListHashSet<RefPtr<SimpleFontData>>::iterator it = m_inactiveFontData.begin(); |
| 147 for (int i = 0; i < count && it != end; ++it, ++i) { | 147 for (int i = 0; i < count && it != end; ++it, ++i) { |
| 148 RefPtr<SimpleFontData>& fontData = *it.get(); | 148 RefPtr<SimpleFontData>& fontData = *it.get(); |
| 149 m_cache.remove(&(fontData->platformData())); | 149 m_cache.erase(&(fontData->platformData())); |
| 150 // We should not delete SimpleFontData here because deletion can modify | 150 // We should not delete SimpleFontData here because deletion can modify |
| 151 // m_inactiveFontData. See http://trac.webkit.org/changeset/44011 | 151 // m_inactiveFontData. See http://trac.webkit.org/changeset/44011 |
| 152 fontDataToDelete.push_back(fontData); | 152 fontDataToDelete.push_back(fontData); |
| 153 } | 153 } |
| 154 | 154 |
| 155 if (it == end) { | 155 if (it == end) { |
| 156 // Removed everything | 156 // Removed everything |
| 157 m_inactiveFontData.clear(); | 157 m_inactiveFontData.clear(); |
| 158 } else { | 158 } else { |
| 159 for (int i = 0; i < count; ++i) | 159 for (int i = 0; i < count; ++i) |
| 160 m_inactiveFontData.remove(m_inactiveFontData.begin()); | 160 m_inactiveFontData.remove(m_inactiveFontData.begin()); |
| 161 } | 161 } |
| 162 | 162 |
| 163 bool didWork = fontDataToDelete.size(); | 163 bool didWork = fontDataToDelete.size(); |
| 164 | 164 |
| 165 fontDataToDelete.clear(); | 165 fontDataToDelete.clear(); |
| 166 | 166 |
| 167 isPurging = false; | 167 isPurging = false; |
| 168 | 168 |
| 169 return didWork; | 169 return didWork; |
| 170 } | 170 } |
| 171 | 171 |
| 172 } // namespace blink | 172 } // namespace blink |
| OLD | NEW |