1 // Copyright 2011 the V8 project authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef V8_PARSING_SCANNER_CHARACTER_STREAMS_H_ 6 #define V8_PARSING_SCANNER_CHARACTER_STREAMS_H_ 7 8 #include <memory> 9 10 #include "include/v8.h" // for v8::ScriptCompiler 11 #include "src/common/globals.h" 12 13 namespace v8 { 14 namespace internal { 15 16 template <typename T> 17 class Handle; 18 class Utf16CharacterStream; 19 class RuntimeCallStats; 20 class String; 21 22 class V8_EXPORT_PRIVATE ScannerStream { 23 public: 24 static Utf16CharacterStream* For(Isolate* isolate, Handle<String> data); 25 static Utf16CharacterStream* For(Isolate* isolate, Handle<String> data, 26 int start_pos, int end_pos); 27 static Utf16CharacterStream* For( 28 ScriptCompiler::ExternalSourceStream* source_stream, 29 ScriptCompiler::StreamedSource::Encoding encoding); 30 31 static std::unique_ptr<Utf16CharacterStream> ForTesting(const char* data); 32 static std::unique_ptr<Utf16CharacterStream> ForTesting(const char* data, 33 size_t length); 34 static std::unique_ptr<Utf16CharacterStream> ForTesting(const uint16_t* data, 35 size_t length); 36 }; 37 38 } // namespace internal 39 } // namespace v8 40 41 #endif // V8_PARSING_SCANNER_CHARACTER_STREAMS_H_ 42