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

Side by Side Diff: third_party/WebKit/Source/core/dom/Text.cpp

Issue 2919443002: Use IMMEDIATE_CRASH() instead of CRASH() directly (Closed)
Patch Set: Use IMMEDIATE_CRASH() instead of CRASH() directly Created 3 years, 6 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
5 * reserved. 5 * reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 const Text* end_text = LatestLogicallyAdjacentTextNode(this); 169 const Text* end_text = LatestLogicallyAdjacentTextNode(this);
170 170
171 Node* one_past_end_text = end_text->nextSibling(); 171 Node* one_past_end_text = end_text->nextSibling();
172 unsigned result_length = 0; 172 unsigned result_length = 0;
173 for (const Node* n = start_text; n != one_past_end_text; 173 for (const Node* n = start_text; n != one_past_end_text;
174 n = n->nextSibling()) { 174 n = n->nextSibling()) {
175 if (!n->IsTextNode()) 175 if (!n->IsTextNode())
176 continue; 176 continue;
177 const String& data = ToText(n)->data(); 177 const String& data = ToText(n)->data();
178 if (std::numeric_limits<unsigned>::max() - data.length() < result_length) 178 if (std::numeric_limits<unsigned>::max() - data.length() < result_length)
179 CRASH(); 179 IMMEDIATE_CRASH();
180 result_length += data.length(); 180 result_length += data.length();
181 } 181 }
182 StringBuilder result; 182 StringBuilder result;
183 result.ReserveCapacity(result_length); 183 result.ReserveCapacity(result_length);
184 for (const Node* n = start_text; n != one_past_end_text; 184 for (const Node* n = start_text; n != one_past_end_text;
185 n = n->nextSibling()) { 185 n = n->nextSibling()) {
186 if (!n->IsTextNode()) 186 if (!n->IsTextNode())
187 continue; 187 continue;
188 result.Append(ToText(n)->data()); 188 result.Append(ToText(n)->data());
189 } 189 }
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 471
472 Text* Text::CloneWithData(const String& data) { 472 Text* Text::CloneWithData(const String& data) {
473 return Create(GetDocument(), data); 473 return Create(GetDocument(), data);
474 } 474 }
475 475
476 DEFINE_TRACE(Text) { 476 DEFINE_TRACE(Text) {
477 CharacterData::Trace(visitor); 477 CharacterData::Trace(visitor);
478 } 478 }
479 479
480 } // namespace blink 480 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutTableCell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698