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

Side by Side Diff: Source/core/editing/TextIterator.cpp

Issue 397733004: Allow assertions to be enabled in Blink Release builds. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased. Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/editing/EditCommand.h ('k') | Source/core/editing/VisiblePosition.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved.
3 * Copyright (C) 2005 Alexey Proskuryakov. 3 * Copyright (C) 2005 Alexey Proskuryakov.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after
1275 setUpFullyClippedStack(m_fullyClippedStack, m_node); 1275 setUpFullyClippedStack(m_fullyClippedStack, m_node);
1276 m_offset = endOffset; 1276 m_offset = endOffset;
1277 m_handledNode = false; 1277 m_handledNode = false;
1278 m_handledChildren = !endOffset; 1278 m_handledChildren = !endOffset;
1279 1279
1280 m_startNode = startNode; 1280 m_startNode = startNode;
1281 m_startOffset = startOffset; 1281 m_startOffset = startOffset;
1282 m_endNode = endNode; 1282 m_endNode = endNode;
1283 m_endOffset = endOffset; 1283 m_endOffset = endOffset;
1284 1284
1285 #ifndef NDEBUG 1285 #if ENABLE(ASSERT)
1286 // Need this just because of the assert. 1286 // Need this just because of the assert.
1287 m_positionNode = endNode; 1287 m_positionNode = endNode;
1288 #endif 1288 #endif
1289 1289
1290 m_lastTextNode = nullptr; 1290 m_lastTextNode = nullptr;
1291 m_lastCharacter = '\n'; 1291 m_lastCharacter = '\n';
1292 1292
1293 m_havePassedStartNode = false; 1293 m_havePassedStartNode = false;
1294 1294
1295 advance(); 1295 advance();
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
1749 { 1749 {
1750 if (!m_buffer.isEmpty()) 1750 if (!m_buffer.isEmpty())
1751 return m_buffer[index]; 1751 return m_buffer[index];
1752 return m_textIterator.characterAt(index); 1752 return m_textIterator.characterAt(index);
1753 } 1753 }
1754 1754
1755 // -------- 1755 // --------
1756 1756
1757 static const size_t minimumSearchBufferSize = 8192; 1757 static const size_t minimumSearchBufferSize = 8192;
1758 1758
1759 #ifndef NDEBUG 1759 #if ENABLE(ASSERT)
1760 static bool searcherInUse; 1760 static bool searcherInUse;
1761 #endif 1761 #endif
1762 1762
1763 static UStringSearch* createSearcher() 1763 static UStringSearch* createSearcher()
1764 { 1764 {
1765 // Provide a non-empty pattern and non-empty text so usearch_open will not f ail, 1765 // Provide a non-empty pattern and non-empty text so usearch_open will not f ail,
1766 // but it doesn't matter exactly what it is, since we don't perform any sear ches 1766 // but it doesn't matter exactly what it is, since we don't perform any sear ches
1767 // without setting both the pattern and the text. 1767 // without setting both the pattern and the text.
1768 UErrorCode status = U_ZERO_ERROR; 1768 UErrorCode status = U_ZERO_ERROR;
1769 String searchCollatorName = currentSearchLocaleID() + String("@collation=sea rch"); 1769 String searchCollatorName = currentSearchLocaleID() + String("@collation=sea rch");
1770 UStringSearch* searcher = usearch_open(&newlineCharacter, 1, &newlineCharact er, 1, searchCollatorName.utf8().data(), 0, &status); 1770 UStringSearch* searcher = usearch_open(&newlineCharacter, 1, &newlineCharact er, 1, searchCollatorName.utf8().data(), 0, &status);
1771 ASSERT(status == U_ZERO_ERROR || status == U_USING_FALLBACK_WARNING || statu s == U_USING_DEFAULT_WARNING); 1771 ASSERT(status == U_ZERO_ERROR || status == U_USING_FALLBACK_WARNING || statu s == U_USING_DEFAULT_WARNING);
1772 return searcher; 1772 return searcher;
1773 } 1773 }
1774 1774
1775 static UStringSearch* searcher() 1775 static UStringSearch* searcher()
1776 { 1776 {
1777 static UStringSearch* searcher = createSearcher(); 1777 static UStringSearch* searcher = createSearcher();
1778 return searcher; 1778 return searcher;
1779 } 1779 }
1780 1780
1781 static inline void lockSearcher() 1781 static inline void lockSearcher()
1782 { 1782 {
1783 #ifndef NDEBUG 1783 #if ENABLE(ASSERT)
1784 ASSERT(!searcherInUse); 1784 ASSERT(!searcherInUse);
1785 searcherInUse = true; 1785 searcherInUse = true;
1786 #endif 1786 #endif
1787 } 1787 }
1788 1788
1789 static inline void unlockSearcher() 1789 static inline void unlockSearcher()
1790 { 1790 {
1791 #ifndef NDEBUG 1791 #if ENABLE(ASSERT)
1792 ASSERT(searcherInUse); 1792 ASSERT(searcherInUse);
1793 searcherInUse = false; 1793 searcherInUse = false;
1794 #endif 1794 #endif
1795 } 1795 }
1796 1796
1797 inline SearchBuffer::SearchBuffer(const String& target, FindOptions options) 1797 inline SearchBuffer::SearchBuffer(const String& target, FindOptions options)
1798 : m_options(options) 1798 : m_options(options)
1799 , m_prefixLength(0) 1799 , m_prefixLength(0)
1800 , m_numberOfCharactersJustAppended(0) 1800 , m_numberOfCharactersJustAppended(0)
1801 , m_atBreak(true) 1801 , m_atBreak(true)
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
2220 resultEnd = collapseTo; 2220 resultEnd = collapseTo;
2221 return; 2221 return;
2222 } 2222 }
2223 } 2223 }
2224 2224
2225 CharacterIterator computeRangeIterator(inputStart, inputEnd, iteratorFlagsFo rFindPlainText); 2225 CharacterIterator computeRangeIterator(inputStart, inputEnd, iteratorFlagsFo rFindPlainText);
2226 calculateCharacterSubrange(computeRangeIterator, matchStart, matchLength, re sultStart, resultEnd); 2226 calculateCharacterSubrange(computeRangeIterator, matchStart, matchLength, re sultStart, resultEnd);
2227 } 2227 }
2228 2228
2229 } 2229 }
OLDNEW
« no previous file with comments | « Source/core/editing/EditCommand.h ('k') | Source/core/editing/VisiblePosition.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698