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

Unified Diff: components/sync/model/model_type_debug_info.cc

Issue 2672493002: [Sync] Switch bots to run integ tests for autofill as USS. (Closed)
Patch Set: Updated for Gang's comment. Created 3 years, 10 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/model/model_type_debug_info.h ('k') | testing/variations/fieldtrial_testing_config.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync/model/model_type_debug_info.cc
diff --git a/components/sync/model/model_type_debug_info.cc b/components/sync/model/model_type_debug_info.cc
index 749842b3151dcac78e254e79a97d26e67786e408..f2f1dfdd09d9575b4855a6429a4ecbac136a67c8 100644
--- a/components/sync/model/model_type_debug_info.cc
+++ b/components/sync/model/model_type_debug_info.cc
@@ -12,34 +12,29 @@
#include "components/sync/model_impl/processor_entity_tracker.h"
#include "components/sync/protocol/proto_value_conversions.h"
+using base::DictionaryValue;
+using base::ListValue;
+
namespace syncer {
namespace {
-SharedModelTypeProcessor* GetProcessorFromBridge(
- const base::WeakPtr<ModelTypeSyncBridge>& bridge) {
- if (!bridge.get()) {
- LOG(WARNING)
- << "ModelTypeSyncBridge destroyed before debug info was retrieved.";
- return nullptr;
- }
- SharedModelTypeProcessor* processor =
- static_cast<SharedModelTypeProcessor*>(bridge->change_processor());
- if (!processor) {
+SharedModelTypeProcessor* GetProcessorFromBridge(ModelTypeSyncBridge* bridge) {
+ ModelTypeChangeProcessor* processor = bridge->change_processor();
+ if (processor == nullptr) {
LOG(WARNING) << "SharedModelTypeProcessor destroyed before debug info was "
"retrieved.";
- return nullptr;
}
- return processor;
+ return static_cast<SharedModelTypeProcessor*>(processor);
}
} // namespace
// static
void ModelTypeDebugInfo::GetAllNodes(
- const base::WeakPtr<ModelTypeSyncBridge>& bridge,
- const base::Callback<void(const ModelType,
- std::unique_ptr<base::ListValue>)>& callback) {
+ const base::Callback<void(const ModelType, std::unique_ptr<ListValue>)>&
+ callback,
+ ModelTypeSyncBridge* bridge) {
SharedModelTypeProcessor* processor = GetProcessorFromBridge(bridge);
if (processor) {
bridge->GetAllData(base::Bind(&ModelTypeDebugInfo::MergeDataWithMetadata,
@@ -49,11 +44,11 @@ void ModelTypeDebugInfo::GetAllNodes(
// static
void ModelTypeDebugInfo::GetStatusCounters(
- const base::WeakPtr<ModelTypeSyncBridge>& bridge,
- const base::Callback<void(ModelType, const StatusCounters&)>& callback) {
+ const base::Callback<void(ModelType, const StatusCounters&)>& callback,
+ ModelTypeSyncBridge* bridge) {
SharedModelTypeProcessor* processor = GetProcessorFromBridge(bridge);
if (processor) {
- syncer::StatusCounters counters;
+ StatusCounters counters;
counters.num_entries_and_tombstones = processor->entities_.size();
for (const auto& kv : processor->entities_) {
if (!kv.second->metadata().is_deleted()) {
@@ -69,17 +64,15 @@ ModelTypeDebugInfo::ModelTypeDebugInfo() {}
// static
void ModelTypeDebugInfo::MergeDataWithMetadata(
SharedModelTypeProcessor* processor,
- const base::Callback<void(const ModelType,
- std::unique_ptr<base::ListValue>)>& callback,
+ const base::Callback<void(const ModelType, std::unique_ptr<ListValue>)>&
+ callback,
std::unique_ptr<DataBatch> batch) {
- std::unique_ptr<base::ListValue> all_nodes =
- base::MakeUnique<base::ListValue>();
+ std::unique_ptr<ListValue> all_nodes = base::MakeUnique<ListValue>();
std::string type_string = ModelTypeToString(processor->type_);
while (batch->HasNext()) {
KeyAndData data = batch->Next();
- std::unique_ptr<base::DictionaryValue> node =
- data.second->ToDictionaryValue();
+ std::unique_ptr<DictionaryValue> node = data.second->ToDictionaryValue();
ProcessorEntityTracker* entity =
processor->GetEntityForStorageKey(data.first);
// Entity could be null if there are some unapplied changes.
@@ -93,8 +86,8 @@ void ModelTypeDebugInfo::MergeDataWithMetadata(
// Create a permanent folder for this data type. Since sync server no longer
// create root folders, and USS won't migrate root folders from directory, we
// create root folders for each data type here.
- std::unique_ptr<base::DictionaryValue> rootnode =
- base::MakeUnique<base::DictionaryValue>();
+ std::unique_ptr<DictionaryValue> rootnode =
+ base::MakeUnique<DictionaryValue>();
// Function isTypeRootNode in sync_node_browser.js use PARENT_ID and
// UNIQUE_SERVER_TAG to check if the node is root node. isChildOf in
// sync_node_browser.js uses modelType to check if root node is parent of real
« no previous file with comments | « components/sync/model/model_type_debug_info.h ('k') | testing/variations/fieldtrial_testing_config.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698