| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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.h" | 5 #include "chrome/browser/memory/tab_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 // This loop can only run at most twice. If it doesn't exit the first time | 966 // This loop can only run at most twice. If it doesn't exit the first time |
| 967 // through, by the second time through |notified_renderers_| will be empty. | 967 // through, by the second time through |notified_renderers_| will be empty. |
| 968 // Since |renderers| is always non-empty, the first renderer encountered | 968 // Since |renderers| is always non-empty, the first renderer encountered |
| 969 // during the second pass will be notified. | 969 // during the second pass will be notified. |
| 970 } | 970 } |
| 971 | 971 |
| 972 // Schedule another notification. Use a weak pointer so this doesn't explode | 972 // Schedule another notification. Use a weak pointer so this doesn't explode |
| 973 // during tear down. | 973 // during tear down. |
| 974 task_runner_->PostDelayedTask( | 974 task_runner_->PostDelayedTask( |
| 975 FROM_HERE, | 975 FROM_HERE, |
| 976 base::Bind(&TabManager::DoChildProcessDispatch, | 976 base::BindOnce(&TabManager::DoChildProcessDispatch, |
| 977 weak_ptr_factory_.GetWeakPtr()), | 977 weak_ptr_factory_.GetWeakPtr()), |
| 978 base::TimeDelta::FromSeconds(kRendererNotificationDelayInSeconds)); | 978 base::TimeDelta::FromSeconds(kRendererNotificationDelayInSeconds)); |
| 979 } | 979 } |
| 980 | 980 |
| 981 // TODO(jamescook): This should consider tabs with references to other tabs, | 981 // TODO(jamescook): This should consider tabs with references to other tabs, |
| 982 // such as tabs created with JavaScript window.open(). Potentially consider | 982 // such as tabs created with JavaScript window.open(). Potentially consider |
| 983 // discarding the entire set together, or use that in the priority computation. | 983 // discarding the entire set together, or use that in the priority computation. |
| 984 content::WebContents* TabManager::DiscardTabImpl() { | 984 content::WebContents* TabManager::DiscardTabImpl() { |
| 985 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 985 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 986 TabStatsList stats = GetTabStats(); | 986 TabStatsList stats = GetTabStats(); |
| 987 | 987 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1011 // platform. | 1011 // platform. |
| 1012 std::string allow_multiple_discards = variations::GetVariationParamValue( | 1012 std::string allow_multiple_discards = variations::GetVariationParamValue( |
| 1013 features::kAutomaticTabDiscarding.name, "AllowMultipleDiscards"); | 1013 features::kAutomaticTabDiscarding.name, "AllowMultipleDiscards"); |
| 1014 return (allow_multiple_discards != "true"); | 1014 return (allow_multiple_discards != "true"); |
| 1015 #else | 1015 #else |
| 1016 return false; | 1016 return false; |
| 1017 #endif | 1017 #endif |
| 1018 } | 1018 } |
| 1019 | 1019 |
| 1020 } // namespace memory | 1020 } // namespace memory |
| OLD | NEW |