Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/task_manager/providers/arc/arc_process_whitelist.h" | |
| 6 | |
| 7 #include "components/arc/common/process.mojom.h" | |
| 8 | |
| 9 namespace task_manager { | |
| 10 | |
| 11 namespace { | |
| 12 | |
| 13 const char* kDefaultWhitelist[] = {"/system/bin/surfaceflinger"}; | |
| 14 } | |
|
Luis Héctor Chávez
2017/01/24 17:09:41
nit: // namespace
(also, add a blank line above).
Eliot Courtney
2017/01/25 02:08:12
Done.
| |
| 15 | |
| 16 ArcProcessWhitelist::ArcProcessWhitelist() | |
| 17 : whitelist_(std::begin(kDefaultWhitelist), std::end(kDefaultWhitelist)) {} | |
| 18 | |
| 19 ArcProcessWhitelist::ArcProcessWhitelist(std::set<std::string>&& whitelist) | |
| 20 : whitelist_(whitelist) {} | |
| 21 | |
| 22 ArcProcessWhitelist::~ArcProcessWhitelist() = default; | |
| 23 | |
| 24 bool ArcProcessWhitelist::ShouldDisplayProcess( | |
| 25 const arc::ArcProcess& process) const { | |
| 26 // Check the explicit whitelist. If it is not in there, decide based on its | |
| 27 // ProcessState. | |
| 28 if (whitelist_.count(process.process_name())) | |
| 29 return true; | |
| 30 switch (process.process_state()) { | |
| 31 case arc::mojom::ProcessState::TOP: // Fallthrough. | |
| 32 case arc::mojom::ProcessState::IMPORTANT_FOREGROUND: | |
| 33 case arc::mojom::ProcessState::TOP_SLEEPING: | |
| 34 return true; | |
| 35 default: | |
| 36 break; | |
| 37 } | |
| 38 return false; | |
| 39 } | |
| 40 | |
| 41 } // namespace task_manager | |
| OLD | NEW |