Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 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_BACKGROUND_PARSING_TASK_H_ | |
| 6 #define V8_BACKGROUND_PARSING_TASK_H_ | |
| 7 | |
| 8 #include "src/base/platform/platform.h" | |
| 9 #include "src/base/platform/semaphore.h" | |
| 10 #include "src/compiler.h" | |
| 11 | |
| 12 namespace v8 { | |
| 13 namespace internal { | |
| 14 | |
| 15 class Parser; | |
| 16 | |
| 17 // Internal representation of v8::ScriptCompiler::StreamedSource. Contains all | |
| 18 // data which needs to be transmitted between threads for background parsing, | |
| 19 // finalizing it on the main thread, and compiling on the main thread. All | |
| 20 // pointers are owned. | |
| 21 struct StreamedSource { | |
| 22 StreamedSource(ScriptCompiler::ExternalSourceStream* source_stream, | |
| 23 ScriptCompiler::StreamedSource::Encoding encoding) | |
| 24 : source_stream(source_stream), | |
| 25 encoding(encoding), | |
| 26 cached_data(NULL), | |
| 27 info(NULL), | |
| 28 hash_seed(0), | |
| 29 allow_lazy(false), | |
| 30 parser(NULL) {} | |
| 31 | |
| 32 ~StreamedSource(); | |
| 33 | |
| 34 // Internal implementation of v8::ScriptCompiler::StreamedSource. | |
| 35 ScriptCompiler::ExternalSourceStream* source_stream; | |
| 36 ScriptCompiler::StreamedSource::Encoding encoding; | |
| 37 ScriptCompiler::CachedData* cached_data; | |
| 38 | |
| 39 // Data needed for parsing, and data needed to to be passed between thread | |
| 40 // between parsing and compilation. These need to be initialized before the | |
| 41 // compilation starts. | |
| 42 UnicodeCache unicode_cache; | |
| 43 CompilationInfo* info; | |
|
jochen (gone - plz use gerrit)
2014/09/09 08:06:20
nit. you could use SmartPointer<CompilationInfo> s
marja
2014/09/09 11:46:30
Done.
| |
| 44 uint32_t hash_seed; | |
| 45 bool allow_lazy; | |
| 46 Parser* parser; | |
| 47 | |
| 48 private: | |
| 49 // Prevent copying. Not implemented. | |
| 50 StreamedSource(const StreamedSource&); | |
| 51 StreamedSource& operator=(const StreamedSource&); | |
| 52 }; | |
| 53 | |
| 54 | |
| 55 class BackgroundParsingTask : public ScriptCompiler::ScriptStreamingTask { | |
| 56 public: | |
| 57 BackgroundParsingTask(StreamedSource* source, | |
| 58 ScriptCompiler::CompileOptions options, | |
| 59 Isolate* isolate); | |
| 60 | |
| 61 virtual void Run(); | |
| 62 | |
| 63 private: | |
| 64 StreamedSource* source_; | |
| 65 ScriptCompiler::CompileOptions options_; | |
| 66 }; | |
| 67 } | |
| 68 } // namespace v8::internal | |
| 69 | |
| 70 #endif // V8_BACKGROUND_PARSING_TASK_H_ | |
| OLD | NEW |