| OLD | NEW | 
|    1 /* |    1 /* | 
|    2  * Copyright (C) 2006, 2009 Apple Inc. All rights reserved. |    2  * Copyright (C) 2006, 2009 Apple 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 |    5  * modification, are permitted provided that the following conditions | 
|    6  * are met: |    6  * are met: | 
|    7  * |    7  * | 
|    8  * 1.  Redistributions of source code must retain the above copyright |    8  * 1.  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  * 2.  Redistributions in binary form must reproduce the above copyright |   10  * 2.  Redistributions in binary form must reproduce the above copyright | 
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   50     T metricsForGlyph(Glyph glyph) |   50     T metricsForGlyph(Glyph glyph) | 
|   51     { |   51     { | 
|   52         return locatePage(glyph / GlyphMetricsPage::size)->metricsForGlyph(glyph
     ); |   52         return locatePage(glyph / GlyphMetricsPage::size)->metricsForGlyph(glyph
     ); | 
|   53     } |   53     } | 
|   54  |   54  | 
|   55     void setMetricsForGlyph(Glyph glyph, const T& metrics) |   55     void setMetricsForGlyph(Glyph glyph, const T& metrics) | 
|   56     { |   56     { | 
|   57         locatePage(glyph / GlyphMetricsPage::size)->setMetricsForGlyph(glyph, me
     trics); |   57         locatePage(glyph / GlyphMetricsPage::size)->setMetricsForGlyph(glyph, me
     trics); | 
|   58     } |   58     } | 
|   59  |   59  | 
 |   60     size_t memoryUsageInBytes() | 
 |   61     { | 
 |   62         size_t totalValue = sizeof(*this); | 
 |   63         if (m_pages) { | 
 |   64             totalValue += m_pages->size() * sizeof(GlyphMetricsPage); | 
 |   65         } | 
 |   66         return totalValue; | 
 |   67     } | 
 |   68  | 
|   60 private: |   69 private: | 
|   61     class GlyphMetricsPage { |   70     class GlyphMetricsPage { | 
|   62         USING_FAST_MALLOC(GlyphMetricsPage); |   71         USING_FAST_MALLOC(GlyphMetricsPage); | 
|   63         WTF_MAKE_NONCOPYABLE(GlyphMetricsPage); |   72         WTF_MAKE_NONCOPYABLE(GlyphMetricsPage); | 
|   64     public: |   73     public: | 
|   65         static const size_t size = 256; // Usually covers Latin-1 in a single pa
     ge. |   74         static const size_t size = 256; // Usually covers Latin-1 in a single pa
     ge. | 
|   66         GlyphMetricsPage() { } |   75         GlyphMetricsPage() { } | 
|   67  |   76  | 
|   68         T metricsForGlyph(Glyph glyph) const { return m_metrics[glyph % size]; } |   77         T metricsForGlyph(Glyph glyph) const { return m_metrics[glyph % size]; } | 
|   69         void setMetricsForGlyph(Glyph glyph, const T& metrics) |   78         void setMetricsForGlyph(Glyph glyph, const T& metrics) | 
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  128     // Fill in the whole page with the unknown glyph information. |  137     // Fill in the whole page with the unknown glyph information. | 
|  129     for (unsigned i = 0; i < GlyphMetricsPage::size; i++) |  138     for (unsigned i = 0; i < GlyphMetricsPage::size; i++) | 
|  130         page->setMetricsForIndex(i, unknownMetrics()); |  139         page->setMetricsForIndex(i, unknownMetrics()); | 
|  131  |  140  | 
|  132     return page; |  141     return page; | 
|  133 } |  142 } | 
|  134  |  143  | 
|  135 } // namespace blink |  144 } // namespace blink | 
|  136  |  145  | 
|  137 #endif |  146 #endif | 
| OLD | NEW |