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

Unified Diff: components/sync/engine_impl/cycle/data_type_debug_info_emitter.h

Issue 2420213002: [USS] Show USS counters in Types tab (Closed)
Patch Set: rebase Created 4 years, 2 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
« no previous file with comments | « components/sync/BUILD.gn ('k') | components/sync/engine_impl/cycle/data_type_debug_info_emitter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync/engine_impl/cycle/data_type_debug_info_emitter.h
diff --git a/components/sync/engine_impl/cycle/directory_type_debug_info_emitter.h b/components/sync/engine_impl/cycle/data_type_debug_info_emitter.h
similarity index 53%
copy from components/sync/engine_impl/cycle/directory_type_debug_info_emitter.h
copy to components/sync/engine_impl/cycle/data_type_debug_info_emitter.h
index 8334abec8101a2d1c2c9ec977de0eb2087b85122..8e620a712c5f63b5ed2dd81271b53024367c297b 100644
--- a/components/sync/engine_impl/cycle/directory_type_debug_info_emitter.h
+++ b/components/sync/engine_impl/cycle/data_type_debug_info_emitter.h
@@ -1,18 +1,17 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2016 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.
-#ifndef COMPONENTS_SYNC_ENGINE_IMPL_CYCLE_DIRECTORY_TYPE_DEBUG_INFO_EMITTER_H_
-#define COMPONENTS_SYNC_ENGINE_IMPL_CYCLE_DIRECTORY_TYPE_DEBUG_INFO_EMITTER_H_
+#ifndef COMPONENTS_SYNC_ENGINE_IMPL_CYCLE_DATA_TYPE_DEBUG_INFO_EMITTER_H_
+#define COMPONENTS_SYNC_ENGINE_IMPL_CYCLE_DATA_TYPE_DEBUG_INFO_EMITTER_H_
#include <memory>
#include "base/macros.h"
#include "base/observer_list.h"
-#include "base/values.h"
+#include "components/sync/base/model_type.h"
#include "components/sync/engine/cycle/commit_counters.h"
#include "components/sync/engine/cycle/update_counters.h"
-#include "components/sync/syncable/directory.h"
namespace syncer {
@@ -21,39 +20,23 @@ class TypeDebugInfoObserver;
// Supports various kinds of debugging requests for a certain directory type.
//
-// The GetAllNodes() function is used to help export a snapshot of all current
-// nodes to its caller. The complexity required to manage the request mostly
-// lives elsewhere.
-//
// The Emit*() functions send updates to registered TypeDebugInfoObservers.
-// The DirectoryTypeDebugInfoEmitter does not directly own that list; it is
+// The DataTypeDebugInfoEmitter does not directly own that list; it is
// managed by the ModelTypeRegistry.
//
// For Update and Commit counters, the job of keeping the counters up to date
-// is delegated to the UpdateHandler and CommitContributors. For the Stats
-// counters, the emitter will use its type_ and directory_ members to fetch all
-// the required information on demand.
-class DirectoryTypeDebugInfoEmitter {
+// is delegated to the UpdateHandler and CommitContributors. For the Stats
+// counters, the emitter will let sub class to fetch all the required
+// information on demand.
+class DataTypeDebugInfoEmitter {
public:
- // Standard constructor for non-tests.
- //
- // The |directory| and |observers| arguments are not owned. Both may be
- // modified outside of this object and both are expected to outlive this
- // object.
- DirectoryTypeDebugInfoEmitter(
- syncable::Directory* directory,
- ModelType type,
- base::ObserverList<TypeDebugInfoObserver>* observers);
-
- // A simple constructor for tests. Should not be used in real code.
- DirectoryTypeDebugInfoEmitter(
+ // The |observers| is not owned. |observers| may be modified outside of this
+ // object and is expected to outlive this object.
+ DataTypeDebugInfoEmitter(
ModelType type,
base::ObserverList<TypeDebugInfoObserver>* observers);
- virtual ~DirectoryTypeDebugInfoEmitter();
-
- // Returns a ListValue representation of all known nodes of this type.
- std::unique_ptr<base::ListValue> GetAllNodes();
+ virtual ~DataTypeDebugInfoEmitter();
// Returns a reference to the current commit counters.
const CommitCounters& GetCommitCounters() const;
@@ -74,25 +57,24 @@ class DirectoryTypeDebugInfoEmitter {
void EmitUpdateCountersUpdate();
// Triggers a status counters update to registered observers.
- void EmitStatusCountersUpdate();
-
- private:
- syncable::Directory* directory_;
+ virtual void EmitStatusCountersUpdate() = 0;
+ protected:
const ModelType type_;
- CommitCounters commit_counters_;
- UpdateCounters update_counters_;
-
// Because there are so many emitters that come into and out of existence, it
// doesn't make sense to have them manage their own observer list. They all
// share one observer list that is provided by their owner and which is
// guaranteed to outlive them.
base::ObserverList<TypeDebugInfoObserver>* type_debug_info_observers_;
- DISALLOW_COPY_AND_ASSIGN(DirectoryTypeDebugInfoEmitter);
+ private:
+ CommitCounters commit_counters_;
+ UpdateCounters update_counters_;
+
+ DISALLOW_COPY_AND_ASSIGN(DataTypeDebugInfoEmitter);
};
} // namespace syncer
-#endif // COMPONENTS_SYNC_ENGINE_IMPL_CYCLE_DIRECTORY_TYPE_DEBUG_INFO_EMITTER_H_
+#endif // COMPONENTS_SYNC_ENGINE_IMPL_CYCLE_DATA_TYPE_DEBUG_INFO_EMITTER_H_
« no previous file with comments | « components/sync/BUILD.gn ('k') | components/sync/engine_impl/cycle/data_type_debug_info_emitter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698