Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: components/sync/core_impl/protocol_event_buffer.cc

Issue 2284283002: Remove stl_util's STLElementDeleter from sync. (Closed)
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
}
« no previous file with comments | « components/sync/core_impl/protocol_event_buffer.h ('k') | components/sync/core_impl/protocol_event_buffer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698