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

Unified Diff: components/browser_sync/profile_sync_service.cc

Issue 2374913002: [USS] Show USS counters in about:sync page (Closed)
Patch Set: get processor on model thread and 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/browser_sync/profile_sync_service.cc
diff --git a/components/browser_sync/profile_sync_service.cc b/components/browser_sync/profile_sync_service.cc
index ab636d3a00a5620c93a4b2341af85bbf7814f2a1..489ffaa9be236621b3e147ec526832157f8e5fbb 100644
--- a/components/browser_sync/profile_sync_service.cc
+++ b/components/browser_sync/profile_sync_service.cc
@@ -39,6 +39,7 @@
#include "components/strings/grit/components_strings.h"
#include "components/sync/api/model_type_store.h"
#include "components/sync/api/sync_error.h"
+#include "components/sync/base/bind_to_task_runner.h"
#include "components/sync/base/cryptographer.h"
#include "components/sync/base/passphrase_type.h"
#include "components/sync/base/stop_source.h"
@@ -546,7 +547,7 @@ void ProfileSyncService::OnDirectoryTypeUpdateCounterUpdated(
OnUpdateCountersUpdated(type, counters));
}
-void ProfileSyncService::OnDirectoryTypeStatusCounterUpdated(
+void ProfileSyncService::OnDatatypeStatusCounterUpdated(
syncer::ModelType type,
const syncer::StatusCounters& counters) {
FOR_EACH_OBSERVER(syncer::TypeDebugInfoObserver, type_debug_info_observers_,
@@ -1809,7 +1810,7 @@ void ProfileSyncService::GetModelSafeRoutingInfo(
}
}
-base::Value* ProfileSyncService::GetTypeStatusMap() const {
+base::Value* ProfileSyncService::GetTypeStatusMap() {
std::unique_ptr<base::ListValue> result(new base::ListValue());
if (!backend_.get() || !backend_initialized_) {
@@ -1892,11 +1893,13 @@ base::Value* ProfileSyncService::GetTypeStatusMap() const {
type_status->SetString("value", "Disabled by User");
}
- int live_count = detailed_status.num_entries_by_type[type] -
- detailed_status.num_to_delete_entries_by_type[type];
- type_status->SetInteger("num_entries",
- detailed_status.num_entries_by_type[type]);
- type_status->SetInteger("num_live", live_count);
+ const auto& dtc_iter = data_type_controllers_.find(type);
+ if (dtc_iter != data_type_controllers_.end()) {
+ // OnDatatypeStatusCounterUpdated that posts back to the UI thread.
maxbogue 2016/10/06 17:16:32 "OnDatatypeStatusCounterUpdated that posts back to
Gang Wu 2016/10/07 03:59:43 Done.
+ dtc_iter->second->GetStatusCounters(BindToCurrentThread(
+ base::Bind(&ProfileSyncService::OnDatatypeStatusCounterUpdated,
+ base::Unretained(this))));
+ }
result->Append(std::move(type_status));
}

Powered by Google App Engine
This is Rietveld 408576698