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

Unified Diff: components/sync/engine_impl/model_type_registry.cc

Issue 2420213002: [USS] Show USS counters in Types tab (Closed)
Patch Set: git 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
Index: components/sync/engine_impl/model_type_registry.cc
diff --git a/components/sync/engine_impl/model_type_registry.cc b/components/sync/engine_impl/model_type_registry.cc
index 9854d5b3d4479eb316b9a8b84a963620ccd96c1b..edf40771143f8bc970b87c5db62f37c98a8a91d7 100644
--- a/components/sync/engine_impl/model_type_registry.cc
+++ b/components/sync/engine_impl/model_type_registry.cc
@@ -101,16 +101,15 @@ void ModelTypeRegistry::SetEnabledDirectoryTypes(
// DebugInfoEmitters are never deleted. Use existing one if we have it.
DirectoryTypeDebugInfoEmitter* emitter = NULL;
- DirectoryTypeDebugInfoEmitterMap::iterator it =
- directory_type_debug_info_emitter_map_.find(type);
- if (it != directory_type_debug_info_emitter_map_.end()) {
- emitter = it->second;
+ DataTypeDebugInfoEmitterMap::iterator it =
+ data_type_debug_info_emitter_map_.find(type);
+ if (it != data_type_debug_info_emitter_map_.end()) {
+ emitter = static_cast<DirectoryTypeDebugInfoEmitter*>(it->second);
pavely 2016/10/19 18:18:59 Could you check if it will suffice to declare emit
Gang Wu 2016/10/20 21:35:35 Done.
} else {
emitter = new DirectoryTypeDebugInfoEmitter(directory_, type,
&type_debug_info_observers_);
- directory_type_debug_info_emitter_map_.insert(
- std::make_pair(type, emitter));
- directory_type_debug_info_emitters_.push_back(emitter);
+ data_type_debug_info_emitter_map_.insert(std::make_pair(type, emitter));
+ data_type_debug_info_emitters_.push_back(emitter);
}
DirectoryCommitContributor* committer =
@@ -148,9 +147,23 @@ void ModelTypeRegistry::ConnectType(
if (encrypted_types_.Has(type))
cryptographer_copy.reset(new Cryptographer(*cryptographer_));
- std::unique_ptr<ModelTypeWorker> worker(new ModelTypeWorker(
- type, activation_context->model_type_state, std::move(cryptographer_copy),
- nudge_handler_, std::move(activation_context->type_processor)));
+ // DebugInfoEmitters are never deleted. Use existing one if we have it.
+ NonBlockingTypeDebugInfoEmitter* emitter = NULL;
+ DataTypeDebugInfoEmitterMap::iterator it =
+ data_type_debug_info_emitter_map_.find(type);
+ if (it != data_type_debug_info_emitter_map_.end()) {
+ emitter = static_cast<NonBlockingTypeDebugInfoEmitter*>(it->second);
+ } else {
+ emitter =
+ new NonBlockingTypeDebugInfoEmitter(type, &type_debug_info_observers_);
+ data_type_debug_info_emitter_map_.insert(std::make_pair(type, emitter));
+ data_type_debug_info_emitters_.push_back(emitter);
+ }
+
+ std::unique_ptr<ModelTypeWorker> worker(
+ new ModelTypeWorker(type, emitter, activation_context->model_type_state,
+ std::move(cryptographer_copy), nudge_handler_,
+ std::move(activation_context->type_processor)));
// Initialize Processor -> Worker communication channel.
std::unique_ptr<CommitQueue> commit_queue_proxy(new CommitQueueProxy(
@@ -221,9 +234,9 @@ CommitContributorMap* ModelTypeRegistry::commit_contributor_map() {
return &commit_contributor_map_;
}
-DirectoryTypeDebugInfoEmitterMap*
+DataTypeDebugInfoEmitterMap*
ModelTypeRegistry::directory_type_debug_info_emitter_map() {
- return &directory_type_debug_info_emitter_map_;
+ return &data_type_debug_info_emitter_map_;
}
void ModelTypeRegistry::RegisterDirectoryTypeDebugInfoObserver(
@@ -243,9 +256,9 @@ bool ModelTypeRegistry::HasDirectoryTypeDebugInfoObserver(
}
void ModelTypeRegistry::RequestEmitDebugInfo() {
- for (DirectoryTypeDebugInfoEmitterMap::iterator it =
- directory_type_debug_info_emitter_map_.begin();
- it != directory_type_debug_info_emitter_map_.end(); ++it) {
+ for (DataTypeDebugInfoEmitterMap::iterator it =
+ data_type_debug_info_emitter_map_.begin();
+ it != data_type_debug_info_emitter_map_.end(); ++it) {
it->second->EmitCommitCountersUpdate();
it->second->EmitUpdateCountersUpdate();
it->second->EmitStatusCountersUpdate();

Powered by Google App Engine
This is Rietveld 408576698