| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 // the address of the newly created FontPlatformData that is copied an owned | 71 // the address of the newly created FontPlatformData that is copied an owned |
| 72 // by SimpleFontData. | 72 // by SimpleFontData. |
| 73 m_cache.set(&newValue.first->platformData(), newValue); | 73 m_cache.set(&newValue.first->platformData(), newValue); |
| 74 if (shouldRetain == DoNotRetain) | 74 if (shouldRetain == DoNotRetain) |
| 75 m_inactiveFontData.insert(newValue.first); | 75 m_inactiveFontData.insert(newValue.first); |
| 76 return newValue.first.release(); | 76 return newValue.first.release(); |
| 77 } | 77 } |
| 78 | 78 |
| 79 if (!result.get()->value.second) { | 79 if (!result.get()->value.second) { |
| 80 ASSERT(m_inactiveFontData.contains(result.get()->value.first)); | 80 ASSERT(m_inactiveFontData.contains(result.get()->value.first)); |
| 81 m_inactiveFontData.remove(result.get()->value.first); | 81 m_inactiveFontData.erase(result.get()->value.first); |
| 82 } | 82 } |
| 83 | 83 |
| 84 if (shouldRetain == Retain) { | 84 if (shouldRetain == Retain) { |
| 85 result.get()->value.second++; | 85 result.get()->value.second++; |
| 86 } else if (!result.get()->value.second) { | 86 } else if (!result.get()->value.second) { |
| 87 // If shouldRetain is DoNotRetain and count is 0, we want to remove the | 87 // If shouldRetain is DoNotRetain and count is 0, we want to remove the |
| 88 // fontData from m_inactiveFontData (above) and re-add here to update LRU | 88 // fontData from m_inactiveFontData (above) and re-add here to update LRU |
| 89 // position. | 89 // position. |
| 90 m_inactiveFontData.insert(result.get()->value.first); | 90 m_inactiveFontData.insert(result.get()->value.first); |
| 91 } | 91 } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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.erase(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 |