| 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_MEMORY_TAB_MANAGER_DELEGATE_CHROMEOS_H_ | 5 #ifndef CHROME_BROWSER_MEMORY_TAB_MANAGER_DELEGATE_CHROMEOS_H_ |
| 6 #define CHROME_BROWSER_MEMORY_TAB_MANAGER_DELEGATE_CHROMEOS_H_ | 6 #define CHROME_BROWSER_MEMORY_TAB_MANAGER_DELEGATE_CHROMEOS_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 8 #include <utility> | 9 #include <utility> |
| 9 #include <vector> | 10 #include <vector> |
| 10 | 11 |
| 11 #include "base/containers/hash_tables.h" | 12 #include "base/containers/hash_tables.h" |
| 12 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/memory/scoped_ptr.h" | |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/process/process.h" | 16 #include "base/process/process.h" |
| 17 #include "base/timer/timer.h" | 17 #include "base/timer/timer.h" |
| 18 #include "chrome/browser/chromeos/arc/arc_process.h" | 18 #include "chrome/browser/chromeos/arc/arc_process.h" |
| 19 #include "chrome/browser/memory/tab_manager.h" | 19 #include "chrome/browser/memory/tab_manager.h" |
| 20 #include "chrome/browser/memory/tab_stats.h" | 20 #include "chrome/browser/memory/tab_stats.h" |
| 21 #include "chrome/browser/ui/browser_list_observer.h" | 21 #include "chrome/browser/ui/browser_list_observer.h" |
| 22 #include "components/arc/arc_bridge_service.h" | 22 #include "components/arc/arc_bridge_service.h" |
| 23 #include "content/public/browser/notification_observer.h" | 23 #include "content/public/browser/notification_observer.h" |
| 24 #include "content/public/browser/notification_registrar.h" | 24 #include "content/public/browser/notification_registrar.h" |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 const base::WeakPtr<TabManager> tab_manager_; | 202 const base::WeakPtr<TabManager> tab_manager_; |
| 203 | 203 |
| 204 // Registrar to receive renderer notifications. | 204 // Registrar to receive renderer notifications. |
| 205 content::NotificationRegistrar registrar_; | 205 content::NotificationRegistrar registrar_; |
| 206 | 206 |
| 207 // Timer to guarantee that the tab or app is focused for a certain amount of | 207 // Timer to guarantee that the tab or app is focused for a certain amount of |
| 208 // time. | 208 // time. |
| 209 base::OneShotTimer focus_process_score_adjust_timer_; | 209 base::OneShotTimer focus_process_score_adjust_timer_; |
| 210 // Holds the info of the newly focused tab or app. Its OOM score would be | 210 // Holds the info of the newly focused tab or app. Its OOM score would be |
| 211 // adjusted when |focus_process_score_adjust_timer_| is expired. | 211 // adjusted when |focus_process_score_adjust_timer_| is expired. |
| 212 scoped_ptr<FocusedProcess> focused_process_; | 212 std::unique_ptr<FocusedProcess> focused_process_; |
| 213 | 213 |
| 214 // This lock is for |oom_score_map_|. | 214 // This lock is for |oom_score_map_|. |
| 215 base::Lock oom_score_lock_; | 215 base::Lock oom_score_lock_; |
| 216 // Map maintaining the process handle - oom_score mapping. Behind | 216 // Map maintaining the process handle - oom_score mapping. Behind |
| 217 // |oom_score_lock_|. | 217 // |oom_score_lock_|. |
| 218 ProcessScoreMap oom_score_map_; | 218 ProcessScoreMap oom_score_map_; |
| 219 | 219 |
| 220 // Holds a weak pointer to arc::mojom::ProcessInstance. | 220 // Holds a weak pointer to arc::mojom::ProcessInstance. |
| 221 arc::mojom::ProcessInstance* arc_process_instance_; | 221 arc::mojom::ProcessInstance* arc_process_instance_; |
| 222 // Current ProcessInstance version. | 222 // Current ProcessInstance version. |
| 223 int arc_process_instance_version_; | 223 int arc_process_instance_version_; |
| 224 | 224 |
| 225 // Weak pointer factory used for posting tasks to other threads. | 225 // Weak pointer factory used for posting tasks to other threads. |
| 226 base::WeakPtrFactory<TabManagerDelegate> weak_ptr_factory_; | 226 base::WeakPtrFactory<TabManagerDelegate> weak_ptr_factory_; |
| 227 | 227 |
| 228 DISALLOW_COPY_AND_ASSIGN(TabManagerDelegate); | 228 DISALLOW_COPY_AND_ASSIGN(TabManagerDelegate); |
| 229 }; | 229 }; |
| 230 | 230 |
| 231 } // namespace memory | 231 } // namespace memory |
| 232 | 232 |
| 233 #endif // CHROME_BROWSER_MEMORY_TAB_MANAGER_DELEGATE_CHROMEOS_H_ | 233 #endif // CHROME_BROWSER_MEMORY_TAB_MANAGER_DELEGATE_CHROMEOS_H_ |
| OLD | NEW |