Kill page id.

BUG=368661
TEST=everything stays green
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation

Review-Url: https://codereview.chromium.org/2389943002
Cr-Commit-Position: refs/heads/master@{#425338}
diff --git a/content/browser/frame_host/navigation_controller_impl.cc b/content/browser/frame_host/navigation_controller_impl.cc
index 31385c7..5f01194 100644
--- a/content/browser/frame_host/navigation_controller_impl.cc
+++ b/content/browser/frame_host/navigation_controller_impl.cc
@@ -175,7 +175,6 @@
   NavigationEntryImpl* entry = new NavigationEntryImpl(
       NULL,  // The site instance for tabs is sent on navigation
              // (WebContents::GetSiteInstance).
-      -1,
       loaded_url,
       referrer,
       base::string16(),
@@ -219,7 +218,6 @@
       pending_entry_index_(-1),
       transient_entry_index_(-1),
       delegate_(delegate),
-      max_restored_page_id_(-1),
       ssl_manager_(this),
       needs_reload_(false),
       is_initial_navigation_(true),
@@ -366,12 +364,11 @@
       DiscardNonCommittedEntriesInternal();
 
     // If we are reloading an entry that no longer belongs to the current
-    // site instance (for example, refreshing a page for just installed app),
-    // the reload must happen in a new process.
-    // The new entry must have a new page_id and site instance, so it behaves
-    // as new navigation (which happens to clear forward history).
-    // Tabs that are discarded due to low memory conditions may not have a site
-    // instance, and should not be treated as a cross-site reload.
+    // SiteInstance (for example, refreshing a page for just installed app), the
+    // reload must happen in a new process. The new entry behaves as new
+    // navigation (which happens to clear forward history). Tabs that are
+    // discarded due to low memory conditions may not have a SiteInstance, and
+    // should not be treated as a cross-site reload.
     SiteInstanceImpl* site_instance = entry->site_instance();
     // Permit reloading guests without further checks.
     bool is_for_guests_only = site_instance && site_instance->HasProcess() &&
@@ -434,13 +431,6 @@
   return IsInitialNavigation() && GetEntryCount() == 0;
 }
 
-NavigationEntryImpl* NavigationControllerImpl::GetEntryWithPageID(
-    SiteInstance* instance,
-    int32_t page_id) const {
-  int index = GetEntryIndexWithPageID(instance, page_id);
-  return (index != -1) ? entries_[index].get() : nullptr;
-}
-
 NavigationEntryImpl*
 NavigationControllerImpl::GetEntryWithUniqueID(int nav_entry_id) const {
   int index = GetEntryIndexWithUniqueID(nav_entry_id);
@@ -723,7 +713,6 @@
       // new FrameNavigationEntry for the target subframe.
       if (SiteIsolationPolicy::UseSubframeNavigationEntries()) {
         entry = GetLastCommittedEntry()->Clone();
-        entry->SetPageID(-1);
         entry->AddOrUpdateFrameEntry(
             node, -1, -1, nullptr,
             static_cast<SiteInstanceImpl*>(params.source_site_instance.get()),
@@ -1155,7 +1144,6 @@
   if (update_virtual_url)
     UpdateVirtualURLToURL(new_entry.get(), params.url);
   new_entry->SetReferrer(params.referrer);
-  new_entry->SetPageID(params.page_id);
   new_entry->SetTransitionType(params.transition);
   new_entry->set_site_instance(
       static_cast<SiteInstanceImpl*>(rfh->GetSiteInstance()));
@@ -1351,7 +1339,6 @@
     new_entry = GetLastCommittedEntry()->Clone();
   }
 
-  new_entry->SetPageID(params.page_id);
   InsertOrReplaceEntry(std::move(new_entry), replace_entry);
 }
 
@@ -1513,11 +1500,6 @@
 
   FinishRestore(source.last_committed_entry_index_,
                 RestoreType::CURRENT_SESSION);
-
-  // Copy the max page id map from the old tab to the new tab.  This ensures
-  // that new and existing navigations in the tab's current SiteInstances
-  // are identified properly.
-  delegate_->CopyMaxPageIDsFrom(source.delegate()->GetWebContents());
 }
 
 void NavigationControllerImpl::CopyStateFromAndPrune(
@@ -1560,17 +1542,6 @@
 
   delegate_->SetHistoryOffsetAndLength(last_committed_entry_index_,
                                        GetEntryCount());
-
-  // Copy the max page id map from the old tab to the new tab. This ensures that
-  // new and existing navigations in the tab's current SiteInstances are
-  // identified properly.
-  NavigationEntryImpl* last_committed = GetLastCommittedEntry();
-  int32_t site_max_page_id =
-      delegate_->GetMaxPageIDForSiteInstance(last_committed->site_instance());
-  delegate_->CopyMaxPageIDsFrom(source->delegate()->GetWebContents());
-  delegate_->UpdateMaxPageIDForSiteInstance(last_committed->site_instance(),
-                                            site_max_page_id);
-  max_restored_page_id_ = source->max_restored_page_id_;
 }
 
 bool NavigationControllerImpl::CanPruneAllButLastCommitted() {
@@ -1637,14 +1608,6 @@
   CHECK(successful_insert) << "Cannot replace existing SessionStorageNamespace";
 }
 
-void NavigationControllerImpl::SetMaxRestoredPageID(int32_t max_id) {
-  max_restored_page_id_ = max_id;
-}
-
-int32_t NavigationControllerImpl::GetMaxRestoredPageID() const {
-  return max_restored_page_id_;
-}
-
 bool NavigationControllerImpl::IsUnmodifiedBlankTab() const {
   return IsInitialNavigation() &&
          !GetLastCommittedEntry() &&
@@ -1760,12 +1723,7 @@
 
   // When replacing, don't prune the forward history.
   if (replace && current_size > 0) {
-    int32_t page_id = entry->GetPageID();
-
     entries_[last_committed_entry_index_] = std::move(entry);
-
-    // This is a new page ID, so we need everybody to know about it.
-    delegate_->UpdateMaxPageID(page_id);
     return;
   }
 
@@ -1789,12 +1747,8 @@
 
   PruneOldestEntryIfFull();
 
-  int32_t page_id = entry->GetPageID();
   entries_.push_back(std::move(entry));
   last_committed_entry_index_ = static_cast<int>(entries_.size()) - 1;
-
-  // This is a new page ID, so we need everybody to know about it.
-  delegate_->UpdateMaxPageID(page_id);
 }
 
 void NavigationControllerImpl::PruneOldestEntryIfFull() {
@@ -2055,8 +2009,6 @@
   DCHECK(selected_index >= 0 && selected_index < GetEntryCount());
   ConfigureEntriesForRestore(&entries_, type);
 
-  SetMaxRestoredPageID(static_cast<int32_t>(GetEntryCount()));
-
   last_committed_entry_index_ = selected_index;
 }
 
@@ -2093,16 +2045,6 @@
   transient_entry_index_ = -1;
 }
 
-int NavigationControllerImpl::GetEntryIndexWithPageID(SiteInstance* instance,
-                                                      int32_t page_id) const {
-  for (int i = static_cast<int>(entries_.size()) - 1; i >= 0; --i) {
-    if ((entries_[i]->site_instance() == instance) &&
-        (entries_[i]->GetPageID() == page_id))
-      return i;
-  }
-  return -1;
-}
-
 int NavigationControllerImpl::GetEntryIndexWithUniqueID(
     int nav_entry_id) const {
   for (int i = static_cast<int>(entries_.size()) - 1; i >= 0; --i) {