| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_BACKGROUND_PARSING_TASK_H_ | 5 #ifndef V8_BACKGROUND_PARSING_TASK_H_ |
| 6 #define V8_BACKGROUND_PARSING_TASK_H_ | 6 #define V8_BACKGROUND_PARSING_TASK_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "include/v8.h" | 10 #include "include/v8.h" |
| 11 #include "src/base/platform/platform.h" | 11 #include "src/base/platform/platform.h" |
| 12 #include "src/base/platform/semaphore.h" | 12 #include "src/base/platform/semaphore.h" |
| 13 #include "src/parsing/parse-info.h" | 13 #include "src/parsing/parse-info.h" |
| 14 #include "src/parsing/parser.h" | 14 #include "src/unicode-cache.h" |
| 15 | 15 |
| 16 namespace v8 { | 16 namespace v8 { |
| 17 namespace internal { | 17 namespace internal { |
| 18 | 18 |
| 19 class Parser; |
| 19 class ScriptData; | 20 class ScriptData; |
| 20 | 21 |
| 21 // Internal representation of v8::ScriptCompiler::StreamedSource. Contains all | 22 // Internal representation of v8::ScriptCompiler::StreamedSource. Contains all |
| 22 // data which needs to be transmitted between threads for background parsing, | 23 // data which needs to be transmitted between threads for background parsing, |
| 23 // finalizing it on the main thread, and compiling on the main thread. | 24 // finalizing it on the main thread, and compiling on the main thread. |
| 24 struct StreamedSource { | 25 struct StreamedSource { |
| 25 StreamedSource(ScriptCompiler::ExternalSourceStream* source_stream, | 26 StreamedSource(ScriptCompiler::ExternalSourceStream* source_stream, |
| 26 ScriptCompiler::StreamedSource::Encoding encoding) | 27 ScriptCompiler::StreamedSource::Encoding encoding) |
| 27 : source_stream(source_stream), encoding(encoding) {} | 28 : source_stream(source_stream), encoding(encoding) {} |
| 28 | 29 |
| 29 void Release() { | 30 void Release(); |
| 30 parser.reset(); | |
| 31 info.reset(); | |
| 32 zone.reset(); | |
| 33 } | |
| 34 | 31 |
| 35 // Internal implementation of v8::ScriptCompiler::StreamedSource. | 32 // Internal implementation of v8::ScriptCompiler::StreamedSource. |
| 36 std::unique_ptr<ScriptCompiler::ExternalSourceStream> source_stream; | 33 std::unique_ptr<ScriptCompiler::ExternalSourceStream> source_stream; |
| 37 ScriptCompiler::StreamedSource::Encoding encoding; | 34 ScriptCompiler::StreamedSource::Encoding encoding; |
| 38 std::unique_ptr<ScriptCompiler::CachedData> cached_data; | 35 std::unique_ptr<ScriptCompiler::CachedData> cached_data; |
| 39 | 36 |
| 40 // Data needed for parsing, and data needed to to be passed between thread | 37 // Data needed for parsing, and data needed to to be passed between thread |
| 41 // between parsing and compilation. These need to be initialized before the | 38 // between parsing and compilation. These need to be initialized before the |
| 42 // compilation starts. | 39 // compilation starts. |
| 43 UnicodeCache unicode_cache; | 40 UnicodeCache unicode_cache; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 61 | 58 |
| 62 private: | 59 private: |
| 63 StreamedSource* source_; // Not owned. | 60 StreamedSource* source_; // Not owned. |
| 64 int stack_size_; | 61 int stack_size_; |
| 65 ScriptData* script_data_; | 62 ScriptData* script_data_; |
| 66 }; | 63 }; |
| 67 } // namespace internal | 64 } // namespace internal |
| 68 } // namespace v8 | 65 } // namespace v8 |
| 69 | 66 |
| 70 #endif // V8_BACKGROUND_PARSING_TASK_H_ | 67 #endif // V8_BACKGROUND_PARSING_TASK_H_ |
| OLD | NEW |