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

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

Issue 15076: Clean up dns prefetch code, and also port it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: use scoper for init & free Created 11 years, 10 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
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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/field_trial.h" 10 #include "base/field_trial.h"
(...skipping 12 matching lines...) Expand all
23 #include "chrome/browser/browser_main_win.h" 23 #include "chrome/browser/browser_main_win.h"
24 #include "chrome/browser/browser_init.h" 24 #include "chrome/browser/browser_init.h"
25 #include "chrome/browser/browser_list.h" 25 #include "chrome/browser/browser_list.h"
26 #include "chrome/browser/browser_prefs.h" 26 #include "chrome/browser/browser_prefs.h"
27 #include "chrome/browser/browser_process.h" 27 #include "chrome/browser/browser_process.h"
28 #include "chrome/browser/browser_process_impl.h" 28 #include "chrome/browser/browser_process_impl.h"
29 #include "chrome/browser/browser_shutdown.h" 29 #include "chrome/browser/browser_shutdown.h"
30 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" 30 #include "chrome/browser/dom_ui/chrome_url_data_manager.h"
31 #include "chrome/browser/first_run.h" 31 #include "chrome/browser/first_run.h"
32 #include "chrome/browser/metrics/metrics_service.h" 32 #include "chrome/browser/metrics/metrics_service.h"
33 #include "chrome/browser/net/dns_global.h"
33 #include "chrome/browser/profile_manager.h" 34 #include "chrome/browser/profile_manager.h"
34 #include "chrome/browser/shell_integration.h" 35 #include "chrome/browser/shell_integration.h"
35 #include "chrome/common/chrome_constants.h" 36 #include "chrome/common/chrome_constants.h"
36 #include "chrome/common/chrome_paths.h" 37 #include "chrome/common/chrome_paths.h"
37 #include "chrome/common/chrome_switches.h" 38 #include "chrome/common/chrome_switches.h"
38 #include "chrome/common/jstemplate_builder.h" 39 #include "chrome/common/jstemplate_builder.h"
39 #include "chrome/common/l10n_util.h" 40 #include "chrome/common/l10n_util.h"
40 #include "chrome/common/main_function_params.h" 41 #include "chrome/common/main_function_params.h"
41 #include "chrome/common/pref_names.h" 42 #include "chrome/common/pref_names.h"
42 #include "chrome/common/pref_service.h" 43 #include "chrome/common/pref_service.h"
(...skipping 20 matching lines...) Expand all
63 64
64 #include "base/registry.h" 65 #include "base/registry.h"
65 #include "base/win_util.h" 66 #include "base/win_util.h"
66 #include "chrome/browser/automation/automation_provider.h" 67 #include "chrome/browser/automation/automation_provider.h"
67 #include "chrome/browser/browser.h" 68 #include "chrome/browser/browser.h"
68 #include "chrome/browser/browser_trial.h" 69 #include "chrome/browser/browser_trial.h"
69 #include "chrome/browser/extensions/extension_protocols.h" 70 #include "chrome/browser/extensions/extension_protocols.h"
70 #include "chrome/browser/jankometer.h" 71 #include "chrome/browser/jankometer.h"
71 #include "chrome/browser/metrics/user_metrics.h" 72 #include "chrome/browser/metrics/user_metrics.h"
72 #include "chrome/browser/process_singleton.h" 73 #include "chrome/browser/process_singleton.h"
73 #include "chrome/browser/net/dns_global.h"
74 #include "chrome/browser/net/sdch_dictionary_fetcher.h" 74 #include "chrome/browser/net/sdch_dictionary_fetcher.h"
75 #include "chrome/browser/net/url_fixer_upper.h" 75 #include "chrome/browser/net/url_fixer_upper.h"
76 #include "chrome/browser/plugin_service.h" 76 #include "chrome/browser/plugin_service.h"
77 #include "chrome/browser/printing/print_job_manager.h" 77 #include "chrome/browser/printing/print_job_manager.h"
78 #include "chrome/browser/profile.h" 78 #include "chrome/browser/profile.h"
79 #include "chrome/browser/profile_manager.h" 79 #include "chrome/browser/profile_manager.h"
80 #include "chrome/browser/rlz/rlz.h" 80 #include "chrome/browser/rlz/rlz.h"
81 #include "chrome/browser/user_data_manager.h" 81 #include "chrome/browser/user_data_manager.h"
82 #include "chrome/browser/views/user_data_dir_dialog.h" 82 #include "chrome/browser/views/user_data_dir_dialog.h"
83 #include "chrome/common/env_vars.h" 83 #include "chrome/common/env_vars.h"
(...skipping 17 matching lines...) Expand all
101 #include "net_resources.h" 101 #include "net_resources.h"
102 #endif 102 #endif
103 103
104 namespace Platform { 104 namespace Platform {
105 105
106 void WillInitializeMainMessageLoop(const CommandLine & command_line); 106 void WillInitializeMainMessageLoop(const CommandLine & command_line);
107 void WillTerminate(); 107 void WillTerminate();
108 108
109 #if defined(OS_WIN) || defined(OS_LINUX) 109 #if defined(OS_WIN) || defined(OS_LINUX)
110 // Perform any platform-specific work that needs to be done before the main 110 // Perform any platform-specific work that needs to be done before the main
111 // message loop is created and initialized. 111 // message loop is created and initialized.
112 void WillInitializeMainMessageLoop(const CommandLine & command_line) { 112 void WillInitializeMainMessageLoop(const CommandLine & command_line) {
113 } 113 }
114 114
115 // Perform platform-specific work that needs to be done after the main event 115 // Perform platform-specific work that needs to be done after the main event
116 // loop has ended. 116 // loop has ended.
117 void WillTerminate() { 117 void WillTerminate() {
118 } 118 }
119 #endif 119 #endif
120 120
121 } // namespace Platform 121 } // namespace Platform
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 } 435 }
436 436
437 // Sets things up so that if we crash from this point on, a dialog will 437 // Sets things up so that if we crash from this point on, a dialog will
438 // popup asking the user to restart chrome. It is done this late to avoid 438 // popup asking the user to restart chrome. It is done this late to avoid
439 // testing against a bunch of special cases that are taken care early on. 439 // testing against a bunch of special cases that are taken care early on.
440 PrepareRestartOnCrashEnviroment(parsed_command_line); 440 PrepareRestartOnCrashEnviroment(parsed_command_line);
441 441
442 #if defined(OS_WIN) 442 #if defined(OS_WIN)
443 // Initialize Winsock. 443 // Initialize Winsock.
444 net::EnsureWinsockInit(); 444 net::EnsureWinsockInit();
445 #endif // defined(OS_WIN)
445 446
446 // Initialize the DNS prefetch system 447 // Initialize the DNS prefetch system
447 chrome_browser_net::DnsPrefetcherInit dns_prefetch_init(user_prefs); 448 chrome_browser_net::DnsPrefetcherInit dns_prefetch_init(user_prefs);
448 chrome_browser_net::DnsPrefetchHostNamesAtStartup(user_prefs, local_state); 449 chrome_browser_net::DnsPrefetchHostNamesAtStartup(user_prefs, local_state);
449 chrome_browser_net::RestoreSubresourceReferrers(local_state); 450 chrome_browser_net::RestoreSubresourceReferrers(local_state);
450 451
452 #if defined(OS_WIN)
451 // Init common control sex. 453 // Init common control sex.
452 INITCOMMONCONTROLSEX config; 454 INITCOMMONCONTROLSEX config;
453 config.dwSize = sizeof(config); 455 config.dwSize = sizeof(config);
454 config.dwICC = ICC_WIN95_CLASSES; 456 config.dwICC = ICC_WIN95_CLASSES;
455 InitCommonControlsEx(&config); 457 InitCommonControlsEx(&config);
456 458
457 win_util::ScopedCOMInitializer com_initializer; 459 win_util::ScopedCOMInitializer com_initializer;
458 460
459 // Init the RLZ library. This just binds the dll and schedules a task on the 461 // Init the RLZ library. This just binds the dll and schedules a task on the
460 // file thread to be run sometime later. If this is the first run we record 462 // file thread to be run sometime later. If this is the first run we record
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 if (metrics) 571 if (metrics)
570 metrics->Stop(); 572 metrics->Stop();
571 573
572 // browser_shutdown takes care of deleting browser_process, so we need to 574 // browser_shutdown takes care of deleting browser_process, so we need to
573 // release it. 575 // release it.
574 browser_process.release(); 576 browser_process.release();
575 browser_shutdown::Shutdown(); 577 browser_shutdown::Shutdown();
576 578
577 return result_code; 579 return result_code;
578 } 580 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698