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

Unified Diff: components/sync/core/shared_model_type_processor.cc

Issue 2374913002: [USS] Show USS counters in about:sync page (Closed)
Patch Set: re-comments 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/core/shared_model_type_processor.h ('k') | components/sync/driver/data_type_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync/core/shared_model_type_processor.cc
diff --git a/components/sync/core/shared_model_type_processor.cc b/components/sync/core/shared_model_type_processor.cc
index 53bbb84a0a5c40058242657f6209464330cd6076..4822e6e591e7b96a135df496e082a4ce62036e13 100644
--- a/components/sync/core/shared_model_type_processor.cc
+++ b/components/sync/core/shared_model_type_processor.cc
@@ -137,13 +137,25 @@ bool SharedModelTypeProcessor::IsConnected() const {
}
void SharedModelTypeProcessor::GetAllNodes(
- const scoped_refptr<base::TaskRunner>& task_runner,
const base::Callback<void(const ModelType,
std::unique_ptr<base::ListValue>)>& callback) {
DCHECK(service_);
service_->GetAllData(
base::Bind(&SharedModelTypeProcessor::MergeDataWithMetadata,
- base::Unretained(this), task_runner, callback));
+ base::Unretained(this), callback));
+}
+
+void SharedModelTypeProcessor::GetStatusCounters(
+ const base::Callback<void(ModelType, const StatusCounters&)>& callback) {
+ DCHECK(CalledOnValidThread());
+ syncer::StatusCounters counters;
+ counters.num_entries_and_tombstones = entities_.size();
+ for (auto it = entities_.begin(); it != entities_.end(); ++it) {
+ if (!it->second->metadata().is_deleted()) {
+ ++counters.num_entries;
+ }
+ }
+ callback.Run(type_, counters);
}
void SharedModelTypeProcessor::DisableSync() {
@@ -659,7 +671,6 @@ ProcessorEntityTracker* SharedModelTypeProcessor::CreateEntity(
}
void SharedModelTypeProcessor::MergeDataWithMetadata(
- const scoped_refptr<base::TaskRunner>& task_runner,
const base::Callback<void(const ModelType,
std::unique_ptr<base::ListValue>)>& callback,
SyncError error,
@@ -697,8 +708,7 @@ void SharedModelTypeProcessor::MergeDataWithMetadata(
rootnode->SetString("NON_UNIQUE_NAME", type_string);
all_nodes->Append(std::move(rootnode));
- task_runner->PostTask(FROM_HERE,
- base::Bind(callback, type_, base::Passed(&all_nodes)));
+ callback.Run(type_, std::move(all_nodes));
}
} // namespace syncer
« no previous file with comments | « components/sync/core/shared_model_type_processor.h ('k') | components/sync/driver/data_type_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698