| 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 #ifndef CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_ARC_ARC_PROCESS_TASK_H_ | 5 #ifndef CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_ARC_ARC_PROCESS_TASK_H_ |
| 6 #define CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_ARC_ARC_PROCESS_TASK_H_ | 6 #define CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_ARC_ARC_PROCESS_TASK_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 8 #include <string> | 9 #include <string> |
| 10 #include <vector> |
| 9 | 11 |
| 10 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/weak_ptr.h" |
| 11 #include "chrome/browser/task_management/providers/task.h" | 14 #include "chrome/browser/task_management/providers/task.h" |
| 12 #include "components/arc/common/process.mojom.h" | 15 #include "components/arc/common/process.mojom.h" |
| 16 #include "components/arc/intent_helper/activity_icon_loader.h" |
| 13 | 17 |
| 14 namespace task_management { | 18 namespace task_management { |
| 15 | 19 |
| 16 // Defines a task that represents an ARC process. | 20 // Defines a task that represents an ARC process. |
| 17 class ArcProcessTask : public Task { | 21 class ArcProcessTask : public Task { |
| 18 public: | 22 public: |
| 19 ArcProcessTask( | 23 ArcProcessTask(base::ProcessId pid, |
| 20 base::ProcessId pid, | 24 base::ProcessId nspid, |
| 21 base::ProcessId nspid, | 25 const std::string& process_name, |
| 22 const std::string& process_name, | 26 arc::mojom::ProcessState process_state, |
| 23 arc::mojom::ProcessState process_state); | 27 const std::vector<std::string>& packages); |
| 24 ~ArcProcessTask() override; | 28 ~ArcProcessTask() override; |
| 25 | 29 |
| 26 // task_management::Task: | 30 // task_management::Task: |
| 27 Type GetType() const override; | 31 Type GetType() const override; |
| 28 int GetChildProcessUniqueID() const override; | 32 int GetChildProcessUniqueID() const override; |
| 29 bool IsKillable() override; | 33 bool IsKillable() override; |
| 30 void Kill() override; | 34 void Kill() override; |
| 31 | 35 |
| 32 void SetProcessState(arc::mojom::ProcessState process_state); | 36 void SetProcessState(arc::mojom::ProcessState process_state); |
| 33 | 37 |
| 34 base::ProcessId nspid() const { return nspid_; } | 38 base::ProcessId nspid() const { return nspid_; } |
| 35 const std::string& process_name() const { return process_name_; } | 39 const std::string& process_name() const { return process_name_; } |
| 36 | 40 |
| 37 private: | 41 private: |
| 42 void OnIconLoaded( |
| 43 std::unique_ptr<arc::ActivityIconLoader::ActivityToIconsMap> icons); |
| 44 |
| 38 const base::ProcessId nspid_; | 45 const base::ProcessId nspid_; |
| 39 const std::string process_name_; | 46 const std::string process_name_; |
| 40 arc::mojom::ProcessState process_state_; | 47 arc::mojom::ProcessState process_state_; |
| 41 | 48 |
| 49 // Note: This should remain the last member so it'll be destroyed and |
| 50 // invalidate the weak pointers before any other members are destroyed. |
| 51 base::WeakPtrFactory<ArcProcessTask> weak_ptr_factory_; |
| 52 |
| 42 DISALLOW_COPY_AND_ASSIGN(ArcProcessTask); | 53 DISALLOW_COPY_AND_ASSIGN(ArcProcessTask); |
| 43 }; | 54 }; |
| 44 | 55 |
| 45 } // namespace task_management | 56 } // namespace task_management |
| 46 | 57 |
| 47 #endif // CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_ARC_ARC_PROCESS_TASK_H_ | 58 #endif // CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_ARC_ARC_PROCESS_TASK_H_ |
| OLD | NEW |