Commit 9f8d40e6 authored by Mikel Astiz's avatar Mikel Astiz Committed by Commit Bot

bookmarks: Add more fine-grained DCHECKs upon creation

IsValidIndex() captures the very same preconditions but calling out the
validity of the parent in dedicated DCHECKs helps readability and allows
understanding user reports better.

Bug: 1051614
Change-Id: If10e53fc52b3f6003dba9f9b2bf386ccf75de3e7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2054165
Auto-Submit: Mikel Astiz <mastiz@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#741114}
parent ba98f316
......@@ -610,6 +610,8 @@ const BookmarkNode* BookmarkModel::AddFolder(
base::Optional<std::string> guid) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(loaded_);
DCHECK(parent);
DCHECK(parent->is_folder());
DCHECK(!is_root_node(parent));
DCHECK(IsValidIndex(parent, index, true));
......@@ -640,6 +642,8 @@ const BookmarkNode* BookmarkModel::AddURL(
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(loaded_);
DCHECK(url.is_valid());
DCHECK(parent);
DCHECK(parent->is_folder());
DCHECK(!is_root_node(parent));
DCHECK(IsValidIndex(parent, index, true));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment