Commit 9b51970d authored by thakis@chromium.org's avatar thakis@chromium.org

Remove static initialization from navigation_controller.cc

BUG=94925
TEST=none

Review URL: http://codereview.chromium.org/8895010

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113879 0039d316-1c4b-4281-b951-d872f2087c98
parent 1709ec2c
......@@ -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();
......
......@@ -336,9 +336,9 @@ class CONTENT_EXPORT NavigationController {
// Maximum number of entries before we start removing entries from the front.
static void set_max_entry_count_for_testing(size_t max_entry_count) {
max_entry_count_ = max_entry_count;
max_entry_count_for_testing_ = max_entry_count;
}
static size_t max_entry_count() { return max_entry_count_; }
static size_t max_entry_count();
// Cancels a repost that brought up a warning.
void CancelPendingReload();
......@@ -501,7 +501,7 @@ class CONTENT_EXPORT NavigationController {
static bool check_for_repost_;
// The maximum number of entries that a navigation controller can store.
static size_t max_entry_count_;
static size_t max_entry_count_for_testing_;
// If a repost is pending, its type (RELOAD or RELOAD_IGNORING_CACHE),
// NO_RELOAD otherwise.
......
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