blob: 9a5dcb69efb1e96cda4592048ebb22d08d3837fe (
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
|
// Copyright 2014 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/internal_api/public/sessions/status_counters.h"
#include "base/json/json_string_value_serializer.h"
#include "base/values.h"
namespace syncer {
StatusCounters::StatusCounters()
: num_entries(0),
num_entries_and_tombstones(0) {}
StatusCounters::~StatusCounters() {}
scoped_ptr<base::DictionaryValue> StatusCounters::ToValue() const {
scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue());
value->SetInteger("numEntries", num_entries);
value->SetInteger("numEntriesAndTombstones", num_entries_and_tombstones);
return value.Pass();
}
std::string StatusCounters::ToString() const {
std::string result;
scoped_ptr<base::DictionaryValue> value = ToValue();
JSONStringValueSerializer serializer(&result);
serializer.Serialize(*value);
return result;
}
} // namespace syncer
|