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

Side by Side Diff: components/sync/core_impl/protocol_event_buffer.cc

Issue 2413313004: [Sync] Move the last things out of core/. (Closed)
Patch Set: Address comments. Created 4 years, 2 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 unified diff | Download patch
OLDNEW
(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
OLDNEW
« 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