| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/task_manager.h" | 5 #include "chrome/browser/task_manager/task_manager.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/i18n/number_formatting.h" | 9 #include "base/i18n/number_formatting.h" |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| (...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 } | 818 } |
| 819 } | 819 } |
| 820 } | 820 } |
| 821 | 821 |
| 822 void TaskManagerModel::NotifyFPS(base::ProcessId renderer_id, | 822 void TaskManagerModel::NotifyFPS(base::ProcessId renderer_id, |
| 823 int routing_id, | 823 int routing_id, |
| 824 float fps) { | 824 float fps) { |
| 825 for (ResourceList::iterator it = resources_.begin(); | 825 for (ResourceList::iterator it = resources_.begin(); |
| 826 it != resources_.end(); ++it) { | 826 it != resources_.end(); ++it) { |
| 827 if (base::GetProcId((*it)->GetProcess()) == renderer_id && | 827 if (base::GetProcId((*it)->GetProcess()) == renderer_id && |
| 828 (*it)->GetRoutingId() == routing_id) { | 828 (*it)->GetRoutingID() == routing_id) { |
| 829 (*it)->NotifyFPS(fps); | 829 (*it)->NotifyFPS(fps); |
| 830 } | 830 } |
| 831 } | 831 } |
| 832 } | 832 } |
| 833 | 833 |
| 834 void TaskManagerModel::NotifyV8HeapStats(base::ProcessId renderer_id, | 834 void TaskManagerModel::NotifyV8HeapStats(base::ProcessId renderer_id, |
| 835 size_t v8_memory_allocated, | 835 size_t v8_memory_allocated, |
| 836 size_t v8_memory_used) { | 836 size_t v8_memory_used) { |
| 837 for (ResourceList::iterator it = resources_.begin(); | 837 for (ResourceList::iterator it = resources_.begin(); |
| 838 it != resources_.end(); ++it) { | 838 it != resources_.end(); ++it) { |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1041 base::KillProcess(process, content::RESULT_CODE_KILLED, false); | 1041 base::KillProcess(process, content::RESULT_CODE_KILLED, false); |
| 1042 } | 1042 } |
| 1043 | 1043 |
| 1044 void TaskManager::ActivateProcess(int index) { | 1044 void TaskManager::ActivateProcess(int index) { |
| 1045 // GetResourceTabContents returns a pointer to the relevant tab contents for | 1045 // GetResourceTabContents returns a pointer to the relevant tab contents for |
| 1046 // the resource. If the index doesn't correspond to a Tab (i.e. refers to | 1046 // the resource. If the index doesn't correspond to a Tab (i.e. refers to |
| 1047 // the Browser process or a plugin), GetTabContents will return NULL. | 1047 // the Browser process or a plugin), GetTabContents will return NULL. |
| 1048 TabContentsWrapper* chosen_tab_contents = | 1048 TabContentsWrapper* chosen_tab_contents = |
| 1049 model_->GetResourceTabContents(index); | 1049 model_->GetResourceTabContents(index); |
| 1050 if (chosen_tab_contents) { | 1050 if (chosen_tab_contents) { |
| 1051 chosen_tab_contents->web_contents()->GetRenderViewHost()->delegate()-> | 1051 chosen_tab_contents->web_contents()->GetRenderViewHost()->GetDelegate()-> |
| 1052 Activate(); | 1052 Activate(); |
| 1053 } | 1053 } |
| 1054 } | 1054 } |
| 1055 | 1055 |
| 1056 void TaskManager::AddResource(Resource* resource) { | 1056 void TaskManager::AddResource(Resource* resource) { |
| 1057 model_->AddResource(resource); | 1057 model_->AddResource(resource); |
| 1058 } | 1058 } |
| 1059 | 1059 |
| 1060 void TaskManager::RemoveResource(Resource* resource) { | 1060 void TaskManager::RemoveResource(Resource* resource) { |
| 1061 model_->RemoveResource(resource); | 1061 model_->RemoveResource(resource); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1161 // Count the number of extensions with background pages (including | 1161 // Count the number of extensions with background pages (including |
| 1162 // incognito). | 1162 // incognito). |
| 1163 count += CountExtensionBackgroundPagesForProfile(profile); | 1163 count += CountExtensionBackgroundPagesForProfile(profile); |
| 1164 if (profile->HasOffTheRecordProfile()) { | 1164 if (profile->HasOffTheRecordProfile()) { |
| 1165 count += CountExtensionBackgroundPagesForProfile( | 1165 count += CountExtensionBackgroundPagesForProfile( |
| 1166 profile->GetOffTheRecordProfile()); | 1166 profile->GetOffTheRecordProfile()); |
| 1167 } | 1167 } |
| 1168 } | 1168 } |
| 1169 return count; | 1169 return count; |
| 1170 } | 1170 } |
| OLD | NEW |