| 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
|
|
|