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 |