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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
63 { | 63 { |
64 return *getConsecutiveData(dataPosition, 1, 0); | 64 return *getConsecutiveData(dataPosition, 1, 0); |
65 } | 65 } |
66 | 66 |
67 size_t size() const | 67 size_t size() const |
68 { | 68 { |
69 return m_data->size(); | 69 return m_data->size(); |
70 } | 70 } |
71 | 71 |
72 private: | 72 private: |
73 void getSomeDataIntoCache(unsigned dataPosition); | |
74 | |
73 RefPtr<SharedBuffer> m_data; | 75 RefPtr<SharedBuffer> m_data; |
74 | 76 |
75 // Caches the last segment of |m_data| accessed, since subsequent reads are | 77 struct Cache { |
Peter Kasting
2015/03/25 19:53:11
I don't see what adding this struct buys other tha
| |
76 // likely to re-access it. | 78 Cache(); |
77 const char* m_segment; | |
78 size_t m_segmentLength; | |
79 | 79 |
80 // Data position in |m_data| pointed by |m_segment|. | 80 // Caches the last segment of |m_data| accessed, since subsequent reads are |
81 size_t m_dataPosition; | 81 // likely to re-access it. |
82 const char* segment; | |
83 size_t segmentLength; | |
84 | |
85 // Data position in |m_data| pointed by |segment|. | |
86 size_t dataPosition; | |
87 } m_cache; | |
82 }; | 88 }; |
83 | 89 |
84 } // namespace blink | 90 } // namespace blink |
85 | 91 |
86 #endif | 92 #endif |
OLD | NEW |