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

Side by Side Diff: chrome/browser/browser_about_handler.cc

Issue 113473: Automatically adapt to faster/slower uploads of renderer histograms... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 months 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 | « base/histogram.cc ('k') | chrome/browser/browser_main.cc » ('j') | 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) 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"
11 #include "app/resource_bundle.h" 11 #include "app/resource_bundle.h"
12 #include "base/file_version_info.h" 12 #include "base/file_version_info.h"
13 #include "base/histogram.h" 13 #include "base/histogram.h"
14 #include "base/platform_thread.h" 14 #include "base/platform_thread.h"
15 #include "base/stats_table.h" 15 #include "base/stats_table.h"
16 #include "base/string_piece.h" 16 #include "base/string_piece.h"
17 #include "base/string_util.h" 17 #include "base/string_util.h"
18 #include "base/thread.h" 18 #include "base/thread.h"
19 #include "base/tracked_objects.h" 19 #include "base/tracked_objects.h"
20 #include "chrome/browser/browser.h" 20 #include "chrome/browser/browser.h"
21 #include "chrome/browser/browser_process.h" 21 #include "chrome/browser/browser_process.h"
22 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" 22 #include "chrome/browser/dom_ui/chrome_url_data_manager.h"
23 #include "chrome/browser/memory_details.h" 23 #include "chrome/browser/memory_details.h"
24 #include "chrome/browser/net/dns_global.h" 24 #include "chrome/browser/net/dns_global.h"
25 #include "chrome/browser/renderer_host/render_process_host.h" 25 #include "chrome/browser/renderer_host/render_process_host.h"
26 #include "chrome/browser/renderer_host/render_view_host.h" 26 #include "chrome/browser/renderer_host/render_view_host.h"
27 #include "chrome/common/histogram_synchronizer.h"
27 #include "chrome/common/jstemplate_builder.h" 28 #include "chrome/common/jstemplate_builder.h"
28 #include "chrome/common/pref_names.h" 29 #include "chrome/common/pref_names.h"
29 #include "chrome/common/pref_service.h" 30 #include "chrome/common/pref_service.h"
30 #include "chrome/common/render_messages.h" 31 #include "chrome/common/render_messages.h"
31 #include "chrome/common/url_constants.h" 32 #include "chrome/common/url_constants.h"
32 #include "chrome/renderer/about_handler.h" 33 #include "chrome/renderer/about_handler.h"
33 #include "googleurl/src/gurl.h" 34 #include "googleurl/src/gurl.h"
34 #include "grit/browser_resources.h" 35 #include "grit/browser_resources.h"
35 #include "grit/chromium_strings.h" 36 #include "grit/chromium_strings.h"
36 #include "grit/generated_resources.h" 37 #include "grit/generated_resources.h"
37 #include "grit/locale_settings.h" 38 #include "grit/locale_settings.h"
38 #include "webkit/glue/webkit_glue.h" 39 #include "webkit/glue/webkit_glue.h"
39 #ifdef CHROME_V8 40 #ifdef CHROME_V8
40 #include "v8/include/v8.h" 41 #include "v8/include/v8.h"
41 #endif 42 #endif
42 43
43 #if defined(OS_WIN) 44 #if defined(OS_WIN)
44 #include "chrome/browser/views/about_ipc_dialog.h" 45 #include "chrome/browser/views/about_ipc_dialog.h"
45 #include "chrome/browser/views/about_network_dialog.h" 46 #include "chrome/browser/views/about_network_dialog.h"
46 #endif 47 #endif
47 48
49 using base::Time;
50 using base::TimeDelta;
51
48 namespace { 52 namespace {
49 53
50 // The paths used for the about pages. 54 // The paths used for the about pages.
51 const char kCachePath[] = "cache"; 55 const char kCachePath[] = "cache";
52 const char kDnsPath[] = "dns"; 56 const char kDnsPath[] = "dns";
53 const char kHistogramsPath[] = "histograms"; 57 const char kHistogramsPath[] = "histograms";
54 const char kObjectsPath[] = "objects"; 58 const char kObjectsPath[] = "objects";
55 const char kMemoryRedirectPath[] = "memory-redirect"; 59 const char kMemoryRedirectPath[] = "memory-redirect";
56 const char kMemoryPath[] = "memory"; 60 const char kMemoryPath[] = "memory";
57 const char kPluginsPath[] = "plugins"; 61 const char kPluginsPath[] = "plugins";
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 return credits_html; 134 return credits_html;
131 } 135 }
132 136
133 std::string AboutDns() { 137 std::string AboutDns() {
134 std::string data; 138 std::string data;
135 chrome_browser_net::DnsPrefetchGetHtmlInfo(&data); 139 chrome_browser_net::DnsPrefetchGetHtmlInfo(&data);
136 return data; 140 return data;
137 } 141 }
138 142
139 std::string AboutHistograms(const std::string& query) { 143 std::string AboutHistograms(const std::string& query) {
144 TimeDelta wait_time = TimeDelta::FromMilliseconds(10000);
145
146 HistogramSynchronizer* current_synchronizer =
147 HistogramSynchronizer::CurrentSynchronizer();
148 DCHECK(current_synchronizer != NULL);
149 current_synchronizer->FetchRendererHistogramsSynchronously(wait_time);
150
140 std::string data; 151 std::string data;
141 for (RenderProcessHost::iterator it = RenderProcessHost::begin();
142 it != RenderProcessHost::end(); ++it) {
143 it->second->Send(new ViewMsg_GetRendererHistograms());
144 }
145
146 // TODO(raman): Delay page layout until we get respnoses
147 // back from renderers, and not have to use a fixed size delay.
148 PlatformThread::Sleep(1000);
149
150 StatisticsRecorder::WriteHTMLGraph(query, &data); 152 StatisticsRecorder::WriteHTMLGraph(query, &data);
151 return data; 153 return data;
152 } 154 }
153 155
154 std::string AboutLinuxSplash() { 156 std::string AboutLinuxSplash() {
155 int resource_id = IDR_LINUX_SPLASH_HTML_CHROMIUM; 157 int resource_id = IDR_LINUX_SPLASH_HTML_CHROMIUM;
156 scoped_ptr<FileVersionInfo> version_info( 158 scoped_ptr<FileVersionInfo> version_info(
157 FileVersionInfo::CreateFileVersionInfoForCurrentModule()); 159 FileVersionInfo::CreateFileVersionInfoForCurrentModule());
158 if (version_info == NULL) { 160 if (version_info == NULL) {
159 DLOG(ERROR) << "Unable to create FileVersionInfo object"; 161 DLOG(ERROR) << "Unable to create FileVersionInfo object";
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 AboutIPCDialog::RunDialog(); 654 AboutIPCDialog::RunDialog();
653 return true; 655 return true;
654 } 656 }
655 #endif 657 #endif
656 658
657 #else 659 #else
658 // TODO(port) Implement this. 660 // TODO(port) Implement this.
659 #endif 661 #endif
660 return false; 662 return false;
661 } 663 }
OLDNEW
« no previous file with comments | « base/histogram.cc ('k') | chrome/browser/browser_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698