| Index: src/utils.h
|
| diff --git a/src/utils.h b/src/utils.h
|
| index 8eddb1391d15ff1e6fd5db12d81f531eeeaac34a..90fa74f9fb0e43c4ced4e182e4b0263b03a12447 100644
|
| --- a/src/utils.h
|
| +++ b/src/utils.h
|
| @@ -560,6 +560,15 @@ class Collector {
|
| return Vector<T>(new_store, total_length);
|
| }
|
|
|
| + // Resets the collector to be empty.
|
| + virtual void Reset() {
|
| + for (int i = chunks_.length() - 1; i >= 0; i--) {
|
| + chunks_.at(i).Dispose();
|
| + }
|
| + chunks_.Rewind(0);
|
| + index_ = 0;
|
| + }
|
| +
|
| protected:
|
| static const int kMinCapacity = 16;
|
| List<Vector<T> > chunks_;
|
| @@ -632,6 +641,18 @@ class SequenceCollector : public Collector<T> {
|
| this->index_ - sequence_start);
|
| }
|
|
|
| + // Drops the currently added sequence, and all collected elements in it.
|
| + void DropSequence() {
|
| + ASSERT(sequence_start_ != kNoSequence);
|
| + this->index_ = sequence_start_;
|
| + sequence_start_ = kNoSequence;
|
| + }
|
| +
|
| + virtual void Reset() {
|
| + sequence_start_ = kNoSequence;
|
| + this->Collector<T>::Reset();
|
| + }
|
| +
|
| private:
|
| static const int kNoSequence = -1;
|
| int sequence_start_;
|
|
|