OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2015 Google Inc. All rights reserved. | 2 * Copyright (C) 2015 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 { | 74 { |
75 return m_data->size(); | 75 return m_data->size(); |
76 } | 76 } |
77 | 77 |
78 // This class caches the last access for faster subsequent reads. This | 78 // This class caches the last access for faster subsequent reads. This |
79 // method clears that cache in case the SharedBuffer has been modified | 79 // method clears that cache in case the SharedBuffer has been modified |
80 // (i.e. with mergeSegmentsIntoBuffer). | 80 // (i.e. with mergeSegmentsIntoBuffer). |
81 void clearCache(); | 81 void clearCache(); |
82 | 82 |
83 private: | 83 private: |
84 void getSomeDataInternal(unsigned dataPosition) const; | 84 void getSomeDataInternal(size_t dataPosition) const; |
85 | 85 |
86 RefPtr<SharedBuffer> m_data; | 86 RefPtr<SharedBuffer> m_data; |
87 | 87 |
88 // Caches the last segment of |m_data| accessed, since subsequent reads are | 88 // Caches the last segment of |m_data| accessed, since subsequent reads are |
89 // likely to re-access it. | 89 // likely to re-access it. |
90 mutable const char* m_segment; | 90 mutable const char* m_segment; |
91 mutable size_t m_segmentLength; | 91 mutable size_t m_segmentLength; |
92 | 92 |
93 // Data position in |m_data| pointed to by |m_segment|. | 93 // Data position in |m_data| pointed to by |m_segment|. |
94 mutable size_t m_dataPosition; | 94 mutable size_t m_dataPosition; |
95 }; | 95 }; |
96 | 96 |
97 } // namespace blink | 97 } // namespace blink |
98 | 98 |
99 #endif | 99 #endif |
OLD | NEW |