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

Unified Diff: src/parsing/scanner-character-streams.h

Issue 2184393002: Implement a character stream for external one byte streams (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/parsing/parser.cc ('k') | src/parsing/scanner-character-streams.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/scanner-character-streams.h
diff --git a/src/parsing/scanner-character-streams.h b/src/parsing/scanner-character-streams.h
index 7e065cf89d35a5df603919a335a3482caa4c0886..5f6c9928159c7f6b3a3a5a7ba250a4de58f783c3 100644
--- a/src/parsing/scanner-character-streams.h
+++ b/src/parsing/scanner-character-streams.h
@@ -14,6 +14,7 @@ namespace internal {
// Forward declarations.
class ExternalTwoByteString;
+class ExternalOneByteString;
// A buffered character stream based on a random access character
// source (ReadBlock can be called with pos_ pointing to any position,
@@ -167,7 +168,7 @@ class ExternalTwoByteStringUtf16CharacterStream: public Utf16CharacterStream {
bool SetBookmark() override;
void ResetToBookmark() override;
- protected:
+ private:
size_t SlowSeekForward(size_t delta) override {
// Fast case always handles seeking.
return 0;
@@ -176,12 +177,33 @@ class ExternalTwoByteStringUtf16CharacterStream: public Utf16CharacterStream {
// Entire string is read at start.
return false;
}
- Handle<ExternalTwoByteString> source_;
const uc16* raw_data_; // Pointer to the actual array of characters.
+ static const size_t kNoBookmark = -1;
+
+ size_t bookmark_;
+};
+
+// UTF16 buffer to read characters from an external latin1 string.
+class ExternalOneByteStringUtf16CharacterStream
+ : public BufferedUtf16CharacterStream {
+ public:
+ ExternalOneByteStringUtf16CharacterStream(Handle<ExternalOneByteString> data,
+ int start_position,
+ int end_position);
+ ~ExternalOneByteStringUtf16CharacterStream() override;
+
+ bool SetBookmark() override;
+ void ResetToBookmark() override;
+
private:
static const size_t kNoBookmark = -1;
+ size_t BufferSeekForward(size_t delta) override;
+ size_t FillBuffer(size_t position) override;
+
+ const uint8_t* raw_data_; // Pointer to the actual array of characters.
+ size_t length_;
size_t bookmark_;
};
« no previous file with comments | « src/parsing/parser.cc ('k') | src/parsing/scanner-character-streams.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698