OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/browser_about_handler.h" | 5 #include "chrome/browser/browser_about_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 #include "v8/include/v8.h" | 45 #include "v8/include/v8.h" |
46 #endif | 46 #endif |
47 | 47 |
48 #if defined(OS_WIN) | 48 #if defined(OS_WIN) |
49 #include "chrome/browser/views/about_ipc_dialog.h" | 49 #include "chrome/browser/views/about_ipc_dialog.h" |
50 #include "chrome/browser/views/about_network_dialog.h" | 50 #include "chrome/browser/views/about_network_dialog.h" |
51 #elif defined(OS_CHROMEOS) | 51 #elif defined(OS_CHROMEOS) |
52 #include "chrome/browser/chromeos/chromeos_version_loader.h" | 52 #include "chrome/browser/chromeos/chromeos_version_loader.h" |
53 #endif | 53 #endif |
54 | 54 |
| 55 #if defined(USE_TCMALLOC) |
| 56 #include "third_party/tcmalloc/google/malloc_extension.h" |
| 57 #endif |
| 58 |
55 #ifdef CHROME_PERSONALIZATION | 59 #ifdef CHROME_PERSONALIZATION |
56 #include "chrome/browser/sync/auth_error_state.h" | 60 #include "chrome/browser/sync/auth_error_state.h" |
57 #include "chrome/browser/sync/profile_sync_service.h" | 61 #include "chrome/browser/sync/profile_sync_service.h" |
58 using sync_api::SyncManager; | 62 using sync_api::SyncManager; |
59 #endif | 63 #endif |
60 | 64 |
61 | 65 |
62 using base::Time; | 66 using base::Time; |
63 using base::TimeDelta; | 67 using base::TimeDelta; |
64 | 68 |
65 namespace { | 69 namespace { |
66 | 70 |
67 // The paths used for the about pages. | 71 // The paths used for the about pages. |
68 const char kDnsPath[] = "dns"; | 72 const char kDnsPath[] = "dns"; |
69 const char kHistogramsPath[] = "histograms"; | 73 const char kHistogramsPath[] = "histograms"; |
70 const char kObjectsPath[] = "objects"; | 74 const char kObjectsPath[] = "objects"; |
71 const char kMemoryRedirectPath[] = "memory-redirect"; | 75 const char kMemoryRedirectPath[] = "memory-redirect"; |
72 const char kMemoryPath[] = "memory"; | 76 const char kMemoryPath[] = "memory"; |
| 77 const char kTcmallocPath[] = "tcmalloc"; |
73 const char kPluginsPath[] = "plugins"; | 78 const char kPluginsPath[] = "plugins"; |
74 const char kStatsPath[] = "stats"; | 79 const char kStatsPath[] = "stats"; |
75 const char kVersionPath[] = "version"; | 80 const char kVersionPath[] = "version"; |
76 const char kCreditsPath[] = "credits"; | 81 const char kCreditsPath[] = "credits"; |
77 const char kTermsPath[] = "terms"; | 82 const char kTermsPath[] = "terms"; |
78 const char kSyncPath[] = "sync"; | 83 const char kSyncPath[] = "sync"; |
79 | 84 |
80 // Points to the singleton AboutSource object, if any. | 85 // Points to the singleton AboutSource object, if any. |
81 ChromeURLDataManager::DataSource* about_source = NULL; | 86 ChromeURLDataManager::DataSource* about_source = NULL; |
82 | 87 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 | 179 |
175 return credits_html; | 180 return credits_html; |
176 } | 181 } |
177 | 182 |
178 std::string AboutDns() { | 183 std::string AboutDns() { |
179 std::string data; | 184 std::string data; |
180 chrome_browser_net::DnsPrefetchGetHtmlInfo(&data); | 185 chrome_browser_net::DnsPrefetchGetHtmlInfo(&data); |
181 return data; | 186 return data; |
182 } | 187 } |
183 | 188 |
| 189 #if defined(USE_TCMALLOC) |
| 190 std::string AboutTcmalloc(const std::string& query) { |
| 191 std::string data; |
| 192 char buffer[1024*32]; |
| 193 MallocExtension::instance()->GetStats(buffer, sizeof(buffer)); |
| 194 data.append("<html><head><title>About tcmalloc</title></head><body><pre>\n"); |
| 195 data.append(buffer); |
| 196 data.append("</pre></body></html>\n"); |
| 197 return data; |
| 198 } |
| 199 #endif |
| 200 |
184 std::string AboutHistograms(const std::string& query) { | 201 std::string AboutHistograms(const std::string& query) { |
185 TimeDelta wait_time = TimeDelta::FromMilliseconds(10000); | 202 TimeDelta wait_time = TimeDelta::FromMilliseconds(10000); |
186 | 203 |
187 HistogramSynchronizer* current_synchronizer = | 204 HistogramSynchronizer* current_synchronizer = |
188 HistogramSynchronizer::CurrentSynchronizer(); | 205 HistogramSynchronizer::CurrentSynchronizer(); |
189 DCHECK(current_synchronizer != NULL); | 206 DCHECK(current_synchronizer != NULL); |
190 current_synchronizer->FetchRendererHistogramsSynchronously(wait_time); | 207 current_synchronizer->FetchRendererHistogramsSynchronously(wait_time); |
191 | 208 |
192 std::string data; | 209 std::string data; |
193 StatisticsRecorder::WriteHTMLGraph(query, &data); | 210 StatisticsRecorder::WriteHTMLGraph(query, &data); |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 AboutMemory(this, request_id); | 560 AboutMemory(this, request_id); |
544 return; | 561 return; |
545 } else if (path == kMemoryRedirectPath) { | 562 } else if (path == kMemoryRedirectPath) { |
546 response = GetAboutMemoryRedirectResponse(); | 563 response = GetAboutMemoryRedirectResponse(); |
547 } else if (path == kObjectsPath) { | 564 } else if (path == kObjectsPath) { |
548 response = AboutObjects(info); | 565 response = AboutObjects(info); |
549 } else if (path == kPluginsPath) { | 566 } else if (path == kPluginsPath) { |
550 response = AboutPlugins(); | 567 response = AboutPlugins(); |
551 } else if (path == kStatsPath) { | 568 } else if (path == kStatsPath) { |
552 response = AboutStats(); | 569 response = AboutStats(); |
| 570 #if defined(USE_TCMALLOC) |
| 571 } else if (path == kTcmallocPath) { |
| 572 response = AboutTcmalloc(info); |
| 573 #endif |
553 } else if (path == kVersionPath || path.empty()) { | 574 } else if (path == kVersionPath || path.empty()) { |
554 #if defined(OS_CHROMEOS) | 575 #if defined(OS_CHROMEOS) |
555 new ChromeOSAboutVersionHandler(this, request_id); | 576 new ChromeOSAboutVersionHandler(this, request_id); |
556 return; | 577 return; |
557 #else | 578 #else |
558 DictionaryValue value; | 579 DictionaryValue value; |
559 response = AboutVersion(&value); | 580 response = AboutVersion(&value); |
560 #endif | 581 #endif |
561 } else if (path == kCreditsPath) { | 582 } else if (path == kCreditsPath) { |
562 response = AboutCredits(); | 583 response = AboutCredits(); |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 AboutIPCDialog::RunDialog(); | 858 AboutIPCDialog::RunDialog(); |
838 return true; | 859 return true; |
839 } | 860 } |
840 #endif | 861 #endif |
841 | 862 |
842 #else | 863 #else |
843 // TODO(port) Implement this. | 864 // TODO(port) Implement this. |
844 #endif | 865 #endif |
845 return false; | 866 return false; |
846 } | 867 } |
OLD | NEW |