Roll src/third_party/WebKit 96fb88b:6bbd108 (svn 201045:201047)
[chromium-blink-merge.git] / sync / internal_api / public / sessions / status_counters.cc
blob9a5dcb69efb1e96cda4592048ebb22d08d3837fe
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.
5 #include "sync/internal_api/public/sessions/status_counters.h"
7 #include "base/json/json_string_value_serializer.h"
8 #include "base/values.h"
10 namespace syncer {
12 StatusCounters::StatusCounters()
13 : num_entries(0),
14 num_entries_and_tombstones(0) {}
16 StatusCounters::~StatusCounters() {}
18 scoped_ptr<base::DictionaryValue> StatusCounters::ToValue() const {
19 scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue());
20 value->SetInteger("numEntries", num_entries);
21 value->SetInteger("numEntriesAndTombstones", num_entries_and_tombstones);
22 return value.Pass();
25 std::string StatusCounters::ToString() const {
26 std::string result;
27 scoped_ptr<base::DictionaryValue> value = ToValue();
28 JSONStringValueSerializer serializer(&result);
29 serializer.Serialize(*value);
30 return result;
33 } // namespace syncer