| Index: content/browser/frame_host/navigation_controller_impl.cc
|
| diff --git a/content/browser/frame_host/navigation_controller_impl.cc b/content/browser/frame_host/navigation_controller_impl.cc
|
| index 768f595fac70a59363483b33f06821983b03fc60..fd0c5f527bdee4ebde7595b34a22e4b85573551c 100644
|
| --- a/content/browser/frame_host/navigation_controller_impl.cc
|
| +++ b/content/browser/frame_host/navigation_controller_impl.cc
|
| @@ -534,11 +534,15 @@ bool NavigationControllerImpl::CanViewSource() const {
|
| }
|
|
|
| int NavigationControllerImpl::GetLastCommittedEntryIndex() const {
|
| + // The last committed entry index must always be less than the number of
|
| + // entries. It should be -1 iff there are no entries.
|
| + DCHECK_LT(last_committed_entry_index_, GetEntryCount());
|
| + DCHECK_EQ(last_committed_entry_index_ == -1, GetEntryCount() == 0);
|
| return last_committed_entry_index_;
|
| }
|
|
|
| int NavigationControllerImpl::GetEntryCount() const {
|
| - DCHECK(entries_.size() <= max_entry_count());
|
| + DCHECK_LE(entries_.size(), max_entry_count());
|
| return static_cast<int>(entries_.size());
|
| }
|
|
|
| @@ -1726,10 +1730,22 @@ void NavigationControllerImpl::DiscardNonCommittedEntries() {
|
| }
|
|
|
| NavigationEntryImpl* NavigationControllerImpl::GetPendingEntry() const {
|
| + // If there is no pending_entry_, there should be no pending_entry_index_.
|
| + DCHECK(pending_entry_ || pending_entry_index_ == -1);
|
| +
|
| + // If there is a pending_entry_index_, then pending_entry_ must be the entry
|
| + // at that index.
|
| + DCHECK(pending_entry_index_ == -1 ||
|
| + pending_entry_ == GetEntryAtIndex(pending_entry_index_));
|
| +
|
| return pending_entry_;
|
| }
|
|
|
| int NavigationControllerImpl::GetPendingEntryIndex() const {
|
| + // The pending entry index must always be less than the number of entries.
|
| + // If there are no entries, it must be exactly -1.
|
| + DCHECK_LT(pending_entry_index_, GetEntryCount());
|
| + DCHECK(GetEntryCount() != 0 || pending_entry_index_ == -1);
|
| return pending_entry_index_;
|
| }
|
|
|
|
|