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

Unified Diff: content/browser/tab_contents/navigation_controller.cc

Issue 8895010: Remove static initialization from navigation_controller.cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/tab_contents/navigation_controller.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/tab_contents/navigation_controller.cc
diff --git a/content/browser/tab_contents/navigation_controller.cc b/content/browser/tab_contents/navigation_controller.cc
index a194a7e267eb10518433f97b8486ed43203dd6b1..f69efe1ab6225cbddc807778ff695a253e8359d0 100644
--- a/content/browser/tab_contents/navigation_controller.cc
+++ b/content/browser/tab_contents/navigation_controller.cc
@@ -103,9 +103,11 @@ bool AreURLsInPageNavigation(const GURL& existing_url, const GURL& new_url) {
// NavigationController ---------------------------------------------------
+const size_t kMaxEntryCountForTestingNotSet = -1;
+
// static
-size_t NavigationController::max_entry_count_ =
- content::kMaxSessionHistoryEntries;
+size_t NavigationController::max_entry_count_for_testing_ =
+ kMaxEntryCountForTestingNotSet;
// static
bool NavigationController::check_for_repost_ = true;
@@ -1125,7 +1127,7 @@ void NavigationController::InsertOrReplaceEntry(NavigationEntry* entry,
NotifyPrunedEntries(this, false, num_pruned);
}
- if (entries_.size() >= max_entry_count_) {
+ if (entries_.size() >= max_entry_count()) {
RemoveEntryAtIndex(0, GURL());
NotifyPrunedEntries(this, true, 1);
}
@@ -1204,6 +1206,13 @@ void NavigationController::DisablePromptOnRepost() {
check_for_repost_ = false;
}
+// static
+size_t NavigationController::max_entry_count() {
+ if (max_entry_count_for_testing_ != kMaxEntryCountForTestingNotSet)
+ return max_entry_count_for_testing_;
+ return content::kMaxSessionHistoryEntries;
+}
+
void NavigationController::SetActive(bool is_active) {
if (is_active && needs_reload_)
LoadIfNecessary();
« no previous file with comments | « content/browser/tab_contents/navigation_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698