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

Side by Side Diff: chrome/browser/browser_main.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 | « chrome/browser/browser_about_handler.cc ('k') | chrome/browser/metrics/metrics_service.h » ('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-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <commctrl.h> 9 #include <commctrl.h>
10 #endif 10 #endif
(...skipping 28 matching lines...) Expand all
39 #include "chrome/browser/metrics/metrics_service.h" 39 #include "chrome/browser/metrics/metrics_service.h"
40 #include "chrome/browser/net/dns_global.h" 40 #include "chrome/browser/net/dns_global.h"
41 #include "chrome/browser/plugin_service.h" 41 #include "chrome/browser/plugin_service.h"
42 #include "chrome/browser/process_singleton.h" 42 #include "chrome/browser/process_singleton.h"
43 #include "chrome/browser/profile_manager.h" 43 #include "chrome/browser/profile_manager.h"
44 #include "chrome/browser/shell_integration.h" 44 #include "chrome/browser/shell_integration.h"
45 #include "chrome/browser/user_data_manager.h" 45 #include "chrome/browser/user_data_manager.h"
46 #include "chrome/common/chrome_constants.h" 46 #include "chrome/common/chrome_constants.h"
47 #include "chrome/common/chrome_paths.h" 47 #include "chrome/common/chrome_paths.h"
48 #include "chrome/common/chrome_switches.h" 48 #include "chrome/common/chrome_switches.h"
49 #include "chrome/common/histogram_synchronizer.h"
49 #include "chrome/common/jstemplate_builder.h" 50 #include "chrome/common/jstemplate_builder.h"
50 #include "chrome/common/main_function_params.h" 51 #include "chrome/common/main_function_params.h"
51 #include "chrome/common/pref_names.h" 52 #include "chrome/common/pref_names.h"
52 #include "chrome/common/pref_service.h" 53 #include "chrome/common/pref_service.h"
53 #include "chrome/common/result_codes.h" 54 #include "chrome/common/result_codes.h"
54 #include "grit/chromium_strings.h" 55 #include "grit/chromium_strings.h"
55 #include "grit/generated_resources.h" 56 #include "grit/generated_resources.h"
56 #include "grit/net_resources.h" 57 #include "grit/net_resources.h"
57 #include "net/base/cookie_monster.h" 58 #include "net/base/cookie_monster.h"
58 #include "net/base/net_module.h" 59 #include "net/base/net_module.h"
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 432
432 if (parsed_command_line.HasSwitch(switches::kEnableFileCookies)) { 433 if (parsed_command_line.HasSwitch(switches::kEnableFileCookies)) {
433 // Enable cookie storage for file:// URLs. Must do this before the first 434 // Enable cookie storage for file:// URLs. Must do this before the first
434 // Profile (and therefore the first CookieMonster) is created. 435 // Profile (and therefore the first CookieMonster) is created.
435 net::CookieMonster::EnableFileScheme(); 436 net::CookieMonster::EnableFileScheme();
436 } 437 }
437 438
438 // Initialize histogram statistics gathering system. 439 // Initialize histogram statistics gathering system.
439 StatisticsRecorder statistics; 440 StatisticsRecorder statistics;
440 441
442 // Initialize histogram synchronizer system. This is a singleton and is used
443 // for posting tasks via NewRunnableMethod. Its deleted when it goes out of
444 // scope. Even though NewRunnableMethod does AddRef and Release, the object
445 // will not be deleted after the Task is executed.
446 scoped_refptr<HistogramSynchronizer> histogram_synchronizer =
447 new HistogramSynchronizer();
448
441 // Initialize the shared instance of user data manager. 449 // Initialize the shared instance of user data manager.
442 scoped_ptr<UserDataManager> user_data_manager(UserDataManager::Create()); 450 scoped_ptr<UserDataManager> user_data_manager(UserDataManager::Create());
443 451
444 // Try to create/load the profile. 452 // Try to create/load the profile.
445 ProfileManager* profile_manager = browser_process->profile_manager(); 453 ProfileManager* profile_manager = browser_process->profile_manager();
446 Profile* profile = profile_manager->GetDefaultProfile(user_data_dir); 454 Profile* profile = profile_manager->GetDefaultProfile(user_data_dir);
447 if (!profile) { 455 if (!profile) {
448 // Ideally, we should be able to run w/o access to disk. For now, we 456 // Ideally, we should be able to run w/o access to disk. For now, we
449 // prompt the user to pick a different user-data-dir and restart chrome 457 // prompt the user to pick a different user-data-dir and restart chrome
450 // with the new dir. 458 // with the new dir.
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 PrepareRestartOnCrashEnviroment(parsed_command_line); 577 PrepareRestartOnCrashEnviroment(parsed_command_line);
570 578
571 #if defined(OS_WIN) 579 #if defined(OS_WIN)
572 // Initialize Winsock. 580 // Initialize Winsock.
573 net::EnsureWinsockInit(); 581 net::EnsureWinsockInit();
574 #endif // defined(OS_WIN) 582 #endif // defined(OS_WIN)
575 583
576 // Set up a field trial to see what disabling DNS pre-resolution does to 584 // Set up a field trial to see what disabling DNS pre-resolution does to
577 // latency of network transactions. 585 // latency of network transactions.
578 FieldTrial::Probability kDIVISOR = 100; 586 FieldTrial::Probability kDIVISOR = 100;
579 FieldTrial::Probability k_PROBABILITY_PER_GROUP = 10; // 10%. 587 FieldTrial::Probability k_PROBABILITY_PER_GROUP = 10; // 10% probability.
588 // For options we don't (currently) wish to test, we use zero probability.
589 FieldTrial::Probability k_PROBABILITY_DISABLED = 0;
580 scoped_refptr<FieldTrial> dns_trial = new FieldTrial("DnsImpact", kDIVISOR); 590 scoped_refptr<FieldTrial> dns_trial = new FieldTrial("DnsImpact", kDIVISOR);
581 591
582 dns_trial->AppendGroup("_disabled_prefetch", k_PROBABILITY_PER_GROUP); 592 dns_trial->AppendGroup("_disabled_prefetch", k_PROBABILITY_PER_GROUP);
593 // Don't discard names (erase these lines) yet, as we may use them, and we
594 // have histogram data named for these options.
583 int disabled_plus_4_connections = dns_trial->AppendGroup( 595 int disabled_plus_4_connections = dns_trial->AppendGroup(
584 "_disabled_prefetch_4_connections", k_PROBABILITY_PER_GROUP); 596 "_disabled_prefetch_4_connections", k_PROBABILITY_DISABLED);
585 int enabled_plus_4_connections = dns_trial->AppendGroup( 597 int enabled_plus_4_connections = dns_trial->AppendGroup(
586 "_enabled_prefetch_4_connections", k_PROBABILITY_PER_GROUP); 598 "_enabled_prefetch_4_connections", k_PROBABILITY_DISABLED);
587 599
588 scoped_ptr<chrome_browser_net::DnsPrefetcherInit> dns_prefetch_init; 600 scoped_ptr<chrome_browser_net::DnsPrefetcherInit> dns_prefetch_init;
589 if (dns_trial->group() == FieldTrial::kNotParticipating || 601 if (dns_trial->group() == FieldTrial::kNotParticipating ||
590 dns_trial->group() == enabled_plus_4_connections) { 602 dns_trial->group() == enabled_plus_4_connections) {
591 // Initialize the DNS prefetch system 603 // Initialize the DNS prefetch system
592 dns_prefetch_init.reset( 604 dns_prefetch_init.reset(
593 new chrome_browser_net::DnsPrefetcherInit(user_prefs)); 605 new chrome_browser_net::DnsPrefetcherInit(user_prefs));
594 chrome_browser_net::DnsPrefetchHostNamesAtStartup(user_prefs, local_state); 606 chrome_browser_net::DnsPrefetchHostNamesAtStartup(user_prefs, local_state);
595 chrome_browser_net::RestoreSubresourceReferrers(local_state); 607 chrome_browser_net::RestoreSubresourceReferrers(local_state);
596 } 608 }
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 if (metrics) 748 if (metrics)
737 metrics->Stop(); 749 metrics->Stop();
738 750
739 // browser_shutdown takes care of deleting browser_process, so we need to 751 // browser_shutdown takes care of deleting browser_process, so we need to
740 // release it. 752 // release it.
741 browser_process.release(); 753 browser_process.release();
742 browser_shutdown::Shutdown(); 754 browser_shutdown::Shutdown();
743 755
744 return result_code; 756 return result_code;
745 } 757 }
OLDNEW
« no previous file with comments | « chrome/browser/browser_about_handler.cc ('k') | chrome/browser/metrics/metrics_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698