Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Side by Side Diff: chrome/browser/ui/webui/about_ui.cc

Issue 11419316: webui: Replace wstring with string16 for one variable. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 853 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 864
865 void AboutMemoryHandler::OnDetailsAvailable() { 865 void AboutMemoryHandler::OnDetailsAvailable() {
866 // the root of the JSON hierarchy for about:memory jstemplate 866 // the root of the JSON hierarchy for about:memory jstemplate
867 DictionaryValue root; 867 DictionaryValue root;
868 ListValue* browsers = new ListValue(); 868 ListValue* browsers = new ListValue();
869 root.Set("browsers", browsers); 869 root.Set("browsers", browsers);
870 870
871 const std::vector<ProcessData>& browser_processes = processes(); 871 const std::vector<ProcessData>& browser_processes = processes();
872 872
873 // Aggregate per-process data into browser summary data. 873 // Aggregate per-process data into browser summary data.
874 std::wstring log_string; 874 string16 log_string;
875 for (size_t index = 0; index < browser_processes.size(); index++) { 875 for (size_t index = 0; index < browser_processes.size(); index++) {
876 if (browser_processes[index].processes.empty()) 876 if (browser_processes[index].processes.empty())
877 continue; 877 continue;
878 878
879 // Sum the information for the processes within this browser. 879 // Sum the information for the processes within this browser.
880 ProcessMemoryInformation aggregate; 880 ProcessMemoryInformation aggregate;
881 ProcessMemoryInformationList::const_iterator iterator; 881 ProcessMemoryInformationList::const_iterator iterator;
882 iterator = browser_processes[index].processes.begin(); 882 iterator = browser_processes[index].processes.begin();
883 aggregate.pid = iterator->pid; 883 aggregate.pid = iterator->pid;
884 aggregate.version = iterator->version; 884 aggregate.version = iterator->version;
(...skipping 10 matching lines...) Expand all
895 } 895 }
896 ++iterator; 896 ++iterator;
897 } 897 }
898 DictionaryValue* browser_data = new DictionaryValue(); 898 DictionaryValue* browser_data = new DictionaryValue();
899 browsers->Append(browser_data); 899 browsers->Append(browser_data);
900 browser_data->SetString("name", browser_processes[index].name); 900 browser_data->SetString("name", browser_processes[index].name);
901 901
902 BindProcessMetrics(browser_data, &aggregate); 902 BindProcessMetrics(browser_data, &aggregate);
903 903
904 // We log memory info as we record it. 904 // We log memory info as we record it.
905 if (log_string.length() > 0) 905 if (!log_string.empty())
906 log_string.append(L", "); 906 log_string += ASCIIToUTF16(", ");
907 log_string.append(UTF16ToWide(browser_processes[index].name)); 907 log_string += browser_processes[index].name + ASCIIToUTF16(", ") +
908 log_string.append(L", "); 908 base::Int64ToString16(aggregate.working_set.priv) +
909 log_string.append(UTF8ToWide( 909 ASCIIToUTF16(", ") +
910 base::Int64ToString(aggregate.working_set.priv))); 910 base::Int64ToString16(aggregate.working_set.shared) +
911 log_string.append(L", "); 911 ASCIIToUTF16(", ") +
912 log_string.append(UTF8ToWide( 912 base::Int64ToString16(aggregate.working_set.shareable);
913 base::Int64ToString(aggregate.working_set.shared)));
914 log_string.append(L", ");
915 log_string.append(UTF8ToWide(
916 base::Int64ToString(aggregate.working_set.shareable)));
917 } 913 }
918 if (log_string.length() > 0) 914 if (!log_string.empty())
919 VLOG(1) << "memory: " << log_string; 915 VLOG(1) << "memory: " << log_string;
920 916
921 // Set the browser & renderer detailed process data. 917 // Set the browser & renderer detailed process data.
922 DictionaryValue* browser_data = new DictionaryValue(); 918 DictionaryValue* browser_data = new DictionaryValue();
923 root.Set("browzr_data", browser_data); 919 root.Set("browzr_data", browser_data);
924 ListValue* child_data = new ListValue(); 920 ListValue* child_data = new ListValue();
925 root.Set("child_data", child_data); 921 root.Set("child_data", child_data);
926 922
927 ProcessData process = browser_processes[0]; // Chrome is the first browser. 923 ProcessData process = browser_processes[0]; // Chrome is the first browser.
928 root.SetString("current_browser_name", process.name); 924 root.SetString("current_browser_name", process.name);
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1041 ThemeSource* theme = new ThemeSource(profile); 1037 ThemeSource* theme = new ThemeSource(profile);
1042 ChromeURLDataManager::AddDataSource(profile, theme); 1038 ChromeURLDataManager::AddDataSource(profile, theme);
1043 #endif 1039 #endif
1044 1040
1045 ChromeURLDataManager::DataSource* source = 1041 ChromeURLDataManager::DataSource* source =
1046 new AboutUIHTMLSource(name, profile); 1042 new AboutUIHTMLSource(name, profile);
1047 if (source) { 1043 if (source) {
1048 ChromeURLDataManager::AddDataSource(profile, source); 1044 ChromeURLDataManager::AddDataSource(profile, source);
1049 } 1045 }
1050 } 1046 }
OLDNEW
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698