Chromium Code Reviews| Index: chrome/browser/memory/tab_manager_web_contents_data.cc |
| diff --git a/chrome/browser/memory/tab_manager_web_contents_data.cc b/chrome/browser/memory/tab_manager_web_contents_data.cc |
| index 88a7ebb537b25567a3eff2bf8843f41e52f4b507..8e983fd00437214e55852bbf32b8f44658cb91d7 100644 |
| --- a/chrome/browser/memory/tab_manager_web_contents_data.cc |
| +++ b/chrome/browser/memory/tab_manager_web_contents_data.cc |
| @@ -20,7 +20,11 @@ DEFINE_WEB_CONTENTS_USER_DATA_KEY(memory::TabManager::WebContentsData); |
| namespace memory { |
| TabManager::WebContentsData::WebContentsData(content::WebContents* web_contents) |
| - : WebContentsObserver(web_contents), test_tick_clock_(nullptr) {} |
| + : WebContentsObserver(web_contents), |
| + test_tick_clock_(nullptr), |
| + last_purge_and_suspend_modified_time_( |
| + base::TimeTicks::FromInternalValue(0)), |
| + purge_and_suspend_state_(BACKGROUNDED) {} |
|
haraken
2016/10/19 08:57:54
Is it okay to unconditionally set the initial valu
tasak
2016/10/19 10:17:13
In PurgeAndSuspendBackgroundedTabs, firstly we che
|
| TabManager::WebContentsData::~WebContentsData() {} |
| @@ -198,4 +202,20 @@ bool TabManager::WebContentsData::IsAutoDiscardable() { |
| return tab_data_.is_auto_discardable; |
| } |
| +void TabManager::WebContentsData::SetPurgeAndSuspendState( |
| + PurgeAndSuspendState state) { |
| + last_purge_and_suspend_modified_time_ = TimeTicks::Now(); |
| + purge_and_suspend_state_ = state; |
| +} |
| + |
| +base::TimeTicks TabManager::WebContentsData::LastPurgeAndSuspendModifiedTime() |
| + const { |
| + return last_purge_and_suspend_modified_time_; |
| +} |
| + |
| +TabManager::PurgeAndSuspendState |
| +TabManager::WebContentsData::GetPurgeAndSuspendState() const { |
| + return purge_and_suspend_state_; |
| +} |
| + |
| } // namespace memory |