| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/memory/tab_manager_web_contents_data.h" | 5 #include "chrome/browser/memory/tab_manager_web_contents_data.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
| 8 #include "base/time/tick_clock.h" | 8 #include "base/time/tick_clock.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/engagement/site_engagement_service.h" | 10 #include "chrome/browser/engagement/site_engagement_service.h" |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 g_browser_process->GetTabManager()->OnAutoDiscardableStateChange( | 197 g_browser_process->GetTabManager()->OnAutoDiscardableStateChange( |
| 198 web_contents(), state); | 198 web_contents(), state); |
| 199 } | 199 } |
| 200 | 200 |
| 201 bool TabManager::WebContentsData::IsAutoDiscardable() { | 201 bool TabManager::WebContentsData::IsAutoDiscardable() { |
| 202 return tab_data_.is_auto_discardable; | 202 return tab_data_.is_auto_discardable; |
| 203 } | 203 } |
| 204 | 204 |
| 205 void TabManager::WebContentsData::SetPurgeAndSuspendState( | 205 void TabManager::WebContentsData::SetPurgeAndSuspendState( |
| 206 PurgeAndSuspendState state) { | 206 PurgeAndSuspendState state) { |
| 207 last_purge_and_suspend_modified_time_ = NowTicks(); | 207 last_purge_and_suspend_modified_time_ = TimeTicks::Now(); |
| 208 purge_and_suspend_state_ = state; | 208 purge_and_suspend_state_ = state; |
| 209 } | 209 } |
| 210 | 210 |
| 211 base::TimeTicks TabManager::WebContentsData::LastPurgeAndSuspendModifiedTime() | 211 base::TimeTicks TabManager::WebContentsData::LastPurgeAndSuspendModifiedTime() |
| 212 const { | 212 const { |
| 213 return last_purge_and_suspend_modified_time_; | 213 return last_purge_and_suspend_modified_time_; |
| 214 } | 214 } |
| 215 | 215 |
| 216 void TabManager::WebContentsData::SetLastPurgeAndSuspendModifiedTimeForTesting( | |
| 217 base::TimeTicks timestamp) { | |
| 218 last_purge_and_suspend_modified_time_ = timestamp; | |
| 219 } | |
| 220 | |
| 221 TabManager::PurgeAndSuspendState | 216 TabManager::PurgeAndSuspendState |
| 222 TabManager::WebContentsData::GetPurgeAndSuspendState() const { | 217 TabManager::WebContentsData::GetPurgeAndSuspendState() const { |
| 223 return purge_and_suspend_state_; | 218 return purge_and_suspend_state_; |
| 224 } | 219 } |
| 225 | 220 |
| 226 } // namespace memory | 221 } // namespace memory |
| OLD | NEW |