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 28 matching lines...) Expand all Loading... | |
39 #include "chrome/browser/profiles/profile_manager.h" | 39 #include "chrome/browser/profiles/profile_manager.h" |
40 #include "chrome/browser/ui/browser_dialogs.h" | 40 #include "chrome/browser/ui/browser_dialogs.h" |
41 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 41 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
42 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" | 42 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" |
43 #include "chrome/common/chrome_paths.h" | 43 #include "chrome/common/chrome_paths.h" |
44 #include "chrome/common/chrome_version_info.h" | 44 #include "chrome/common/chrome_version_info.h" |
45 #include "chrome/common/jstemplate_builder.h" | 45 #include "chrome/common/jstemplate_builder.h" |
46 #include "chrome/common/net/gaia/google_service_auth_error.h" | 46 #include "chrome/common/net/gaia/google_service_auth_error.h" |
47 #include "chrome/common/render_messages.h" | 47 #include "chrome/common/render_messages.h" |
48 #include "chrome/common/url_constants.h" | 48 #include "chrome/common/url_constants.h" |
49 #include "content/public/browser/browser_child_process_host_iterator.h" | |
49 #include "content/public/browser/browser_thread.h" | 50 #include "content/public/browser/browser_thread.h" |
51 #include "content/public/browser/child_process_data.h" | |
50 #include "content/public/browser/plugin_service.h" | 52 #include "content/public/browser/plugin_service.h" |
51 #include "content/public/browser/render_process_host.h" | 53 #include "content/public/browser/render_process_host.h" |
52 #include "content/public/browser/render_view_host.h" | 54 #include "content/public/browser/render_view_host.h" |
53 #include "content/public/browser/web_contents.h" | 55 #include "content/public/browser/web_contents.h" |
54 #include "content/public/browser/web_ui.h" | 56 #include "content/public/browser/web_ui.h" |
55 #include "content/public/common/content_client.h" | 57 #include "content/public/common/content_client.h" |
56 #include "content/public/common/process_type.h" | 58 #include "content/public/common/process_type.h" |
59 #include "content/common/child_process_messages.h" | |
57 #include "crypto/nss_util.h" | 60 #include "crypto/nss_util.h" |
58 #include "googleurl/src/gurl.h" | 61 #include "googleurl/src/gurl.h" |
59 #include "grit/browser_resources.h" | 62 #include "grit/browser_resources.h" |
60 #include "grit/chromium_strings.h" | 63 #include "grit/chromium_strings.h" |
61 #include "grit/generated_resources.h" | 64 #include "grit/generated_resources.h" |
62 #include "grit/locale_settings.h" | 65 #include "grit/locale_settings.h" |
63 #include "net/base/escape.h" | 66 #include "net/base/escape.h" |
64 #include "net/base/net_util.h" | 67 #include "net/base/net_util.h" |
65 #include "ui/base/l10n/l10n_util.h" | 68 #include "ui/base/l10n/l10n_util.h" |
66 #include "ui/base/resource/resource_bundle.h" | 69 #include "ui/base/resource/resource_bundle.h" |
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
781 // Where the results are fed to. | 784 // Where the results are fed to. |
782 scoped_refptr<AboutUIHTMLSource> source_; | 785 scoped_refptr<AboutUIHTMLSource> source_; |
783 | 786 |
784 // ID identifying the request. | 787 // ID identifying the request. |
785 int request_id_; | 788 int request_id_; |
786 | 789 |
787 DISALLOW_COPY_AND_ASSIGN(AboutDnsHandler); | 790 DISALLOW_COPY_AND_ASSIGN(AboutDnsHandler); |
788 }; | 791 }; |
789 | 792 |
790 #if defined(USE_TCMALLOC) | 793 #if defined(USE_TCMALLOC) |
794 void RequestTcmallocStatsFromChildProcesses() { | |
795 for (content::BrowserChildProcessHostIterator iter; !iter.Done(); ++iter) { | |
796 iter.Send(new ChildProcessMsg_GetTcmallocStats); | |
797 } | |
798 } | |
799 | |
791 std::string AboutTcmalloc() { | 800 std::string AboutTcmalloc() { |
792 std::string data; | 801 std::string data; |
793 AboutTcmallocOutputsType* outputs = | 802 AboutTcmallocOutputsType* outputs = |
794 AboutTcmallocOutputs::GetInstance()->outputs(); | 803 AboutTcmallocOutputs::GetInstance()->outputs(); |
795 | 804 |
796 // Display any stats for which we sent off requests the last time. | 805 // Display any stats for which we sent off requests the last time. |
797 AppendHeader(&data, 0, "About tcmalloc"); | 806 AppendHeader(&data, 0, "About tcmalloc"); |
798 AppendBody(&data); | 807 AppendBody(&data); |
799 data.append("<p>Stats as of last page load;"); | 808 data.append("<p>Stats as of last page load;"); |
800 data.append("reload to get stats as of this page load.</p>\n"); | 809 data.append("reload to get stats as of this page load.</p>\n"); |
(...skipping 13 matching lines...) Expand all Loading... | |
814 | 823 |
815 // Reset our collector singleton. | 824 // Reset our collector singleton. |
816 outputs->clear(); | 825 outputs->clear(); |
817 | 826 |
818 // Populate the collector with stats from the local browser process | 827 // Populate the collector with stats from the local browser process |
819 // and send off requests to all the renderer processes. | 828 // and send off requests to all the renderer processes. |
820 char buffer[1024 * 32]; | 829 char buffer[1024 * 32]; |
821 MallocExtension::instance()->GetStats(buffer, sizeof(buffer)); | 830 MallocExtension::instance()->GetStats(buffer, sizeof(buffer)); |
822 std::string browser("Browser"); | 831 std::string browser("Browser"); |
823 AboutTcmallocOutputs::GetInstance()->SetOutput(browser, buffer); | 832 AboutTcmallocOutputs::GetInstance()->SetOutput(browser, buffer); |
833 | |
834 // FIXME: Why do I have to iterate over both this and | |
jam
2012/04/18 23:06:41
1) chrome code uses TODOs not FIXME :)
2) there ar
| |
835 // BrowserChildProcessHostIterator? | |
824 content::RenderProcessHost::iterator | 836 content::RenderProcessHost::iterator |
825 it(content::RenderProcessHost::AllHostsIterator()); | 837 it(content::RenderProcessHost::AllHostsIterator()); |
826 while (!it.IsAtEnd()) { | 838 while (!it.IsAtEnd()) { |
827 it.GetCurrentValue()->Send(new ChromeViewMsg_GetRendererTcmalloc); | 839 it.GetCurrentValue()->Send(new ChildProcessMsg_GetTcmallocStats); |
828 it.Advance(); | 840 it.Advance(); |
829 } | 841 } |
830 | 842 |
843 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind( | |
jam
2012/04/18 23:06:41
nit: i think this is non standard tabbing per the
| |
844 &RequestTcmallocStatsFromChildProcesses)); | |
831 return data; | 845 return data; |
832 } | 846 } |
833 #endif | 847 #endif |
834 | 848 |
835 std::string AboutHistograms(const std::string& query) { | 849 std::string AboutHistograms(const std::string& query) { |
836 TimeDelta wait_time = TimeDelta::FromMilliseconds(10000); | 850 TimeDelta wait_time = TimeDelta::FromMilliseconds(10000); |
837 | 851 |
838 #ifndef NDEBUG | 852 #ifndef NDEBUG |
839 base::StatisticsRecorder::CollectHistogramStats("Browser"); | 853 base::StatisticsRecorder::CollectHistogramStats("Browser"); |
840 #endif | 854 #endif |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1506 } | 1520 } |
1507 | 1521 |
1508 AboutUI::AboutUI(content::WebUI* web_ui, const std::string& name) | 1522 AboutUI::AboutUI(content::WebUI* web_ui, const std::string& name) |
1509 : WebUIController(web_ui) { | 1523 : WebUIController(web_ui) { |
1510 Profile* profile = Profile::FromWebUI(web_ui); | 1524 Profile* profile = Profile::FromWebUI(web_ui); |
1511 ChromeURLDataManager::DataSource* source = | 1525 ChromeURLDataManager::DataSource* source = |
1512 new AboutUIHTMLSource(name, profile); | 1526 new AboutUIHTMLSource(name, profile); |
1513 if (source) | 1527 if (source) |
1514 profile->GetChromeURLDataManager()->AddDataSource(source); | 1528 profile->GetChromeURLDataManager()->AddDataSource(source); |
1515 } | 1529 } |
OLD | NEW |