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

Unified Diff: src/background-parsing-task.h

Issue 366153002: Add script streaming API (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: cleanup & better comments Created 6 years, 3 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
Index: src/background-parsing-task.h
diff --git a/src/background-parsing-task.h b/src/background-parsing-task.h
new file mode 100644
index 0000000000000000000000000000000000000000..8f8084f2dd0e7cbaa85c49163feac318bc4b229f
--- /dev/null
+++ b/src/background-parsing-task.h
@@ -0,0 +1,70 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef V8_BACKGROUND_PARSING_TASK_H_
+#define V8_BACKGROUND_PARSING_TASK_H_
+
+#include "src/base/platform/platform.h"
+#include "src/base/platform/semaphore.h"
+#include "src/compiler.h"
+
+namespace v8 {
+namespace internal {
+
+class Parser;
+
+// Internal representation of v8::ScriptCompiler::StreamedSource. Contains all
+// data which needs to be transmitted between threads for background parsing,
+// finalizing it on the main thread, and compiling on the main thread. All
+// pointers are owned.
+struct StreamedSource {
+ StreamedSource(ScriptCompiler::ExternalSourceStream* source_stream,
+ ScriptCompiler::StreamedSource::Encoding encoding)
+ : source_stream(source_stream),
+ encoding(encoding),
+ cached_data(NULL),
+ info(NULL),
+ hash_seed(0),
+ allow_lazy(false),
+ parser(NULL) {}
+
+ ~StreamedSource();
+
+ // Internal implementation of v8::ScriptCompiler::StreamedSource.
+ ScriptCompiler::ExternalSourceStream* source_stream;
+ ScriptCompiler::StreamedSource::Encoding encoding;
+ ScriptCompiler::CachedData* cached_data;
+
+ // Data needed for parsing, and data needed to to be passed between thread
+ // between parsing and compilation. These need to be initialized before the
+ // compilation starts.
+ UnicodeCache unicode_cache;
+ 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.
+ uint32_t hash_seed;
+ bool allow_lazy;
+ Parser* parser;
+
+ private:
+ // Prevent copying. Not implemented.
+ StreamedSource(const StreamedSource&);
+ StreamedSource& operator=(const StreamedSource&);
+};
+
+
+class BackgroundParsingTask : public ScriptCompiler::ScriptStreamingTask {
+ public:
+ BackgroundParsingTask(StreamedSource* source,
+ ScriptCompiler::CompileOptions options,
+ Isolate* isolate);
+
+ virtual void Run();
+
+ private:
+ StreamedSource* source_;
+ ScriptCompiler::CompileOptions options_;
+};
+}
+} // namespace v8::internal
+
+#endif // V8_BACKGROUND_PARSING_TASK_H_

Powered by Google App Engine
This is Rietveld 408576698