Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1090)

Side by Side Diff: chrome/browser/tab_contents/navigation_controller.cc

Issue 5610005: Makes instant run before unload listeners. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome
Patch Set: Fix comments and reset session id appropriately Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/tab_contents/navigation_controller.h" 5 #include "chrome/browser/tab_contents/navigation_controller.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 // There's a transient entry. In this case we want the last committed to 972 // There's a transient entry. In this case we want the last committed to
973 // point to the previous entry. 973 // point to the previous entry.
974 transient_entry_index_ = entry_count() - 1; 974 transient_entry_index_ = entry_count() - 1;
975 if (last_committed_entry_index_ != -1) 975 if (last_committed_entry_index_ != -1)
976 last_committed_entry_index_--; 976 last_committed_entry_index_--;
977 } 977 }
978 978
979 // Take over the session id from source. 979 // Take over the session id from source.
980 session_id_ = source->session_id_; 980 session_id_ = source->session_id_;
981 981
982 // Reset source's session id as we're taking it over. 982 // Reset source's session id as we're taking it over. We give it a new id in
983 source->session_id_.clear(); 983 // case source is added later on, which can happen with instant enabled if the
984 // tab has a before unload handler.
985 source->session_id_ = SessionID();
984 } 986 }
985 987
986 void NavigationController::PruneAllButActive() { 988 void NavigationController::PruneAllButActive() {
987 int prune_count = entry_count(); 989 int prune_count = entry_count();
988 if (transient_entry_index_ != -1) { 990 if (transient_entry_index_ != -1) {
989 // There is a transient entry. Prune up to it. 991 // There is a transient entry. Prune up to it.
990 DCHECK_EQ(entry_count() - 1, transient_entry_index_); 992 DCHECK_EQ(entry_count() - 1, transient_entry_index_);
991 prune_count = transient_entry_index_; 993 prune_count = transient_entry_index_;
992 transient_entry_index_ = 0; 994 transient_entry_index_ = 0;
993 last_committed_entry_index_ = -1; 995 last_committed_entry_index_ = -1;
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1199 size_t insert_index = 0; 1201 size_t insert_index = 0;
1200 for (int i = 0; i < max_index; i++) { 1202 for (int i = 0; i < max_index; i++) {
1201 // When cloning a tab, copy all entries except interstitial pages 1203 // When cloning a tab, copy all entries except interstitial pages
1202 if (source.entries_[i].get()->page_type() != INTERSTITIAL_PAGE) { 1204 if (source.entries_[i].get()->page_type() != INTERSTITIAL_PAGE) {
1203 entries_.insert(entries_.begin() + insert_index++, 1205 entries_.insert(entries_.begin() + insert_index++,
1204 linked_ptr<NavigationEntry>( 1206 linked_ptr<NavigationEntry>(
1205 new NavigationEntry(*source.entries_[i]))); 1207 new NavigationEntry(*source.entries_[i])));
1206 } 1208 }
1207 } 1209 }
1208 } 1210 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/navigation_controller.h ('k') | chrome/browser/tab_contents/navigation_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698