Chromium Code Reviews| 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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 354 return false; | 354 return false; |
| 355 } | 355 } |
| 356 | 356 |
| 357 // Do not discard a tab that was explicitly disallowed to. | 357 // Do not discard a tab that was explicitly disallowed to. |
| 358 if (!IsTabAutoDiscardable(web_contents)) | 358 if (!IsTabAutoDiscardable(web_contents)) |
| 359 return false; | 359 return false; |
| 360 | 360 |
| 361 return true; | 361 return true; |
| 362 } | 362 } |
| 363 | 363 |
| 364 void TabManager::DiscardTab() { | 364 bool TabManager::DiscardTab() { |
| 365 #if defined(OS_CHROMEOS) | 365 #if defined(OS_CHROMEOS) |
| 366 // Call Chrome OS specific low memory handling process. | 366 // Call Chrome OS specific low memory handling process. |
| 367 if (base::FeatureList::IsEnabled(features::kArcMemoryManagement)) { | 367 if (base::FeatureList::IsEnabled(features::kArcMemoryManagement)) { |
| 368 delegate_->LowMemoryKill(GetUnsortedTabStats()); | 368 delegate_->LowMemoryKill(GetUnsortedTabStats()); |
| 369 return; | 369 return false; |
|
haraken
2017/03/24 11:55:38
Does this mean that the tab discarding not working
bashi
2017/03/28 03:15:30
Sorry I didn't check the implementation of LowMemo
| |
| 370 } | 370 } |
| 371 #endif | 371 #endif |
| 372 DiscardTabImpl(); | 372 return DiscardTabImpl() != nullptr; |
| 373 } | 373 } |
| 374 | 374 |
| 375 WebContents* TabManager::DiscardTabById(int64_t target_web_contents_id) { | 375 WebContents* TabManager::DiscardTabById(int64_t target_web_contents_id) { |
| 376 TabStripModel* model; | 376 TabStripModel* model; |
| 377 int index = FindTabStripModelById(target_web_contents_id, &model); | 377 int index = FindTabStripModelById(target_web_contents_id, &model); |
| 378 | 378 |
| 379 if (index == -1) | 379 if (index == -1) |
| 380 return nullptr; | 380 return nullptr; |
| 381 | 381 |
| 382 VLOG(1) << "Discarding tab " << index << " id " << target_web_contents_id; | 382 VLOG(1) << "Discarding tab " << index << " id " << target_web_contents_id; |
| (...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |