Chromium Code Reviews| 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/ui/webui/about_ui.h" | 5 #include "chrome/browser/ui/webui/about_ui.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 852 | 852 |
| 853 void AboutMemoryHandler::OnDetailsAvailable() { | 853 void AboutMemoryHandler::OnDetailsAvailable() { |
| 854 // the root of the JSON hierarchy for about:memory jstemplate | 854 // the root of the JSON hierarchy for about:memory jstemplate |
| 855 DictionaryValue root; | 855 DictionaryValue root; |
| 856 ListValue* browsers = new ListValue(); | 856 ListValue* browsers = new ListValue(); |
| 857 root.Set("browsers", browsers); | 857 root.Set("browsers", browsers); |
| 858 | 858 |
| 859 const std::vector<ProcessData>& browser_processes = processes(); | 859 const std::vector<ProcessData>& browser_processes = processes(); |
| 860 | 860 |
| 861 // Aggregate per-process data into browser summary data. | 861 // Aggregate per-process data into browser summary data. |
| 862 std::wstring log_string; | 862 string16 log_string; |
| 863 for (size_t index = 0; index < browser_processes.size(); index++) { | 863 for (size_t index = 0; index < browser_processes.size(); index++) { |
| 864 if (browser_processes[index].processes.empty()) | 864 if (browser_processes[index].processes.empty()) |
| 865 continue; | 865 continue; |
| 866 | 866 |
| 867 // Sum the information for the processes within this browser. | 867 // Sum the information for the processes within this browser. |
| 868 ProcessMemoryInformation aggregate; | 868 ProcessMemoryInformation aggregate; |
| 869 ProcessMemoryInformationList::const_iterator iterator; | 869 ProcessMemoryInformationList::const_iterator iterator; |
| 870 iterator = browser_processes[index].processes.begin(); | 870 iterator = browser_processes[index].processes.begin(); |
| 871 aggregate.pid = iterator->pid; | 871 aggregate.pid = iterator->pid; |
| 872 aggregate.version = iterator->version; | 872 aggregate.version = iterator->version; |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 883 } | 883 } |
| 884 ++iterator; | 884 ++iterator; |
| 885 } | 885 } |
| 886 DictionaryValue* browser_data = new DictionaryValue(); | 886 DictionaryValue* browser_data = new DictionaryValue(); |
| 887 browsers->Append(browser_data); | 887 browsers->Append(browser_data); |
| 888 browser_data->SetString("name", browser_processes[index].name); | 888 browser_data->SetString("name", browser_processes[index].name); |
| 889 | 889 |
| 890 BindProcessMetrics(browser_data, &aggregate); | 890 BindProcessMetrics(browser_data, &aggregate); |
| 891 | 891 |
| 892 // We log memory info as we record it. | 892 // We log memory info as we record it. |
| 893 if (log_string.length() > 0) | 893 if (log_string.length() > 0) |
|
sky
2012/12/06 21:05:01
!empty
| |
| 894 log_string.append(L", "); | 894 log_string.append(ASCIIToUTF16(", ")); |
| 895 log_string.append(UTF16ToWide(browser_processes[index].name)); | 895 log_string.append(browser_processes[index].name); |
|
sky
2012/12/06 21:05:01
This feels like more code than it needs to be. How
| |
| 896 log_string.append(L", "); | 896 log_string.append(ASCIIToUTF16(", ")); |
| 897 log_string.append(UTF8ToWide( | 897 log_string.append(base::Int64ToString16(aggregate.working_set.priv)); |
| 898 base::Int64ToString(aggregate.working_set.priv))); | 898 log_string.append(ASCIIToUTF16(", ")); |
| 899 log_string.append(L", "); | 899 log_string.append(base::Int64ToString16(aggregate.working_set.shared)); |
| 900 log_string.append(UTF8ToWide( | 900 log_string.append(ASCIIToUTF16(", ")); |
| 901 base::Int64ToString(aggregate.working_set.shared))); | 901 log_string.append(base::Int64ToString16(aggregate.working_set.shareable)); |
| 902 log_string.append(L", "); | |
| 903 log_string.append(UTF8ToWide( | |
| 904 base::Int64ToString(aggregate.working_set.shareable))); | |
| 905 } | 902 } |
| 906 if (log_string.length() > 0) | 903 if (log_string.length() > 0) |
|
sky
2012/12/06 21:05:01
!empty
exxi
2012/12/06 22:59:15
Done.
| |
| 907 VLOG(1) << "memory: " << log_string; | 904 VLOG(1) << "memory: " << log_string; |
| 908 | 905 |
| 909 // Set the browser & renderer detailed process data. | 906 // Set the browser & renderer detailed process data. |
| 910 DictionaryValue* browser_data = new DictionaryValue(); | 907 DictionaryValue* browser_data = new DictionaryValue(); |
| 911 root.Set("browzr_data", browser_data); | 908 root.Set("browzr_data", browser_data); |
| 912 ListValue* child_data = new ListValue(); | 909 ListValue* child_data = new ListValue(); |
| 913 root.Set("child_data", child_data); | 910 root.Set("child_data", child_data); |
| 914 | 911 |
| 915 ProcessData process = browser_processes[0]; // Chrome is the first browser. | 912 ProcessData process = browser_processes[0]; // Chrome is the first browser. |
| 916 root.SetString("current_browser_name", process.name); | 913 root.SetString("current_browser_name", process.name); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1029 ThemeSource* theme = new ThemeSource(profile); | 1026 ThemeSource* theme = new ThemeSource(profile); |
| 1030 ChromeURLDataManager::AddDataSource(profile, theme); | 1027 ChromeURLDataManager::AddDataSource(profile, theme); |
| 1031 #endif | 1028 #endif |
| 1032 | 1029 |
| 1033 ChromeURLDataManager::DataSource* source = | 1030 ChromeURLDataManager::DataSource* source = |
| 1034 new AboutUIHTMLSource(name, profile); | 1031 new AboutUIHTMLSource(name, profile); |
| 1035 if (source) { | 1032 if (source) { |
| 1036 ChromeURLDataManager::AddDataSource(profile, source); | 1033 ChromeURLDataManager::AddDataSource(profile, source); |
| 1037 } | 1034 } |
| 1038 } | 1035 } |
| OLD | NEW |