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

Unified Diff: components/browser_sync/profile_sync_service.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/browser_sync/profile_sync_service.h ('k') | components/sync/core/shared_model_type_processor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..a26777dd7e275d185b02f7a25862f0323406c7f2 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,15 @@ 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 so that
+ // real results can't get overwritten by the empty counters set at the end
+ // of this method.
+ dtc_iter->second->GetStatusCounters(BindToCurrentThread(
+ base::Bind(&ProfileSyncService::OnDatatypeStatusCounterUpdated,
+ base::Unretained(this))));
+ }
result->Append(std::move(type_status));
}
« no previous file with comments | « components/browser_sync/profile_sync_service.h ('k') | components/sync/core/shared_model_type_processor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698