| 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 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 } | 817 } |
| 818 } | 818 } |
| 819 } | 819 } |
| 820 | 820 |
| 821 void TaskManagerModel::NotifyFPS(base::ProcessId renderer_id, | 821 void TaskManagerModel::NotifyFPS(base::ProcessId renderer_id, |
| 822 int routing_id, | 822 int routing_id, |
| 823 float fps) { | 823 float fps) { |
| 824 for (ResourceList::iterator it = resources_.begin(); | 824 for (ResourceList::iterator it = resources_.begin(); |
| 825 it != resources_.end(); ++it) { | 825 it != resources_.end(); ++it) { |
| 826 if (base::GetProcId((*it)->GetProcess()) == renderer_id && | 826 if (base::GetProcId((*it)->GetProcess()) == renderer_id && |
| 827 (*it)->GetRoutingId() == routing_id) { | 827 (*it)->GetRoutingID() == routing_id) { |
| 828 (*it)->NotifyFPS(fps); | 828 (*it)->NotifyFPS(fps); |
| 829 } | 829 } |
| 830 } | 830 } |
| 831 } | 831 } |
| 832 | 832 |
| 833 void TaskManagerModel::NotifyV8HeapStats(base::ProcessId renderer_id, | 833 void TaskManagerModel::NotifyV8HeapStats(base::ProcessId renderer_id, |
| 834 size_t v8_memory_allocated, | 834 size_t v8_memory_allocated, |
| 835 size_t v8_memory_used) { | 835 size_t v8_memory_used) { |
| 836 for (ResourceList::iterator it = resources_.begin(); | 836 for (ResourceList::iterator it = resources_.begin(); |
| 837 it != resources_.end(); ++it) { | 837 it != resources_.end(); ++it) { |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1040 base::KillProcess(process, content::RESULT_CODE_KILLED, false); | 1040 base::KillProcess(process, content::RESULT_CODE_KILLED, false); |
| 1041 } | 1041 } |
| 1042 | 1042 |
| 1043 void TaskManager::ActivateProcess(int index) { | 1043 void TaskManager::ActivateProcess(int index) { |
| 1044 // GetResourceTabContents returns a pointer to the relevant tab contents for | 1044 // GetResourceTabContents returns a pointer to the relevant tab contents for |
| 1045 // the resource. If the index doesn't correspond to a Tab (i.e. refers to | 1045 // the resource. If the index doesn't correspond to a Tab (i.e. refers to |
| 1046 // the Browser process or a plugin), GetTabContents will return NULL. | 1046 // the Browser process or a plugin), GetTabContents will return NULL. |
| 1047 TabContentsWrapper* chosen_tab_contents = | 1047 TabContentsWrapper* chosen_tab_contents = |
| 1048 model_->GetResourceTabContents(index); | 1048 model_->GetResourceTabContents(index); |
| 1049 if (chosen_tab_contents) { | 1049 if (chosen_tab_contents) { |
| 1050 chosen_tab_contents->web_contents()->GetRenderViewHost()->delegate()-> | 1050 chosen_tab_contents->web_contents()->GetRenderViewHost()->GetDelegate()-> |
| 1051 Activate(); | 1051 Activate(); |
| 1052 } | 1052 } |
| 1053 } | 1053 } |
| 1054 | 1054 |
| 1055 void TaskManager::AddResource(Resource* resource) { | 1055 void TaskManager::AddResource(Resource* resource) { |
| 1056 model_->AddResource(resource); | 1056 model_->AddResource(resource); |
| 1057 } | 1057 } |
| 1058 | 1058 |
| 1059 void TaskManager::RemoveResource(Resource* resource) { | 1059 void TaskManager::RemoveResource(Resource* resource) { |
| 1060 model_->RemoveResource(resource); | 1060 model_->RemoveResource(resource); |
| (...skipping 100 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 |