Index: src/snapshot-source-sink.h |
diff --git a/src/snapshot-source-sink.h b/src/snapshot-source-sink.h |
index c1a31b5645fec748a9d562538b611601dddf41ce..68901a13190135a9cd457e968ec88f96285058e8 100644 |
--- a/src/snapshot-source-sink.h |
+++ b/src/snapshot-source-sink.h |
@@ -70,53 +70,27 @@ class SnapshotByteSource FINAL { |
*/ |
class SnapshotByteSink { |
public: |
- virtual ~SnapshotByteSink() { } |
- virtual void Put(byte b, const char* description) = 0; |
- virtual void PutSection(int b, const char* description) { |
+ SnapshotByteSink() {} |
+ explicit SnapshotByteSink(int initial_size) : data_(initial_size) {} |
+ |
+ ~SnapshotByteSink() {} |
+ |
+ void Put(byte b, const char* description) { data_.Add(b); } |
+ |
+ void PutSection(int b, const char* description) { |
DCHECK_LE(b, kMaxUInt8); |
Put(static_cast<byte>(b), description); |
} |
+ |
void PutInt(uintptr_t integer, const char* description); |
void PutRaw(byte* data, int number_of_bytes, const char* description); |
void PutBlob(byte* data, int number_of_bytes, const char* description); |
- virtual int Position() = 0; |
-}; |
- |
+ int Position() { return data_.length(); } |
-class DummySnapshotSink : public SnapshotByteSink { |
- public: |
- DummySnapshotSink() : length_(0) {} |
- virtual ~DummySnapshotSink() {} |
- virtual void Put(byte b, 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(byte b, const char* description) OVERRIDE; |
- virtual int Position() OVERRIDE { return sink_->Position(); } |
- |
- private: |
- SnapshotByteSink* sink_; |
-}; |
- |
- |
-class ListSnapshotSink : public i::SnapshotByteSink { |
- public: |
- explicit ListSnapshotSink(i::List<byte>* data) : data_(data) {} |
- virtual void Put(byte b, const char* description) OVERRIDE { |
- data_->Add(b); |
- } |
- virtual int Position() OVERRIDE { return data_->length(); } |
+ const List<byte>& data() const { return data_; } |
private: |
- i::List<byte>* data_; |
+ List<byte> data_; |
}; |
} // namespace v8::internal |