| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/task_manager.h" | 5 #include "chrome/browser/task_manager.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/i18n/number_formatting.h" | 10 #include "base/i18n/number_formatting.h" |
| (...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 // killing a process that manages several pages. | 888 // killing a process that manages several pages. |
| 889 return index < model_->ResourceCount() && | 889 return index < model_->ResourceCount() && |
| 890 model_->GetResourceProcessHandle(index) == | 890 model_->GetResourceProcessHandle(index) == |
| 891 base::GetCurrentProcessHandle(); | 891 base::GetCurrentProcessHandle(); |
| 892 } | 892 } |
| 893 | 893 |
| 894 void TaskManager::KillProcess(int index) { | 894 void TaskManager::KillProcess(int index) { |
| 895 base::ProcessHandle process = model_->GetResourceProcessHandle(index); | 895 base::ProcessHandle process = model_->GetResourceProcessHandle(index); |
| 896 DCHECK(process); | 896 DCHECK(process); |
| 897 if (process != base::GetCurrentProcessHandle()) | 897 if (process != base::GetCurrentProcessHandle()) |
| 898 base::KillProcess(process, base::PROCESS_END_KILLED_BY_USER, false); | 898 base::KillProcess(process, base::PROCESS_END_PROCESS_WAS_KILLED, false); |
| 899 } | 899 } |
| 900 | 900 |
| 901 void TaskManager::ActivateProcess(int index) { | 901 void TaskManager::ActivateProcess(int index) { |
| 902 // GetResourceTabContents returns a pointer to the relevant tab contents for | 902 // GetResourceTabContents returns a pointer to the relevant tab contents for |
| 903 // the resource. If the index doesn't correspond to a Tab (i.e. refers to | 903 // the resource. If the index doesn't correspond to a Tab (i.e. refers to |
| 904 // the Browser process or a plugin), GetTabContents will return NULL. | 904 // the Browser process or a plugin), GetTabContents will return NULL. |
| 905 TabContents* chosen_tab_contents = model_->GetResourceTabContents(index); | 905 TabContents* chosen_tab_contents = model_->GetResourceTabContents(index); |
| 906 if (chosen_tab_contents) | 906 if (chosen_tab_contents) |
| 907 chosen_tab_contents->Activate(); | 907 chosen_tab_contents->Activate(); |
| 908 } | 908 } |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 972 MetricsMap::const_iterator iter = metrics_map_.find(handle); | 972 MetricsMap::const_iterator iter = metrics_map_.find(handle); |
| 973 if (iter == metrics_map_.end()) | 973 if (iter == metrics_map_.end()) |
| 974 return false; | 974 return false; |
| 975 | 975 |
| 976 if (!iter->second->GetMemoryBytes(&usage->first, &usage->second)) | 976 if (!iter->second->GetMemoryBytes(&usage->first, &usage->second)) |
| 977 return false; | 977 return false; |
| 978 | 978 |
| 979 memory_usage_map_.insert(std::make_pair(handle, *usage)); | 979 memory_usage_map_.insert(std::make_pair(handle, *usage)); |
| 980 return true; | 980 return true; |
| 981 } | 981 } |
| OLD | NEW |