Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Side by Side Diff: chrome/browser/memory/tab_manager_delegate_chromeos.cc

Issue 2557513004: Remove explicit singletonness of ArcBridgeService part 3. (Closed)
Patch Set: Address comments. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 18 matching lines...) Expand all
29 #include "chrome/browser/chromeos/arc/process/arc_process_service.h" 29 #include "chrome/browser/chromeos/arc/process/arc_process_service.h"
30 #include "chrome/browser/memory/memory_kills_monitor.h" 30 #include "chrome/browser/memory/memory_kills_monitor.h"
31 #include "chrome/browser/memory/tab_stats.h" 31 #include "chrome/browser/memory/tab_stats.h"
32 #include "chrome/browser/ui/browser.h" 32 #include "chrome/browser/ui/browser.h"
33 #include "chrome/browser/ui/browser_list.h" 33 #include "chrome/browser/ui/browser_list.h"
34 #include "chrome/browser/ui/tabs/tab_strip_model.h" 34 #include "chrome/browser/ui/tabs/tab_strip_model.h"
35 #include "chrome/common/chrome_constants.h" 35 #include "chrome/common/chrome_constants.h"
36 #include "chrome/common/chrome_features.h" 36 #include "chrome/common/chrome_features.h"
37 #include "chromeos/dbus/dbus_thread_manager.h" 37 #include "chromeos/dbus/dbus_thread_manager.h"
38 #include "components/arc/arc_bridge_service.h" 38 #include "components/arc/arc_bridge_service.h"
39 #include "components/arc/arc_service_manager.h"
39 #include "components/arc/common/process.mojom.h" 40 #include "components/arc/common/process.mojom.h"
40 #include "components/exo/shell_surface.h" 41 #include "components/exo/shell_surface.h"
41 #include "content/public/browser/browser_thread.h" 42 #include "content/public/browser/browser_thread.h"
42 #include "content/public/browser/notification_service.h" 43 #include "content/public/browser/notification_service.h"
43 #include "content/public/browser/notification_types.h" 44 #include "content/public/browser/notification_types.h"
44 #include "content/public/browser/render_process_host.h" 45 #include "content/public/browser/render_process_host.h"
45 #include "content/public/browser/render_widget_host.h" 46 #include "content/public/browser/render_widget_host.h"
46 #include "content/public/browser/zygote_host_linux.h" 47 #include "content/public/browser/zygote_host_linux.h"
47 #include "ui/aura/window.h" 48 #include "ui/aura/window.h"
48 #include "ui/wm/public/activation_client.h" 49 #include "ui/wm/public/activation_client.h"
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 candidates.emplace_back(&app); 539 candidates.emplace_back(&app);
539 } 540 }
540 541
541 // Sort candidates according to priority. 542 // Sort candidates according to priority.
542 std::sort(candidates.begin(), candidates.end()); 543 std::sort(candidates.begin(), candidates.end());
543 544
544 return candidates; 545 return candidates;
545 } 546 }
546 547
547 bool TabManagerDelegate::KillArcProcess(const int nspid) { 548 bool TabManagerDelegate::KillArcProcess(const int nspid) {
548 auto* arc_bridge_service = arc::ArcBridgeService::Get(); 549 auto* arc_service_manager = arc::ArcServiceManager::Get();
549 if (!arc_bridge_service) 550 if (!arc_service_manager)
550 return false; 551 return false;
551 552
552 auto* arc_process_instance = 553 auto* arc_process_instance =
553 arc_bridge_service->process()->GetInstanceForMethod( 554 arc_service_manager->arc_bridge_service()
554 "KillProcess", kMinVersionForKillProcess); 555 ->process()
556 ->GetInstanceForMethod("KillProcess", kMinVersionForKillProcess);
555 if (!arc_process_instance) 557 if (!arc_process_instance)
556 return false; 558 return false;
557 559
558 arc_process_instance->KillProcess(nspid, "LowMemoryKill"); 560 arc_process_instance->KillProcess(nspid, "LowMemoryKill");
559 return true; 561 return true;
560 } 562 }
561 563
562 bool TabManagerDelegate::KillTab(int64_t tab_id) { 564 bool TabManagerDelegate::KillTab(int64_t tab_id) {
563 // Check |tab_manager_| is alive before taking tabs into consideration. 565 // Check |tab_manager_| is alive before taking tabs into consideration.
564 return tab_manager_ && 566 return tab_manager_ &&
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 } 718 }
717 priority += priority_increment; 719 priority += priority_increment;
718 } 720 }
719 721
720 if (oom_scores_to_change.size()) 722 if (oom_scores_to_change.size())
721 GetDebugDaemonClient()->SetOomScoreAdj( 723 GetDebugDaemonClient()->SetOomScoreAdj(
722 oom_scores_to_change, base::Bind(&OnSetOomScoreAdj)); 724 oom_scores_to_change, base::Bind(&OnSetOomScoreAdj));
723 } 725 }
724 726
725 } // namespace memory 727 } // namespace memory
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/policy/device_status_collector.cc ('k') | chrome/browser/policy/policy_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698