| Index: components/sync/core_impl/protocol_event_buffer.cc
|
| diff --git a/components/sync/core_impl/protocol_event_buffer.cc b/components/sync/core_impl/protocol_event_buffer.cc
|
| index 616b9fe9cc7b2fcb6378fcb835b1edf38b85ff9f..9e856197b953d5297ddadc5adb2d57e1a2554c95 100644
|
| --- a/components/sync/core_impl/protocol_event_buffer.cc
|
| +++ b/components/sync/core_impl/protocol_event_buffer.cc
|
| @@ -12,26 +12,22 @@ namespace syncer {
|
|
|
| const size_t ProtocolEventBuffer::kBufferSize = 6;
|
|
|
| -ProtocolEventBuffer::ProtocolEventBuffer() : buffer_deleter_(&buffer_) {}
|
| +ProtocolEventBuffer::ProtocolEventBuffer() {}
|
|
|
| ProtocolEventBuffer::~ProtocolEventBuffer() {}
|
|
|
| void ProtocolEventBuffer::RecordProtocolEvent(const ProtocolEvent& event) {
|
| - buffer_.push_back(event.Clone().release());
|
| - if (buffer_.size() > kBufferSize) {
|
| - ProtocolEvent* to_delete = buffer_.front();
|
| + buffer_.push_back(event.Clone());
|
| + if (buffer_.size() > kBufferSize)
|
| buffer_.pop_front();
|
| - delete to_delete;
|
| - }
|
| }
|
|
|
| -ScopedVector<ProtocolEvent> ProtocolEventBuffer::GetBufferedProtocolEvents()
|
| - const {
|
| - ScopedVector<ProtocolEvent> ret;
|
| - for (std::deque<ProtocolEvent*>::const_iterator it = buffer_.begin();
|
| - it != buffer_.end(); ++it) {
|
| - ret.push_back((*it)->Clone());
|
| - }
|
| +std::vector<std::unique_ptr<ProtocolEvent>>
|
| +ProtocolEventBuffer::GetBufferedProtocolEvents() const {
|
| + std::vector<std::unique_ptr<ProtocolEvent>> ret;
|
| + for (auto& event : buffer_)
|
| + ret.push_back(event->Clone());
|
| +
|
| return ret;
|
| }
|
|
|
|
|