| 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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 output.append(StringPrintf("%d discards this session. ", | 356 output.append(StringPrintf("%d discards this session. ", |
| 357 oom->discard_count())); | 357 oom->discard_count())); |
| 358 output.append(StringPrintf("<a href='%s%s'>Discard tab now</a>", | 358 output.append(StringPrintf("<a href='%s%s'>Discard tab now</a>", |
| 359 chrome::kChromeUIDiscardsURL, | 359 chrome::kChromeUIDiscardsURL, |
| 360 kRunCommand)); | 360 kRunCommand)); |
| 361 | 361 |
| 362 base::SystemMemoryInfoKB meminfo; | 362 base::SystemMemoryInfoKB meminfo; |
| 363 base::GetSystemMemoryInfo(&meminfo); | 363 base::GetSystemMemoryInfo(&meminfo); |
| 364 output.append("<h3>System memory information in MB</h3>"); | 364 output.append("<h3>System memory information in MB</h3>"); |
| 365 output.append("<table>"); | 365 output.append("<table>"); |
| 366 // Start with summary statistics. |
| 366 output.append(AddStringRow( | 367 output.append(AddStringRow( |
| 367 "Total", base::IntToString(meminfo.total / 1024))); | 368 "Total", base::IntToString(meminfo.total / 1024))); |
| 368 output.append(AddStringRow( | 369 output.append(AddStringRow( |
| 369 "Free", base::IntToString(meminfo.free / 1024))); | 370 "Free", base::IntToString(meminfo.free / 1024))); |
| 371 int mem_allocated_kb = meminfo.active_anon + meminfo.inactive_anon; |
| 372 #if defined(ARCH_CPU_ARM_FAMILY) |
| 373 // ARM counts allocated graphics memory separately from anonymous. |
| 374 if (meminfo.gem_size != -1) |
| 375 mem_allocated_kb += meminfo.gem_size / 1024; |
| 376 #endif |
| 370 output.append(AddStringRow( | 377 output.append(AddStringRow( |
| 371 "Buffered", base::IntToString(meminfo.buffers / 1024))); | 378 "Allocated", base::IntToString(mem_allocated_kb / 1024))); |
| 379 // Add some space, then detailed numbers. |
| 380 output.append(AddStringRow(" ", " ")); |
| 372 output.append(AddStringRow( | 381 output.append(AddStringRow( |
| 373 "Cached", base::IntToString(meminfo.cached / 1024))); | 382 "Buffered", base::IntToString(meminfo.buffers / 1024))); |
| 374 output.append(AddStringRow( | 383 output.append(AddStringRow( |
| 375 "Committed", base::IntToString( | 384 "Cached", base::IntToString(meminfo.cached / 1024))); |
| 376 (meminfo.total - meminfo.free - meminfo.buffers - meminfo.cached) / 1024))); | |
| 377 output.append(AddStringRow( | 385 output.append(AddStringRow( |
| 378 "Active Anon", base::IntToString(meminfo.active_anon / 1024))); | 386 "Active Anon", base::IntToString(meminfo.active_anon / 1024))); |
| 379 output.append(AddStringRow( | 387 output.append(AddStringRow( |
| 380 "Inactive Anon", base::IntToString(meminfo.inactive_anon / 1024))); | 388 "Inactive Anon", base::IntToString(meminfo.inactive_anon / 1024))); |
| 381 output.append(AddStringRow( | 389 output.append(AddStringRow( |
| 382 "Shared", base::IntToString(meminfo.shmem / 1024))); | 390 "Shared", base::IntToString(meminfo.shmem / 1024))); |
| 391 if (meminfo.gem_size != -1) { |
| 392 output.append(AddStringRow( |
| 393 "Graphics", base::IntToString(meminfo.gem_size / 1024 / 1024))); |
| 394 } |
| 383 output.append("</table>"); | 395 output.append("</table>"); |
| 384 | 396 |
| 385 AppendFooter(&output); | 397 AppendFooter(&output); |
| 386 return output; | 398 return output; |
| 387 } | 399 } |
| 388 | 400 |
| 389 #endif // OS_CHROMEOS | 401 #endif // OS_CHROMEOS |
| 390 | 402 |
| 391 #if defined(USE_ASH) | 403 #if defined(USE_ASH) |
| 392 | 404 |
| (...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1029 ThemeSource* theme = new ThemeSource(profile); | 1041 ThemeSource* theme = new ThemeSource(profile); |
| 1030 ChromeURLDataManager::AddDataSource(profile, theme); | 1042 ChromeURLDataManager::AddDataSource(profile, theme); |
| 1031 #endif | 1043 #endif |
| 1032 | 1044 |
| 1033 ChromeURLDataManager::DataSource* source = | 1045 ChromeURLDataManager::DataSource* source = |
| 1034 new AboutUIHTMLSource(name, profile); | 1046 new AboutUIHTMLSource(name, profile); |
| 1035 if (source) { | 1047 if (source) { |
| 1036 ChromeURLDataManager::AddDataSource(profile, source); | 1048 ChromeURLDataManager::AddDataSource(profile, source); |
| 1037 } | 1049 } |
| 1038 } | 1050 } |
| OLD | NEW |