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

Unified Diff: src/snapshot-source-sink.h

Issue 373713006: Introduce code serializer/deserializer. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments and rebased Created 6 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/serialize.cc ('k') | src/snapshot-source-sink.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/snapshot-source-sink.h
diff --git a/src/snapshot-source-sink.h b/src/snapshot-source-sink.h
index 6e2328cc2774c59400c0c7e5ed98b228ba93e230..eae8606fbed11f31ff124b66518a9ff19d083292 100644
--- a/src/snapshot-source-sink.h
+++ b/src/snapshot-source-sink.h
@@ -82,6 +82,42 @@ class SnapshotByteSink {
};
+class DummySnapshotSink : public SnapshotByteSink {
+ public:
+ DummySnapshotSink() : length_(0) {}
+ virtual ~DummySnapshotSink() {}
+ virtual void Put(int byte, const char* description) { length_++; }
+ virtual int Position() { return length_; }
+
+ private:
+ int length_;
+};
+
+
+// Wrap a SnapshotByteSink into a DebugSnapshotSink to get debugging output.
+class DebugSnapshotSink : public SnapshotByteSink {
+ public:
+ explicit DebugSnapshotSink(SnapshotByteSink* chained) : sink_(chained) {}
+ virtual void Put(int byte, const char* description) V8_OVERRIDE;
+ virtual int Position() V8_OVERRIDE { return sink_->Position(); }
+
+ private:
+ SnapshotByteSink* sink_;
+};
+
+
+class ListSnapshotSink : public i::SnapshotByteSink {
+ public:
+ explicit ListSnapshotSink(i::List<char>* data) : data_(data) {}
+ virtual void Put(int byte, const char* description) V8_OVERRIDE {
+ data_->Add(byte);
+ }
+ virtual int Position() V8_OVERRIDE { return data_->length(); }
+
+ private:
+ i::List<char>* data_;
+};
+
} // namespace v8::internal
} // namespace v8
« no previous file with comments | « src/serialize.cc ('k') | src/snapshot-source-sink.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698