diff options
author | jamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-13 22:21:02 +0000 |
---|---|---|
committer | jamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-13 22:21:02 +0000 |
commit | 9a890458d2438e8fe9b3bcc8a6c9bee4888d1a63 (patch) | |
tree | a4b4d12848d0b4c2923c8e8eb08a7b93bde55d41 /content/browser/web_contents/web_contents_impl.h | |
parent | 0b64c91757eaf370138512864ad7f0f6f331b431 (diff) | |
download | chromium_src-9a890458d2438e8fe9b3bcc8a6c9bee4888d1a63.zip chromium_src-9a890458d2438e8fe9b3bcc8a6c9bee4888d1a63.tar.gz chromium_src-9a890458d2438e8fe9b3bcc8a6c9bee4888d1a63.tar.bz2 |
Avoid discarding freshly created background tabs
The Chrome OS out-of-memory tab discarder uses the "last selected" time as a signal for which tab to discard. This starts at 0 for freshly created background tabs, like those created with a control-click. The user probably doesn't want to discard those tabs, since they just opened them.
Since the only other user of WebContents::GetLastSelectedTime() is devtools, which uses it for a similar kind of sorting based on activity, rename the method to GetLastActiveTime() and start the value with the tab creation time.
BUG=338735
TEST=content_unittests WebContentsImpl.GetLastActiveTime
TBR=torne@chromium.org for rename touching android_webview
Review URL: https://codereview.chromium.org/138913021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251154 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/web_contents/web_contents_impl.h')
-rw-r--r-- | content/browser/web_contents/web_contents_impl.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h index 37679f1..c950266 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h @@ -233,7 +233,7 @@ class CONTENT_EXPORT WebContentsImpl virtual base::TerminationStatus GetCrashedStatus() const OVERRIDE; virtual bool IsBeingDestroyed() const OVERRIDE; virtual void NotifyNavigationStateChanged(unsigned changed_flags) OVERRIDE; - virtual base::TimeTicks GetLastSelectedTime() const OVERRIDE; + virtual base::TimeTicks GetLastActiveTime() const OVERRIDE; virtual void WasShown() OVERRIDE; virtual void WasHidden() OVERRIDE; virtual bool NeedToFireBeforeUnload() OVERRIDE; @@ -626,6 +626,7 @@ class CONTENT_EXPORT WebContentsImpl CrossSiteCantPreemptAfterUnload); FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, PendingContents); FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FrameTreeShape); + FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, GetLastActiveTime); FRIEND_TEST_ALL_PREFIXES(FormStructureBrowserTest, HTMLFiles); FRIEND_TEST_ALL_PREFIXES(NavigationControllerTest, HistoryNavigate); FRIEND_TEST_ALL_PREFIXES(RenderFrameHostManagerTest, PageDoesBackAndReload); @@ -988,8 +989,9 @@ class CONTENT_EXPORT WebContentsImpl // Settings that get passed to the renderer process. RendererPreferences renderer_preferences_; - // The time that this tab was last selected. - base::TimeTicks last_selected_time_; + // The time that this WebContents was last made active. The initial value is + // the WebContents creation time. + base::TimeTicks last_active_time_; // See description above setter. bool closed_by_user_gesture_; |