Get rid of unique_ptrs for UpdateResponseData and EntityData.
Immutability for const UpdateResponseDataList should be preserved for
its members UpdateResponseData and EntityData. That's why this CL
replaces unique_ptrs with movable semantics for UpdateResponseData
and EntityData.
Bug: 1029267
Change-Id: Ia5e8d35e81939ed9f21ebb56c9d5922c053fc42d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1980736
Commit-Queue: Mikel Astiz <[email protected]>
Reviewed-by: Olivier Robin <[email protected]>
Reviewed-by: Scott Violet <[email protected]>
Reviewed-by: Alan Cutter <[email protected]>
Reviewed-by: Dominic Battré <[email protected]>
Reviewed-by: Istiaque Ahmed <[email protected]>
Reviewed-by: Mikel Astiz <[email protected]>
Cr-Commit-Position: refs/heads/master@{#729693}
diff --git a/components/sync_bookmarks/bookmark_model_merger.h b/components/sync_bookmarks/bookmark_model_merger.h
index bf0783ec..9758ee9 100644
--- a/components/sync_bookmarks/bookmark_model_merger.h
+++ b/components/sync_bookmarks/bookmark_model_merger.h
@@ -54,9 +54,7 @@
class RemoteTreeNode final {
private:
using UpdatesPerParentId =
- std::unordered_map<base::StringPiece,
- syncer::UpdateResponseDataList,
- base::StringPieceHash>;
+ std::unordered_map<std::string, syncer::UpdateResponseDataList>;
public:
// Constructs a tree given |update| as root and recursively all descendants
@@ -65,9 +63,8 @@
// |*updates_per_parent_id| must represent valid updates. Updates
// corresponding from descendant nodes are moved away from
// |*updates_per_parent_id|.
- static RemoteTreeNode BuildTree(
- std::unique_ptr<syncer::UpdateResponseData> update,
- UpdatesPerParentId* updates_per_parent_id);
+ static RemoteTreeNode BuildTree(syncer::UpdateResponseData update,
+ UpdatesPerParentId* updates_per_parent_id);
~RemoteTreeNode();
@@ -75,8 +72,8 @@
RemoteTreeNode(RemoteTreeNode&&);
RemoteTreeNode& operator=(RemoteTreeNode&&);
- const syncer::EntityData& entity() const { return *update_->entity; }
- int64_t response_version() const { return update_->response_version; }
+ const syncer::EntityData& entity() const { return update_.entity; }
+ int64_t response_version() const { return update_.response_version; }
// Direct children nodes, sorted by ascending unique position. These are
// guaranteed to be valid updates (e.g. IsValidBookmarkSpecifics()).
@@ -94,7 +91,7 @@
RemoteTreeNode();
- std::unique_ptr<syncer::UpdateResponseData> update_;
+ syncer::UpdateResponseData update_;
std::vector<RemoteTreeNode> children_;
};