| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_resource_providers.h" | 5 #include "chrome/browser/task_manager/task_manager_resource_providers.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 return; | 739 return; |
| 740 } | 740 } |
| 741 } | 741 } |
| 742 | 742 |
| 743 //////////////////////////////////////////////////////////////////////////////// | 743 //////////////////////////////////////////////////////////////////////////////// |
| 744 // TaskManagerChildProcessResource class | 744 // TaskManagerChildProcessResource class |
| 745 //////////////////////////////////////////////////////////////////////////////// | 745 //////////////////////////////////////////////////////////////////////////////// |
| 746 SkBitmap* TaskManagerChildProcessResource::default_icon_ = NULL; | 746 SkBitmap* TaskManagerChildProcessResource::default_icon_ = NULL; |
| 747 | 747 |
| 748 TaskManagerChildProcessResource::TaskManagerChildProcessResource( | 748 TaskManagerChildProcessResource::TaskManagerChildProcessResource( |
| 749 const ChildProcessInfo& child_proc) | 749 content::ProcessType type, |
| 750 : child_process_(child_proc), | 750 const string16& name, |
| 751 title_(), | 751 base::ProcessHandle handle) |
| 752 : type_(type), |
| 753 name_(name), |
| 754 handle_(handle), |
| 752 network_usage_support_(false) { | 755 network_usage_support_(false) { |
| 753 // We cache the process id because it's not cheap to calculate, and it won't | 756 // We cache the process id because it's not cheap to calculate, and it won't |
| 754 // be available when we get the plugin disconnected notification. | 757 // be available when we get the plugin disconnected notification. |
| 755 pid_ = child_proc.pid(); | 758 pid_ = base::GetProcId(handle); |
| 756 if (!default_icon_) { | 759 if (!default_icon_) { |
| 757 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 760 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 758 default_icon_ = rb.GetBitmapNamed(IDR_PLUGIN); | 761 default_icon_ = rb.GetBitmapNamed(IDR_PLUGIN); |
| 759 // TODO(jabdelmalek): use different icon for web workers. | 762 // TODO(jabdelmalek): use different icon for web workers. |
| 760 } | 763 } |
| 761 } | 764 } |
| 762 | 765 |
| 763 TaskManagerChildProcessResource::~TaskManagerChildProcessResource() { | 766 TaskManagerChildProcessResource::~TaskManagerChildProcessResource() { |
| 764 } | 767 } |
| 765 | 768 |
| 766 // TaskManagerResource methods: | 769 // TaskManagerResource methods: |
| 767 string16 TaskManagerChildProcessResource::GetTitle() const { | 770 string16 TaskManagerChildProcessResource::GetTitle() const { |
| 768 if (title_.empty()) | 771 if (title_.empty()) |
| 769 title_ = GetLocalizedTitle(); | 772 title_ = GetLocalizedTitle(); |
| 770 | 773 |
| 771 return title_; | 774 return title_; |
| 772 } | 775 } |
| 773 | 776 |
| 774 string16 TaskManagerChildProcessResource::GetProfileName() const { | 777 string16 TaskManagerChildProcessResource::GetProfileName() const { |
| 775 return string16(); | 778 return string16(); |
| 776 } | 779 } |
| 777 | 780 |
| 778 SkBitmap TaskManagerChildProcessResource::GetIcon() const { | 781 SkBitmap TaskManagerChildProcessResource::GetIcon() const { |
| 779 return *default_icon_; | 782 return *default_icon_; |
| 780 } | 783 } |
| 781 | 784 |
| 782 base::ProcessHandle TaskManagerChildProcessResource::GetProcess() const { | 785 base::ProcessHandle TaskManagerChildProcessResource::GetProcess() const { |
| 783 return child_process_.handle(); | 786 return handle_; |
| 784 } | 787 } |
| 785 | 788 |
| 786 TaskManager::Resource::Type TaskManagerChildProcessResource::GetType() const { | 789 TaskManager::Resource::Type TaskManagerChildProcessResource::GetType() const { |
| 787 // Translate types to TaskManager::ResourceType, since ChildProcessInfo's type | 790 // Translate types to TaskManager::ResourceType, since ChildProcessInfo's type |
| 788 // is not available for all TaskManager resources. | 791 // is not available for all TaskManager resources. |
| 789 switch (child_process_.type()) { | 792 switch (type_) { |
| 790 case content::PROCESS_TYPE_PLUGIN: | 793 case content::PROCESS_TYPE_PLUGIN: |
| 791 case content::PROCESS_TYPE_PPAPI_PLUGIN: | 794 case content::PROCESS_TYPE_PPAPI_PLUGIN: |
| 792 case content::PROCESS_TYPE_PPAPI_BROKER: | 795 case content::PROCESS_TYPE_PPAPI_BROKER: |
| 793 return TaskManager::Resource::PLUGIN; | 796 return TaskManager::Resource::PLUGIN; |
| 794 case content::PROCESS_TYPE_NACL_LOADER: | 797 case content::PROCESS_TYPE_NACL_LOADER: |
| 795 case content::PROCESS_TYPE_NACL_BROKER: | 798 case content::PROCESS_TYPE_NACL_BROKER: |
| 796 return TaskManager::Resource::NACL; | 799 return TaskManager::Resource::NACL; |
| 797 case content::PROCESS_TYPE_UTILITY: | 800 case content::PROCESS_TYPE_UTILITY: |
| 798 return TaskManager::Resource::UTILITY; | 801 return TaskManager::Resource::UTILITY; |
| 799 case content::PROCESS_TYPE_PROFILE_IMPORT: | 802 case content::PROCESS_TYPE_PROFILE_IMPORT: |
| (...skipping 11 matching lines...) Expand all Loading... |
| 811 | 814 |
| 812 bool TaskManagerChildProcessResource::SupportNetworkUsage() const { | 815 bool TaskManagerChildProcessResource::SupportNetworkUsage() const { |
| 813 return network_usage_support_; | 816 return network_usage_support_; |
| 814 } | 817 } |
| 815 | 818 |
| 816 void TaskManagerChildProcessResource::SetSupportNetworkUsage() { | 819 void TaskManagerChildProcessResource::SetSupportNetworkUsage() { |
| 817 network_usage_support_ = true; | 820 network_usage_support_ = true; |
| 818 } | 821 } |
| 819 | 822 |
| 820 string16 TaskManagerChildProcessResource::GetLocalizedTitle() const { | 823 string16 TaskManagerChildProcessResource::GetLocalizedTitle() const { |
| 821 string16 title = child_process_.name(); | 824 string16 title = name_; |
| 822 if (title.empty()) { | 825 if (title.empty()) { |
| 823 switch (child_process_.type()) { | 826 switch (type_) { |
| 824 case content::PROCESS_TYPE_PLUGIN: | 827 case content::PROCESS_TYPE_PLUGIN: |
| 825 case content::PROCESS_TYPE_PPAPI_PLUGIN: | 828 case content::PROCESS_TYPE_PPAPI_PLUGIN: |
| 826 case content::PROCESS_TYPE_PPAPI_BROKER: | 829 case content::PROCESS_TYPE_PPAPI_BROKER: |
| 827 title = l10n_util::GetStringUTF16(IDS_TASK_MANAGER_UNKNOWN_PLUGIN_NAME); | 830 title = l10n_util::GetStringUTF16(IDS_TASK_MANAGER_UNKNOWN_PLUGIN_NAME); |
| 828 break; | 831 break; |
| 829 default: | 832 default: |
| 830 // Nothing to do for non-plugin processes. | 833 // Nothing to do for non-plugin processes. |
| 831 break; | 834 break; |
| 832 } | 835 } |
| 833 } | 836 } |
| 834 | 837 |
| 835 // Explicitly mark name as LTR if there is no strong RTL character, | 838 // Explicitly mark name as LTR if there is no strong RTL character, |
| 836 // to avoid the wrong concatenation result similar to "!Yahoo Mail: the | 839 // to avoid the wrong concatenation result similar to "!Yahoo Mail: the |
| 837 // best web-based Email: NIGULP", in which "NIGULP" stands for the Hebrew | 840 // best web-based Email: NIGULP", in which "NIGULP" stands for the Hebrew |
| 838 // or Arabic word for "plugin". | 841 // or Arabic word for "plugin". |
| 839 base::i18n::AdjustStringForLocaleDirection(&title); | 842 base::i18n::AdjustStringForLocaleDirection(&title); |
| 840 | 843 |
| 841 switch (child_process_.type()) { | 844 switch (type_) { |
| 842 case content::PROCESS_TYPE_UTILITY: | 845 case content::PROCESS_TYPE_UTILITY: |
| 843 return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_UTILITY_PREFIX); | 846 return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_UTILITY_PREFIX); |
| 844 | 847 |
| 845 case content::PROCESS_TYPE_PROFILE_IMPORT: | 848 case content::PROCESS_TYPE_PROFILE_IMPORT: |
| 846 return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_UTILITY_PREFIX); | 849 return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_UTILITY_PREFIX); |
| 847 | 850 |
| 848 case content::PROCESS_TYPE_GPU: | 851 case content::PROCESS_TYPE_GPU: |
| 849 return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_GPU_PREFIX); | 852 return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_GPU_PREFIX); |
| 850 | 853 |
| 851 case content::PROCESS_TYPE_NACL_BROKER: | 854 case content::PROCESS_TYPE_NACL_BROKER: |
| 852 return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NACL_BROKER_PREFIX); | 855 return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NACL_BROKER_PREFIX); |
| 853 | 856 |
| 854 case content::PROCESS_TYPE_PLUGIN: | 857 case content::PROCESS_TYPE_PLUGIN: |
| 855 case content::PROCESS_TYPE_PPAPI_PLUGIN: | 858 case content::PROCESS_TYPE_PPAPI_PLUGIN: |
| 856 return l10n_util::GetStringFUTF16( | 859 return l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_PLUGIN_PREFIX, title); |
| 857 IDS_TASK_MANAGER_PLUGIN_PREFIX, title, child_process_.version()); | |
| 858 | 860 |
| 859 case content::PROCESS_TYPE_PPAPI_BROKER: | 861 case content::PROCESS_TYPE_PPAPI_BROKER: |
| 860 return l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_PLUGIN_BROKER_PREFIX, | 862 return l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_PLUGIN_BROKER_PREFIX, |
| 861 title, child_process_.version()); | 863 title); |
| 862 | 864 |
| 863 case content::PROCESS_TYPE_NACL_LOADER: | 865 case content::PROCESS_TYPE_NACL_LOADER: |
| 864 return l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_NACL_PREFIX, title); | 866 return l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_NACL_PREFIX, title); |
| 865 | 867 |
| 866 // These types don't need display names or get them from elsewhere. | 868 // These types don't need display names or get them from elsewhere. |
| 867 case content::PROCESS_TYPE_BROWSER: | 869 case content::PROCESS_TYPE_BROWSER: |
| 868 case content::PROCESS_TYPE_RENDERER: | 870 case content::PROCESS_TYPE_RENDERER: |
| 869 case content::PROCESS_TYPE_ZYGOTE: | 871 case content::PROCESS_TYPE_ZYGOTE: |
| 870 case content::PROCESS_TYPE_SANDBOX_HELPER: | 872 case content::PROCESS_TYPE_SANDBOX_HELPER: |
| 871 case content::PROCESS_TYPE_MAX: | 873 case content::PROCESS_TYPE_MAX: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 882 | 884 |
| 883 return title; | 885 return title; |
| 884 } | 886 } |
| 885 | 887 |
| 886 //////////////////////////////////////////////////////////////////////////////// | 888 //////////////////////////////////////////////////////////////////////////////// |
| 887 // TaskManagerChildProcessResourceProvider class | 889 // TaskManagerChildProcessResourceProvider class |
| 888 //////////////////////////////////////////////////////////////////////////////// | 890 //////////////////////////////////////////////////////////////////////////////// |
| 889 | 891 |
| 890 TaskManagerChildProcessResourceProvider:: | 892 TaskManagerChildProcessResourceProvider:: |
| 891 TaskManagerChildProcessResourceProvider(TaskManager* task_manager) | 893 TaskManagerChildProcessResourceProvider(TaskManager* task_manager) |
| 892 : updating_(false), | 894 : task_manager_(task_manager), |
| 893 task_manager_(task_manager) { | 895 updating_(false) { |
| 894 } | 896 } |
| 895 | 897 |
| 896 TaskManagerChildProcessResourceProvider:: | 898 TaskManagerChildProcessResourceProvider:: |
| 897 ~TaskManagerChildProcessResourceProvider() { | 899 ~TaskManagerChildProcessResourceProvider() { |
| 898 } | 900 } |
| 899 | 901 |
| 900 TaskManager::Resource* TaskManagerChildProcessResourceProvider::GetResource( | 902 TaskManager::Resource* TaskManagerChildProcessResourceProvider::GetResource( |
| 901 int origin_pid, | 903 int origin_pid, |
| 902 int render_process_host_id, | 904 int render_process_host_id, |
| 903 int routing_id) { | 905 int routing_id) { |
| 904 std::map<int, TaskManagerChildProcessResource*>::iterator iter = | 906 PidResourceMap::iterator iter = pid_to_resources_.find(origin_pid); |
| 905 pid_to_resources_.find(origin_pid); | |
| 906 if (iter != pid_to_resources_.end()) | 907 if (iter != pid_to_resources_.end()) |
| 907 return iter->second; | 908 return iter->second; |
| 908 else | 909 else |
| 909 return NULL; | 910 return NULL; |
| 910 } | 911 } |
| 911 | 912 |
| 912 void TaskManagerChildProcessResourceProvider::StartUpdating() { | 913 void TaskManagerChildProcessResourceProvider::StartUpdating() { |
| 913 DCHECK(!updating_); | 914 DCHECK(!updating_); |
| 914 updating_ = true; | 915 updating_ = true; |
| 915 | 916 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 938 registrar_.Remove( | 939 registrar_.Remove( |
| 939 this, | 940 this, |
| 940 content::NOTIFICATION_CHILD_PROCESS_HOST_DISCONNECTED, | 941 content::NOTIFICATION_CHILD_PROCESS_HOST_DISCONNECTED, |
| 941 content::NotificationService::AllBrowserContextsAndSources()); | 942 content::NotificationService::AllBrowserContextsAndSources()); |
| 942 | 943 |
| 943 // Delete all the resources. | 944 // Delete all the resources. |
| 944 STLDeleteContainerPairSecondPointers(resources_.begin(), resources_.end()); | 945 STLDeleteContainerPairSecondPointers(resources_.begin(), resources_.end()); |
| 945 | 946 |
| 946 resources_.clear(); | 947 resources_.clear(); |
| 947 pid_to_resources_.clear(); | 948 pid_to_resources_.clear(); |
| 948 existing_child_process_info_.clear(); | |
| 949 } | 949 } |
| 950 | 950 |
| 951 void TaskManagerChildProcessResourceProvider::Observe( | 951 void TaskManagerChildProcessResourceProvider::Observe( |
| 952 int type, | 952 int type, |
| 953 const content::NotificationSource& source, | 953 const content::NotificationSource& source, |
| 954 const content::NotificationDetails& details) { | 954 const content::NotificationDetails& details) { |
| 955 content::Details<ChildProcessInfo> child_details(details); |
| 956 ChildProcessData data; |
| 957 data.type = child_details->type(); |
| 958 data.name = child_details->name(); |
| 959 data.handle = child_details->handle(); |
| 955 switch (type) { | 960 switch (type) { |
| 956 case content::NOTIFICATION_CHILD_PROCESS_HOST_CONNECTED: | 961 case content::NOTIFICATION_CHILD_PROCESS_HOST_CONNECTED: |
| 957 Add(*content::Details<ChildProcessInfo>(details).ptr()); | 962 Add(data); |
| 958 break; | 963 break; |
| 959 case content::NOTIFICATION_CHILD_PROCESS_HOST_DISCONNECTED: | 964 case content::NOTIFICATION_CHILD_PROCESS_HOST_DISCONNECTED: |
| 960 Remove(*content::Details<ChildProcessInfo>(details).ptr()); | 965 Remove(data); |
| 961 break; | 966 break; |
| 962 default: | 967 default: |
| 963 NOTREACHED() << "Unexpected notification."; | 968 NOTREACHED() << "Unexpected notification."; |
| 964 return; | 969 return; |
| 965 } | 970 } |
| 966 } | 971 } |
| 967 | 972 |
| 968 void TaskManagerChildProcessResourceProvider::Add( | 973 void TaskManagerChildProcessResourceProvider::Add( |
| 969 const ChildProcessInfo& child_process_info) { | 974 const ChildProcessData& child_process_data) { |
| 970 if (!updating_) | 975 if (!updating_) |
| 971 return; | 976 return; |
| 972 // Workers are handled by TaskManagerWorkerResourceProvider. | 977 // Workers are handled by TaskManagerWorkerResourceProvider. |
| 973 if (child_process_info.type() == content::PROCESS_TYPE_WORKER) | 978 if (child_process_data.type == content::PROCESS_TYPE_WORKER) |
| 974 return; | 979 return; |
| 975 std::map<ChildProcessInfo, TaskManagerChildProcessResource*>:: | 980 if (resources_.count(child_process_data.handle)) { |
| 976 const_iterator iter = resources_.find(child_process_info); | |
| 977 if (iter != resources_.end()) { | |
| 978 // The case may happen that we have added a child_process_info as part of | 981 // The case may happen that we have added a child_process_info as part of |
| 979 // the iteration performed during StartUpdating() call but the notification | 982 // the iteration performed during StartUpdating() call but the notification |
| 980 // that it has connected was not fired yet. So when the notification | 983 // that it has connected was not fired yet. So when the notification |
| 981 // happens, we already know about this plugin and just ignore it. | 984 // happens, we already know about this plugin and just ignore it. |
| 982 return; | 985 return; |
| 983 } | 986 } |
| 984 AddToTaskManager(child_process_info); | 987 AddToTaskManager(child_process_data); |
| 985 } | 988 } |
| 986 | 989 |
| 987 void TaskManagerChildProcessResourceProvider::Remove( | 990 void TaskManagerChildProcessResourceProvider::Remove( |
| 988 const ChildProcessInfo& child_process_info) { | 991 const ChildProcessData& child_process_data) { |
| 989 if (!updating_) | 992 if (!updating_) |
| 990 return; | 993 return; |
| 991 if (child_process_info.type() == content::PROCESS_TYPE_WORKER) | 994 if (child_process_data.type == content::PROCESS_TYPE_WORKER) |
| 992 return; | 995 return; |
| 993 std::map<ChildProcessInfo, TaskManagerChildProcessResource*> | 996 ChildProcessMap::iterator iter = resources_.find(child_process_data.handle); |
| 994 ::iterator iter = resources_.find(child_process_info); | |
| 995 if (iter == resources_.end()) { | 997 if (iter == resources_.end()) { |
| 996 // ChildProcessInfo disconnection notifications are asynchronous, so we | 998 // ChildProcessInfo disconnection notifications are asynchronous, so we |
| 997 // might be notified for a plugin we don't know anything about (if it was | 999 // might be notified for a plugin we don't know anything about (if it was |
| 998 // closed before the task manager was shown and destroyed after that). | 1000 // closed before the task manager was shown and destroyed after that). |
| 999 return; | 1001 return; |
| 1000 } | 1002 } |
| 1001 // Remove the resource from the Task Manager. | 1003 // Remove the resource from the Task Manager. |
| 1002 TaskManagerChildProcessResource* resource = iter->second; | 1004 TaskManagerChildProcessResource* resource = iter->second; |
| 1003 task_manager_->RemoveResource(resource); | 1005 task_manager_->RemoveResource(resource); |
| 1004 // Remove it from the provider. | 1006 // Remove it from the provider. |
| 1005 resources_.erase(iter); | 1007 resources_.erase(iter); |
| 1006 // Remove it from our pid map. | 1008 // Remove it from our pid map. |
| 1007 std::map<int, TaskManagerChildProcessResource*>::iterator pid_iter = | 1009 PidResourceMap::iterator pid_iter = |
| 1008 pid_to_resources_.find(resource->process_id()); | 1010 pid_to_resources_.find(resource->process_id()); |
| 1009 DCHECK(pid_iter != pid_to_resources_.end()); | 1011 DCHECK(pid_iter != pid_to_resources_.end()); |
| 1010 if (pid_iter != pid_to_resources_.end()) | 1012 if (pid_iter != pid_to_resources_.end()) |
| 1011 pid_to_resources_.erase(pid_iter); | 1013 pid_to_resources_.erase(pid_iter); |
| 1012 | 1014 |
| 1013 // Finally, delete the resource. | 1015 // Finally, delete the resource. |
| 1014 delete resource; | 1016 delete resource; |
| 1015 } | 1017 } |
| 1016 | 1018 |
| 1017 void TaskManagerChildProcessResourceProvider::AddToTaskManager( | 1019 void TaskManagerChildProcessResourceProvider::AddToTaskManager( |
| 1018 const ChildProcessInfo& child_process_info) { | 1020 const ChildProcessData& child_process_data) { |
| 1019 TaskManagerChildProcessResource* resource = | 1021 TaskManagerChildProcessResource* resource = |
| 1020 new TaskManagerChildProcessResource(child_process_info); | 1022 new TaskManagerChildProcessResource( |
| 1021 resources_[child_process_info] = resource; | 1023 child_process_data.type, |
| 1024 child_process_data.name, |
| 1025 child_process_data.handle); |
| 1026 resources_[child_process_data.handle] = resource; |
| 1022 pid_to_resources_[resource->process_id()] = resource; | 1027 pid_to_resources_[resource->process_id()] = resource; |
| 1023 task_manager_->AddResource(resource); | 1028 task_manager_->AddResource(resource); |
| 1024 } | 1029 } |
| 1025 | 1030 |
| 1026 // The ChildProcessInfo::Iterator has to be used from the IO thread. | 1031 // The ChildProcessInfo::Iterator has to be used from the IO thread. |
| 1027 void TaskManagerChildProcessResourceProvider::RetrieveChildProcessInfo() { | 1032 void TaskManagerChildProcessResourceProvider::RetrieveChildProcessInfo() { |
| 1033 std::vector<ChildProcessData> child_processes; |
| 1028 for (BrowserChildProcessHost::Iterator iter; !iter.Done(); ++iter) { | 1034 for (BrowserChildProcessHost::Iterator iter; !iter.Done(); ++iter) { |
| 1029 // Only add processes which are already started, since we need their handle. | 1035 // Only add processes which are already started, since we need their handle. |
| 1030 if ((*iter)->handle() != base::kNullProcessHandle) | 1036 if ((*iter)->handle() == base::kNullProcessHandle) |
| 1031 existing_child_process_info_.push_back(**iter); | 1037 continue; |
| 1038 ChildProcessData data; |
| 1039 data.type = (*iter)->type(); |
| 1040 data.name = (*iter)->name(); |
| 1041 data.handle = (*iter)->handle(); |
| 1042 child_processes.push_back(data); |
| 1032 } | 1043 } |
| 1033 // Now notify the UI thread that we have retrieved information about child | 1044 // Now notify the UI thread that we have retrieved information about child |
| 1034 // processes. | 1045 // processes. |
| 1035 BrowserThread::PostTask( | 1046 BrowserThread::PostTask( |
| 1036 BrowserThread::UI, FROM_HERE, | 1047 BrowserThread::UI, FROM_HERE, |
| 1037 base::Bind( | 1048 base::Bind( |
| 1038 &TaskManagerChildProcessResourceProvider::ChildProcessInfoRetreived, | 1049 &TaskManagerChildProcessResourceProvider::ChildProcessInfoRetreived, |
| 1039 this)); | 1050 this, child_processes)); |
| 1040 } | 1051 } |
| 1041 | 1052 |
| 1042 // This is called on the UI thread. | 1053 // This is called on the UI thread. |
| 1043 void TaskManagerChildProcessResourceProvider::ChildProcessInfoRetreived() { | 1054 void TaskManagerChildProcessResourceProvider::ChildProcessInfoRetreived( |
| 1044 std::vector<ChildProcessInfo>::const_iterator iter; | 1055 const std::vector<ChildProcessData>& child_processes) { |
| 1045 for (iter = existing_child_process_info_.begin(); | 1056 for (size_t i = 0; i < child_processes.size(); ++i) |
| 1046 iter != existing_child_process_info_.end(); ++iter) { | 1057 Add(child_processes[i]); |
| 1047 Add(*iter); | |
| 1048 } | |
| 1049 existing_child_process_info_.clear(); | |
| 1050 } | 1058 } |
| 1051 | 1059 |
| 1052 //////////////////////////////////////////////////////////////////////////////// | 1060 //////////////////////////////////////////////////////////////////////////////// |
| 1053 // TaskManagerExtensionProcessResource class | 1061 // TaskManagerExtensionProcessResource class |
| 1054 //////////////////////////////////////////////////////////////////////////////// | 1062 //////////////////////////////////////////////////////////////////////////////// |
| 1055 | 1063 |
| 1056 SkBitmap* TaskManagerExtensionProcessResource::default_icon_ = NULL; | 1064 SkBitmap* TaskManagerExtensionProcessResource::default_icon_ = NULL; |
| 1057 | 1065 |
| 1058 TaskManagerExtensionProcessResource::TaskManagerExtensionProcessResource( | 1066 TaskManagerExtensionProcessResource::TaskManagerExtensionProcessResource( |
| 1059 ExtensionHost* extension_host) | 1067 ExtensionHost* extension_host) |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1392 | 1400 |
| 1393 return &resource_; | 1401 return &resource_; |
| 1394 } | 1402 } |
| 1395 | 1403 |
| 1396 void TaskManagerBrowserProcessResourceProvider::StartUpdating() { | 1404 void TaskManagerBrowserProcessResourceProvider::StartUpdating() { |
| 1397 task_manager_->AddResource(&resource_); | 1405 task_manager_->AddResource(&resource_); |
| 1398 } | 1406 } |
| 1399 | 1407 |
| 1400 void TaskManagerBrowserProcessResourceProvider::StopUpdating() { | 1408 void TaskManagerBrowserProcessResourceProvider::StopUpdating() { |
| 1401 } | 1409 } |
| OLD | NEW |