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 <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <map> | 10 #include <map> |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 int selected_index = tab_strip_model->active_index(); | 323 int selected_index = tab_strip_model->active_index(); |
324 content::WebContents* contents = | 324 content::WebContents* contents = |
325 tab_strip_model->GetWebContentsAt(selected_index); | 325 tab_strip_model->GetWebContentsAt(selected_index); |
326 if (!contents) | 326 if (!contents) |
327 return; | 327 return; |
328 | 328 |
329 base::ProcessHandle pid = contents->GetRenderProcessHost()->GetHandle(); | 329 base::ProcessHandle pid = contents->GetRenderProcessHost()->GetHandle(); |
330 AdjustFocusedTabScore(pid); | 330 AdjustFocusedTabScore(pid); |
331 } | 331 } |
332 | 332 |
333 // TODO(cylee): Remove this function if Android process OOM score settings | |
334 // is moved back to Android. | |
335 // For example, negotiate non-overlapping OOM score ranges so Chrome and Android | |
336 // can set OOM score for processes in their own world. | |
337 void TabManagerDelegate::OnWindowActivated( | 333 void TabManagerDelegate::OnWindowActivated( |
338 aura::client::ActivationChangeObserver::ActivationReason reason, | 334 aura::client::ActivationChangeObserver::ActivationReason reason, |
339 aura::Window* gained_active, | 335 aura::Window* gained_active, |
340 aura::Window* lost_active) { | 336 aura::Window* lost_active) { |
341 if (IsArcWindow(gained_active)) { | 337 if (IsArcWindow(gained_active)) { |
342 // Currently there is no way to know which app is displayed in the ARC | 338 // Currently there is no way to know which app is displayed in the ARC |
343 // window, so schedule an early adjustment for all processes to reflect | 339 // window, so schedule an early adjustment for all processes to reflect |
344 // the change. | 340 // the change. |
345 // Put a dummy FocusedProcess with nspid = kInvalidArcAppNspid for now to | 341 // Put a dummy FocusedProcess with nspid = kInvalidArcAppNspid for now to |
346 // indicate the focused process is an arc app. | 342 // indicate the focused process is an arc app. |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 } | 749 } |
754 priority += priority_increment; | 750 priority += priority_increment; |
755 } | 751 } |
756 | 752 |
757 if (oom_scores_to_change.size()) | 753 if (oom_scores_to_change.size()) |
758 GetDebugDaemonClient()->SetOomScoreAdj( | 754 GetDebugDaemonClient()->SetOomScoreAdj( |
759 oom_scores_to_change, base::Bind(&OnSetOomScoreAdj)); | 755 oom_scores_to_change, base::Bind(&OnSetOomScoreAdj)); |
760 } | 756 } |
761 | 757 |
762 } // namespace memory | 758 } // namespace memory |
OLD | NEW |