blob: dcccb263f0b5d05401e1973c4ae3a0e619369f39 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "sync/util/extensions_activity.h"
namespace syncer {
ExtensionsActivity::Record::Record()
: bookmark_write_count(0U) {}
ExtensionsActivity::Record::~Record() {}
ExtensionsActivity::ExtensionsActivity() {}
ExtensionsActivity::~ExtensionsActivity() {}
void ExtensionsActivity::GetAndClearRecords(Records* buffer) {
base::AutoLock lock(records_lock_);
buffer->clear();
buffer->swap(records_);
}
void ExtensionsActivity::PutRecords(const Records& records) {
base::AutoLock lock(records_lock_);
for (Records::const_iterator i = records.begin(); i != records.end(); ++i) {
records_[i->first].extension_id = i->second.extension_id;
records_[i->first].bookmark_write_count += i->second.bookmark_write_count;
}
}
void ExtensionsActivity::UpdateRecord(const std::string& extension_id) {
base::AutoLock lock(records_lock_);
Record& record = records_[extension_id];
record.extension_id = extension_id;
record.bookmark_write_count++;
}
} // namespace syncer
|