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

Side by Side Diff: third_party/WebKit/Source/core/html/parser/BackgroundHTMLInputStream.cpp

Issue 2127043002: SegmentedString::prepend should know if the prepended string is new or previously consumed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/parser/HTMLEntityParser.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) 2013 Google, Inc. All Rights Reserved. 2 * Copyright (C) 2013 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 bool isClosed = m_current.isClosed(); 84 bool isClosed = m_current.isClosed();
85 85
86 m_current = checkpoint.input; 86 m_current = checkpoint.input;
87 87
88 for (size_t i = checkpoint.numberOfSegmentsAlreadyAppended; i < m_segments.s ize(); ++i) { 88 for (size_t i = checkpoint.numberOfSegmentsAlreadyAppended; i < m_segments.s ize(); ++i) {
89 ASSERT(!m_segments[i].isNull()); 89 ASSERT(!m_segments[i].isNull());
90 m_current.append(SegmentedString(m_segments[i])); 90 m_current.append(SegmentedString(m_segments[i]));
91 } 91 }
92 92
93 if (!unparsedInput.isEmpty()) 93 if (!unparsedInput.isEmpty()) {
94 m_current.prepend(SegmentedString(unparsedInput)); 94 m_current.prepend(SegmentedString(unparsedInput),
95 SegmentedString::PrependType::NewInput);
96 }
95 97
96 if (isClosed && !m_current.isClosed()) 98 if (isClosed && !m_current.isClosed())
97 m_current.close(); 99 m_current.close();
98 100
99 ASSERT(m_current.isClosed() == isClosed); 101 ASSERT(m_current.isClosed() == isClosed);
100 102
101 m_segments.clear(); 103 m_segments.clear();
102 m_checkpoints.clear(); 104 m_checkpoints.clear();
103 m_firstValidCheckpointIndex = 0; 105 m_firstValidCheckpointIndex = 0;
104 m_firstValidSegmentIndex = 0; 106 m_firstValidSegmentIndex = 0;
105 107
106 updateTotalCheckpointTokenCount(); 108 updateTotalCheckpointTokenCount();
107 } 109 }
108 110
109 void BackgroundHTMLInputStream::updateTotalCheckpointTokenCount() 111 void BackgroundHTMLInputStream::updateTotalCheckpointTokenCount()
110 { 112 {
111 m_totalCheckpointTokenCount = 0; 113 m_totalCheckpointTokenCount = 0;
112 size_t lastCheckpointIndex = m_checkpoints.size(); 114 size_t lastCheckpointIndex = m_checkpoints.size();
113 for (size_t i = 0; i < lastCheckpointIndex; ++i) 115 for (size_t i = 0; i < lastCheckpointIndex; ++i)
114 m_totalCheckpointTokenCount += m_checkpoints[i].tokensExtractedSincePrev iousCheckpoint; 116 m_totalCheckpointTokenCount += m_checkpoints[i].tokensExtractedSincePrev iousCheckpoint;
115 } 117 }
116 118
117 } // namespace blink 119 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/parser/HTMLEntityParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698