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

Unified Diff: src/scanner-character-streams.cc

Issue 1154773004: Fix DCHECK on SetBookmark. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: De-nit-ification. Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/scanner-character-streams.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scanner-character-streams.cc
diff --git a/src/scanner-character-streams.cc b/src/scanner-character-streams.cc
index 98e79aad76fd458715ad69649b692f3083a4ee40..40d2abcf13f79e08c33e75e58445184248c6a696 100644
--- a/src/scanner-character-streams.cc
+++ b/src/scanner-character-streams.cc
@@ -388,14 +388,13 @@ size_t ExternalStreamingStream::FillBuffer(size_t position) {
bool ExternalStreamingStream::SetBookmark() {
- DCHECK(utf8_split_char_buffer_length_ == 0); // We can't be within a char.
-
// Bookmarking for this stream is a bit more complex than expected, since
// the stream state is distributed over several places:
// - pos_ (inherited from Utf16CharacterStream)
// - buffer_cursor_ and buffer_end_ (also from Utf16CharacterStream)
// - buffer_ (from BufferedUtf16CharacterStream)
// - current_data_ (+ .._offset_ and .._length) (this class)
+ // - utf8_split_char_buffer_* (a partial utf8 symbol at the block boundary)
//
// The underlying source_stream_ instance likely could re-construct this
// local data for us, but with the given interfaces we have no way of
@@ -405,6 +404,7 @@ bool ExternalStreamingStream::SetBookmark() {
// - pos_ => bookmark_
// - buffer_[buffer_cursor_ .. buffer_end_] => bookmark_buffer_
// - current_data_[.._offset_ .. .._length_] => bookmark_data_
+ // - utf8_split_char_buffer_* => bookmark_utf8_split...
bookmark_ = pos_;
@@ -419,6 +419,11 @@ bool ExternalStreamingStream::SetBookmark() {
CopyBytes(bookmark_data_.start(), current_data_ + current_data_offset_,
data_length);
+ bookmark_utf8_split_char_buffer_length_ = utf8_split_char_buffer_length_;
+ for (size_t i = 0; i < utf8_split_char_buffer_length_; i++) {
+ bookmark_utf8_split_char_buffer_[i] = utf8_split_char_buffer_[i];
+ }
+
return source_stream_->SetBookmark();
}
@@ -439,6 +444,12 @@ void ExternalStreamingStream::ResetToBookmark() {
bookmark_buffer_.length());
buffer_cursor_ = buffer_;
buffer_end_ = buffer_ + bookmark_buffer_.length();
+
+ // utf8 split char buffer
+ utf8_split_char_buffer_length_ = bookmark_utf8_split_char_buffer_length_;
+ for (size_t i = 0; i < bookmark_utf8_split_char_buffer_length_; i++) {
+ utf8_split_char_buffer_[i] = bookmark_utf8_split_char_buffer_[i];
+ }
}
« no previous file with comments | « src/scanner-character-streams.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698