| 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 <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 refresh, | 566 refresh, |
| 567 request_id)); | 567 request_id)); |
| 568 } | 568 } |
| 569 | 569 |
| 570 std::string AboutDiscardsRun() { | 570 std::string AboutDiscardsRun() { |
| 571 std::string output; | 571 std::string output; |
| 572 AppendHeader(&output, 0, "About discards"); | 572 AppendHeader(&output, 0, "About discards"); |
| 573 output.append(StringPrintf("<meta http-equiv=\"refresh\" content=\"2;%s\">", | 573 output.append(StringPrintf("<meta http-equiv=\"refresh\" content=\"2;%s\">", |
| 574 chrome::kChromeUIDiscardsURL)); | 574 chrome::kChromeUIDiscardsURL)); |
| 575 output.append(WrapWithTag("p", "Discarding a tab...")); | 575 output.append(WrapWithTag("p", "Discarding a tab...")); |
| 576 g_browser_process->oom_priority_manager()->DiscardTab(); | 576 g_browser_process->oom_priority_manager()->LogMemoryAndDiscardTab(); |
| 577 AppendFooter(&output); | 577 AppendFooter(&output); |
| 578 return output; | 578 return output; |
| 579 } | 579 } |
| 580 | 580 |
| 581 std::string AboutDiscards(const std::string& path) { | 581 std::string AboutDiscards(const std::string& path) { |
| 582 std::string output; | 582 std::string output; |
| 583 const char kRunCommand[] = "run"; | 583 const char kRunCommand[] = "run"; |
| 584 if (path == kRunCommand) | 584 if (path == kRunCommand) |
| 585 return AboutDiscardsRun(); | 585 return AboutDiscardsRun(); |
| 586 AppendHeader(&output, 0, "About discards"); | 586 AppendHeader(&output, 0, "About discards"); |
| (...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1282 child_label.append(" (diagnostics)"); | 1282 child_label.append(" (diagnostics)"); |
| 1283 child->SetString("child_name", child_label); | 1283 child->SetString("child_name", child_label); |
| 1284 ListValue* titles = new ListValue(); | 1284 ListValue* titles = new ListValue(); |
| 1285 child->Set("titles", titles); | 1285 child->Set("titles", titles); |
| 1286 for (size_t i = 0; i < info->titles.size(); ++i) | 1286 for (size_t i = 0; i < info->titles.size(); ++i) |
| 1287 titles->Append(new StringValue(info->titles[i])); | 1287 titles->Append(new StringValue(info->titles[i])); |
| 1288 } | 1288 } |
| 1289 | 1289 |
| 1290 | 1290 |
| 1291 void AboutMemoryHandler::OnDetailsAvailable() { | 1291 void AboutMemoryHandler::OnDetailsAvailable() { |
| 1292 // TODO(jamescook): Do we want to update UMA stats every time the user opens |
| 1293 // an about: page, or only do it periodically? |
| 1294 UpdateHistograms(); |
| 1295 |
| 1292 // the root of the JSON hierarchy for about:memory jstemplate | 1296 // the root of the JSON hierarchy for about:memory jstemplate |
| 1293 DictionaryValue root; | 1297 DictionaryValue root; |
| 1294 ListValue* browsers = new ListValue(); | 1298 ListValue* browsers = new ListValue(); |
| 1295 root.Set("browsers", browsers); | 1299 root.Set("browsers", browsers); |
| 1296 | 1300 |
| 1297 const std::vector<ProcessData>& browser_processes = processes(); | 1301 const std::vector<ProcessData>& browser_processes = processes(); |
| 1298 | 1302 |
| 1299 // Aggregate per-process data into browser summary data. | 1303 // Aggregate per-process data into browser summary data. |
| 1300 std::wstring log_string; | 1304 std::wstring log_string; |
| 1301 for (size_t index = 0; index < browser_processes.size(); index++) { | 1305 for (size_t index = 0; index < browser_processes.size(); index++) { |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1506 } | 1510 } |
| 1507 | 1511 |
| 1508 AboutUI::AboutUI(content::WebUI* web_ui, const std::string& name) | 1512 AboutUI::AboutUI(content::WebUI* web_ui, const std::string& name) |
| 1509 : WebUIController(web_ui) { | 1513 : WebUIController(web_ui) { |
| 1510 Profile* profile = Profile::FromWebUI(web_ui); | 1514 Profile* profile = Profile::FromWebUI(web_ui); |
| 1511 ChromeURLDataManager::DataSource* source = | 1515 ChromeURLDataManager::DataSource* source = |
| 1512 new AboutUIHTMLSource(name, profile); | 1516 new AboutUIHTMLSource(name, profile); |
| 1513 if (source) | 1517 if (source) |
| 1514 profile->GetChromeURLDataManager()->AddDataSource(source); | 1518 profile->GetChromeURLDataManager()->AddDataSource(source); |
| 1515 } | 1519 } |
| OLD | NEW |