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

Unified Diff: sync/internal_api/public/sessions/status_counters.cc

Issue 254473008: sync: Introduce classes for per-type counters (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fixes Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: sync/internal_api/public/sessions/status_counters.cc
diff --git a/sync/internal_api/public/sessions/status_counters.cc b/sync/internal_api/public/sessions/status_counters.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b3547d1a35b2382c096455502d7aa79d089b68bf
--- /dev/null
+++ b/sync/internal_api/public/sessions/status_counters.cc
@@ -0,0 +1,31 @@
+// 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_total_entries(0) {}
+
+StatusCounters::~StatusCounters() {}
+
+scoped_ptr<base::DictionaryValue> StatusCounters::ToValue() const {
+ scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue());
+ value->SetInteger("numTotalEntries", num_total_entries);
+ 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
« no previous file with comments | « sync/internal_api/public/sessions/status_counters.h ('k') | sync/internal_api/public/sessions/type_debug_info_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698