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_delegate_chromeos.h" | 5 #include "chrome/browser/memory/tab_manager_delegate_chromeos.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 AdjustOomPriorities(tab_manager_->GetUnsortedTabStats()); | 438 AdjustOomPriorities(tab_manager_->GetUnsortedTabStats()); |
439 } | 439 } |
440 } | 440 } |
441 | 441 |
442 // If able to get the list of ARC procsses, prioritize tabs and apps as a whole. | 442 // If able to get the list of ARC procsses, prioritize tabs and apps as a whole. |
443 // Otherwise try to kill tabs only. | 443 // Otherwise try to kill tabs only. |
444 void TabManagerDelegate::LowMemoryKill( | 444 void TabManagerDelegate::LowMemoryKill( |
445 const TabStatsList& tab_list) { | 445 const TabStatsList& tab_list) { |
446 arc::ArcProcessService* arc_process_service = arc::ArcProcessService::Get(); | 446 arc::ArcProcessService* arc_process_service = arc::ArcProcessService::Get(); |
447 if (arc_process_service && | 447 if (arc_process_service && |
448 arc_process_service->RequestProcessList( | 448 arc_process_service->RequestAppProcessList( |
449 base::Bind(&TabManagerDelegate::LowMemoryKillImpl, | 449 base::Bind(&TabManagerDelegate::LowMemoryKillImpl, |
450 weak_ptr_factory_.GetWeakPtr(), tab_list))) { | 450 weak_ptr_factory_.GetWeakPtr(), tab_list))) { |
451 // LowMemoryKillImpl will be called asynchronously so nothing left to do. | 451 // LowMemoryKillImpl will be called asynchronously so nothing left to do. |
452 return; | 452 return; |
453 } | 453 } |
454 // If the list of ARC processes is not available, call LowMemoryKillImpl | 454 // If the list of ARC processes is not available, call LowMemoryKillImpl |
455 // synchronously with an empty list of apps. | 455 // synchronously with an empty list of apps. |
456 std::vector<arc::ArcProcess> dummy_apps; | 456 std::vector<arc::ArcProcess> dummy_apps; |
457 LowMemoryKillImpl(tab_list, dummy_apps); | 457 LowMemoryKillImpl(tab_list, dummy_apps); |
458 } | 458 } |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 // | 579 // |
580 // Things we need to collect on the browser thread (because | 580 // Things we need to collect on the browser thread (because |
581 // TabStripModel isn't thread safe): | 581 // TabStripModel isn't thread safe): |
582 // 1) whether or not a tab is pinned | 582 // 1) whether or not a tab is pinned |
583 // 2) last time a tab was selected | 583 // 2) last time a tab was selected |
584 // 3) is the tab currently selected | 584 // 3) is the tab currently selected |
585 void TabManagerDelegate::AdjustOomPriorities(const TabStatsList& tab_list) { | 585 void TabManagerDelegate::AdjustOomPriorities(const TabStatsList& tab_list) { |
586 if (IsArcMemoryManagementEnabled()) { | 586 if (IsArcMemoryManagementEnabled()) { |
587 arc::ArcProcessService* arc_process_service = arc::ArcProcessService::Get(); | 587 arc::ArcProcessService* arc_process_service = arc::ArcProcessService::Get(); |
588 if (arc_process_service && | 588 if (arc_process_service && |
589 arc_process_service->RequestProcessList( | 589 arc_process_service->RequestAppProcessList( |
590 base::Bind(&TabManagerDelegate::AdjustOomPrioritiesImpl, | 590 base::Bind(&TabManagerDelegate::AdjustOomPrioritiesImpl, |
591 weak_ptr_factory_.GetWeakPtr(), tab_list))) { | 591 weak_ptr_factory_.GetWeakPtr(), tab_list))) { |
592 return; | 592 return; |
593 } | 593 } |
594 } | 594 } |
595 // Pass in a dummy list if unable to get ARC processes. | 595 // Pass in a dummy list if unable to get ARC processes. |
596 AdjustOomPrioritiesImpl(tab_list, std::vector<arc::ArcProcess>()); | 596 AdjustOomPrioritiesImpl(tab_list, std::vector<arc::ArcProcess>()); |
597 } | 597 } |
598 | 598 |
599 // Excludes persistent ARC apps, but still preserves active chrome tabs and | 599 // Excludes persistent ARC apps, but still preserves active chrome tabs and |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 } | 816 } |
817 } | 817 } |
818 priority += priority_increment; | 818 priority += priority_increment; |
819 } | 819 } |
820 | 820 |
821 if (oom_score_for_tabs.size()) | 821 if (oom_score_for_tabs.size()) |
822 SetOomScoreAdjForTabs(oom_score_for_tabs); | 822 SetOomScoreAdjForTabs(oom_score_for_tabs); |
823 } | 823 } |
824 | 824 |
825 } // namespace memory | 825 } // namespace memory |
OLD | NEW |