| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 DEFINE_THREAD_SAFE_STATIC_LOCAL( | 169 DEFINE_THREAD_SAFE_STATIC_LOCAL( |
| 170 CustomCountHistogram, sfnt_histogram, | 170 CustomCountHistogram, sfnt_histogram, |
| 171 new CustomCountHistogram("WebFont.DecodeSpeed.SFNT", 1000, 300000, 50)); | 171 new CustomCountHistogram("WebFont.DecodeSpeed.SFNT", 1000, 300000, 50)); |
| 172 sfnt_histogram.Count(kb_per_second); | 172 sfnt_histogram.Count(kb_per_second); |
| 173 } | 173 } |
| 174 | 174 |
| 175 } // namespace | 175 } // namespace |
| 176 | 176 |
| 177 // static | 177 // static |
| 178 bool WebFontDecoder::SupportsFormat(const String& format) { | 178 bool WebFontDecoder::SupportsFormat(const String& format) { |
| 179 return EqualIgnoringCase(format, "woff") || | 179 return DeprecatedEqualIgnoringCase(format, "woff") || |
| 180 EqualIgnoringCase(format, "woff2"); | 180 DeprecatedEqualIgnoringCase(format, "woff2"); |
| 181 } | 181 } |
| 182 | 182 |
| 183 sk_sp<SkTypeface> WebFontDecoder::Decode(SharedBuffer* buffer) { | 183 sk_sp<SkTypeface> WebFontDecoder::Decode(SharedBuffer* buffer) { |
| 184 if (!buffer) { | 184 if (!buffer) { |
| 185 SetErrorString("Empty Buffer"); | 185 SetErrorString("Empty Buffer"); |
| 186 return nullptr; | 186 return nullptr; |
| 187 } | 187 } |
| 188 | 188 |
| 189 // This is the largest web font size which we'll try to transcode. | 189 // This is the largest web font size which we'll try to transcode. |
| 190 // TODO(bashi): 30MB seems low. Update the limit if necessary. | 190 // TODO(bashi): 30MB seems low. Update the limit if necessary. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 if (!typeface) { | 226 if (!typeface) { |
| 227 SetErrorString("Not a valid font data"); | 227 SetErrorString("Not a valid font data"); |
| 228 return nullptr; | 228 return nullptr; |
| 229 } | 229 } |
| 230 | 230 |
| 231 decoded_size_ = decoded_length; | 231 decoded_size_ = decoded_length; |
| 232 return typeface; | 232 return typeface; |
| 233 } | 233 } |
| 234 | 234 |
| 235 } // namespace blink | 235 } // namespace blink |
| OLD | NEW |