1 // Copyright 2013 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.
5 #include "sync/util/extensions_activity.h"
9 ExtensionsActivity::Record::Record()
10 : bookmark_write_count(0U) {}
12 ExtensionsActivity::Record::~Record() {}
14 ExtensionsActivity::ExtensionsActivity() {}
16 ExtensionsActivity::~ExtensionsActivity() {}
18 void ExtensionsActivity::GetAndClearRecords(Records
* buffer
) {
19 base::AutoLock
lock(records_lock_
);
21 buffer
->swap(records_
);
24 void ExtensionsActivity::PutRecords(const Records
& records
) {
25 base::AutoLock
lock(records_lock_
);
26 for (Records::const_iterator i
= records
.begin(); i
!= records
.end(); ++i
) {
27 records_
[i
->first
].extension_id
= i
->second
.extension_id
;
28 records_
[i
->first
].bookmark_write_count
+= i
->second
.bookmark_write_count
;
32 void ExtensionsActivity::UpdateRecord(const std::string
& extension_id
) {
33 base::AutoLock
lock(records_lock_
);
34 Record
& record
= records_
[extension_id
];
35 record
.extension_id
= extension_id
;
36 record
.bookmark_write_count
++;