| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "components/sync/core_impl/protocol_event_buffer.h" | |
| 6 | |
| 7 #include "components/sync/engine/events/protocol_event.h" | |
| 8 | |
| 9 namespace syncer { | |
| 10 | |
| 11 const size_t ProtocolEventBuffer::kBufferSize = 6; | |
| 12 | |
| 13 ProtocolEventBuffer::ProtocolEventBuffer() {} | |
| 14 | |
| 15 ProtocolEventBuffer::~ProtocolEventBuffer() {} | |
| 16 | |
| 17 void ProtocolEventBuffer::RecordProtocolEvent(const ProtocolEvent& event) { | |
| 18 buffer_.push_back(event.Clone()); | |
| 19 if (buffer_.size() > kBufferSize) | |
| 20 buffer_.pop_front(); | |
| 21 } | |
| 22 | |
| 23 std::vector<std::unique_ptr<ProtocolEvent>> | |
| 24 ProtocolEventBuffer::GetBufferedProtocolEvents() const { | |
| 25 std::vector<std::unique_ptr<ProtocolEvent>> ret; | |
| 26 for (auto& event : buffer_) | |
| 27 ret.push_back(event->Clone()); | |
| 28 | |
| 29 return ret; | |
| 30 } | |
| 31 | |
| 32 } // namespace syncer | |
| OLD | NEW |