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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 SimpleFontData::Create(*platform_data, nullptr, false, | 64 SimpleFontData::Create(*platform_data, nullptr, false, |
65 subpixel_ascent_descent), | 65 subpixel_ascent_descent), |
66 should_retain == kRetain ? 1 : 0); | 66 should_retain == kRetain ? 1 : 0); |
67 // The new SimpleFontData takes a copy of the incoming FontPlatformData | 67 // The new SimpleFontData takes a copy of the incoming FontPlatformData |
68 // object. The incoming key may be temporary. So, for cache storage, take | 68 // object. The incoming key may be temporary. So, for cache storage, take |
69 // the address of the newly created FontPlatformData that is copied an owned | 69 // the address of the newly created FontPlatformData that is copied an owned |
70 // by SimpleFontData. | 70 // by SimpleFontData. |
71 cache_.Set(&new_value.first->PlatformData(), new_value); | 71 cache_.Set(&new_value.first->PlatformData(), new_value); |
72 if (should_retain == kDoNotRetain) | 72 if (should_retain == kDoNotRetain) |
73 inactive_font_data_.insert(new_value.first); | 73 inactive_font_data_.insert(new_value.first); |
74 return new_value.first.Release(); | 74 return std::move(new_value.first); |
75 } | 75 } |
76 | 76 |
77 if (!result.Get()->value.second) { | 77 if (!result.Get()->value.second) { |
78 DCHECK(inactive_font_data_.Contains(result.Get()->value.first)); | 78 DCHECK(inactive_font_data_.Contains(result.Get()->value.first)); |
79 inactive_font_data_.erase(result.Get()->value.first); | 79 inactive_font_data_.erase(result.Get()->value.first); |
80 } | 80 } |
81 | 81 |
82 if (should_retain == kRetain) { | 82 if (should_retain == kRetain) { |
83 result.Get()->value.second++; | 83 result.Get()->value.second++; |
84 } else if (!result.Get()->value.second) { | 84 } else if (!result.Get()->value.second) { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 bool did_work = font_data_to_delete.size(); | 162 bool did_work = font_data_to_delete.size(); |
163 | 163 |
164 font_data_to_delete.clear(); | 164 font_data_to_delete.clear(); |
165 | 165 |
166 is_purging = false; | 166 is_purging = false; |
167 | 167 |
168 return did_work; | 168 return did_work; |
169 } | 169 } |
170 | 170 |
171 } // namespace blink | 171 } // namespace blink |
OLD | NEW |