Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGPathByteStreamBuilder.cpp

Issue 2738863002: Replace ASSERT with DCHECK in core/svg/ (Closed)
Patch Set: Split DCHECKS wherever possible Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 19 matching lines...) Expand all
30 public: 30 public:
31 CoalescingBuffer(SVGPathByteStream& byteStream) 31 CoalescingBuffer(SVGPathByteStream& byteStream)
32 : m_currentOffset(0), m_byteStream(byteStream) {} 32 : m_currentOffset(0), m_byteStream(byteStream) {}
33 ~CoalescingBuffer() { m_byteStream.append(m_bytes, m_currentOffset); } 33 ~CoalescingBuffer() { m_byteStream.append(m_bytes, m_currentOffset); }
34 34
35 template <typename DataType> 35 template <typename DataType>
36 void writeType(DataType value) { 36 void writeType(DataType value) {
37 ByteType<DataType> data; 37 ByteType<DataType> data;
38 data.value = value; 38 data.value = value;
39 size_t typeSize = sizeof(ByteType<DataType>); 39 size_t typeSize = sizeof(ByteType<DataType>);
40 ASSERT(m_currentOffset + typeSize <= sizeof(m_bytes)); 40 DCHECK_LE(m_currentOffset + typeSize, sizeof(m_bytes));
41 memcpy(m_bytes + m_currentOffset, data.bytes, typeSize); 41 memcpy(m_bytes + m_currentOffset, data.bytes, typeSize);
42 m_currentOffset += typeSize; 42 m_currentOffset += typeSize;
43 } 43 }
44 44
45 void writeFlag(bool value) { writeType<bool>(value); } 45 void writeFlag(bool value) { writeType<bool>(value); }
46 void writeFloat(float value) { writeType<float>(value); } 46 void writeFloat(float value) { writeType<float>(value); }
47 void writeFloatPoint(const FloatPoint& point) { 47 void writeFloatPoint(const FloatPoint& point) {
48 writeType<float>(point.x()); 48 writeType<float>(point.x());
49 writeType<float>(point.y()); 49 writeType<float>(point.y());
50 } 50 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 buffer.writeFlag(segment.arcLarge); 110 buffer.writeFlag(segment.arcLarge);
111 buffer.writeFlag(segment.arcSweep); 111 buffer.writeFlag(segment.arcSweep);
112 buffer.writeFloatPoint(segment.targetPoint); 112 buffer.writeFloatPoint(segment.targetPoint);
113 break; 113 break;
114 default: 114 default:
115 ASSERT_NOT_REACHED(); 115 ASSERT_NOT_REACHED();
116 } 116 }
117 } 117 }
118 118
119 } // namespace blink 119 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGPathBlender.cpp ('k') | third_party/WebKit/Source/core/svg/SVGPathByteStreamSource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698