Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 #include "wtf/Vector.h" | 25 #include "wtf/Vector.h" |
| 26 | 26 |
| 27 namespace blink { | 27 namespace blink { |
| 28 | 28 |
| 29 template<typename DataType> | 29 template<typename DataType> |
| 30 union ByteType { | 30 union ByteType { |
| 31 DataType value; | 31 DataType value; |
| 32 unsigned char bytes[sizeof(DataType)]; | 32 unsigned char bytes[sizeof(DataType)]; |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 class SVGPathByteStream { | 35 class SVGPathByteStream final { |
|
fs
2015/12/11 13:01:58
Redundant final.
Eric Willigers
2015/12/14 05:36:46
Acknowledged.
| |
| 36 USING_FAST_MALLOC(SVGPathByteStream); | 36 USING_FAST_MALLOC(SVGPathByteStream); |
| 37 public: | 37 public: |
| 38 static PassOwnPtr<SVGPathByteStream> create() | 38 static PassOwnPtr<SVGPathByteStream> create() |
| 39 { | 39 { |
| 40 return adoptPtr(new SVGPathByteStream); | 40 return adoptPtr(new SVGPathByteStream); |
| 41 } | 41 } |
| 42 | 42 |
| 43 PassOwnPtr<SVGPathByteStream> copy() const | 43 PassOwnPtr<SVGPathByteStream> copy() const |
| 44 { | 44 { |
| 45 return adoptPtr(new SVGPathByteStream(m_data)); | 45 return adoptPtr(new SVGPathByteStream(m_data)); |
| 46 } | 46 } |
| 47 | 47 |
| 48 typedef Vector<unsigned char> Data; | 48 typedef Vector<unsigned char> Data; |
| 49 typedef Data::const_iterator DataIterator; | 49 typedef Data::const_iterator DataIterator; |
| 50 | 50 |
| 51 DataIterator begin() const { return m_data.begin(); } | 51 DataIterator begin() const { return m_data.begin(); } |
| 52 DataIterator end() const { return m_data.end(); } | 52 DataIterator end() const { return m_data.end(); } |
| 53 void append(unsigned char byte) { m_data.append(byte); } | 53 void append(unsigned char byte) { m_data.append(byte); } |
| 54 void append(SVGPathByteStream* other) { m_data.appendVector(other->m_data); } | 54 void append(SVGPathByteStream* other) { m_data.appendVector(other->m_data); } |
| 55 void clear() { m_data.clear(); } | 55 void clear() { m_data.clear(); } |
| 56 void reserveInitialCapacity(size_t size) { m_data.reserveInitialCapacity(siz e); } | 56 void reserveInitialCapacity(size_t size) { m_data.reserveInitialCapacity(siz e); } |
| 57 void shrinkToFit() { m_data.shrinkToFit(); } | 57 void shrinkToFit() { m_data.shrinkToFit(); } |
| 58 bool isEmpty() const { return m_data.isEmpty(); } | 58 bool isEmpty() const { return m_data.isEmpty(); } |
| 59 unsigned size() const { return m_data.size(); } | 59 unsigned size() const { return m_data.size(); } |
| 60 | 60 |
| 61 bool operator==(const SVGPathByteStream& other) const { return m_data == oth er.m_data; } | |
| 62 | |
| 61 private: | 63 private: |
| 62 SVGPathByteStream() { } | 64 SVGPathByteStream() { } |
| 63 SVGPathByteStream(const Data& data) | 65 SVGPathByteStream(const Data& data) |
| 64 : m_data(data) | 66 : m_data(data) |
| 65 { | 67 { |
| 66 } | 68 } |
| 67 | 69 |
| 68 Data m_data; | 70 Data m_data; |
| 69 }; | 71 }; |
| 70 | 72 |
| 71 } // namespace blink | 73 } // namespace blink |
| 72 | 74 |
| 73 #endif // SVGPathByteStream_h | 75 #endif // SVGPathByteStream_h |
| OLD | NEW |