| 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/chrome_browser_main.h" | 5 #include "chrome/browser/chrome_browser_main.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 g_browser_process->CreateDevToolsHttpProtocolHandler( | 534 g_browser_process->CreateDevToolsHttpProtocolHandler( |
| 535 chrome::HOST_DESKTOP_TYPE_NATIVE, | 535 chrome::HOST_DESKTOP_TYPE_NATIVE, |
| 536 "127.0.0.1", | 536 "127.0.0.1", |
| 537 static_cast<uint16>(port)); | 537 static_cast<uint16>(port)); |
| 538 } else { | 538 } else { |
| 539 DLOG(WARNING) << "Invalid http debugger port number " << port; | 539 DLOG(WARNING) << "Invalid http debugger port number " << port; |
| 540 } | 540 } |
| 541 } | 541 } |
| 542 } | 542 } |
| 543 | 543 |
| 544 base::StackSamplingProfiler::SamplingParams GetStartupSamplingParams() { |
| 545 // Sample at 10Hz for 30 seconds. |
| 546 base::StackSamplingProfiler::SamplingParams params; |
| 547 params.initial_delay = base::TimeDelta::FromMilliseconds(0); |
| 548 params.bursts = 1; |
| 549 params.samples_per_burst = 300; |
| 550 params.sampling_interval = base::TimeDelta::FromMilliseconds(100); |
| 551 return params; |
| 552 } |
| 553 |
| 544 } // namespace | 554 } // namespace |
| 545 | 555 |
| 546 namespace chrome_browser { | 556 namespace chrome_browser { |
| 547 | 557 |
| 548 // This error message is not localized because we failed to load the | 558 // This error message is not localized because we failed to load the |
| 549 // localization data files. | 559 // localization data files. |
| 550 #if defined(OS_WIN) | 560 #if defined(OS_WIN) |
| 551 const char kMissingLocaleDataTitle[] = "Missing File Error"; | 561 const char kMissingLocaleDataTitle[] = "Missing File Error"; |
| 552 #endif // defined(OS_WIN) | 562 #endif // defined(OS_WIN) |
| 553 | 563 |
| 554 #if defined(OS_WIN) | 564 #if defined(OS_WIN) |
| 555 // TODO(port) This should be used on Linux Aura as well. http://crbug.com/338969 | 565 // TODO(port) This should be used on Linux Aura as well. http://crbug.com/338969 |
| 556 const char kMissingLocaleDataMessage[] = | 566 const char kMissingLocaleDataMessage[] = |
| 557 "Unable to find locale data files. Please reinstall."; | 567 "Unable to find locale data files. Please reinstall."; |
| 558 #endif // defined(OS_WIN) | 568 #endif // defined(OS_WIN) |
| 559 | 569 |
| 560 } // namespace chrome_browser | 570 } // namespace chrome_browser |
| 561 | 571 |
| 562 // BrowserMainParts ------------------------------------------------------------ | 572 // BrowserMainParts ------------------------------------------------------------ |
| 563 | 573 |
| 564 ChromeBrowserMainParts::ChromeBrowserMainParts( | 574 ChromeBrowserMainParts::ChromeBrowserMainParts( |
| 565 const content::MainFunctionParams& parameters) | 575 const content::MainFunctionParams& parameters) |
| 566 : parameters_(parameters), | 576 : parameters_(parameters), |
| 567 parsed_command_line_(parameters.command_line), | 577 parsed_command_line_(parameters.command_line), |
| 568 result_code_(content::RESULT_CODE_NORMAL_EXIT), | 578 result_code_(content::RESULT_CODE_NORMAL_EXIT), |
| 569 startup_watcher_(new StartupTimeBomb()), | 579 startup_watcher_(new StartupTimeBomb()), |
| 570 shutdown_watcher_(new ShutdownWatcherHelper()), | 580 shutdown_watcher_(new ShutdownWatcherHelper()), |
| 571 browser_field_trials_(parameters.command_line), | 581 browser_field_trials_(parameters.command_line), |
| 582 sampling_profiler_( |
| 583 base::PlatformThread::CurrentId(), |
| 584 GetStartupSamplingParams(), |
| 585 metrics::CallStackProfileMetricsProvider::GetProfilerCallback( |
| 586 metrics::CallStackProfileMetricsProvider::Params( |
| 587 metrics::CallStackProfileMetricsProvider::PROCESS_STARTUP, |
| 588 false))), |
| 572 profile_(NULL), | 589 profile_(NULL), |
| 573 run_message_loop_(true), | 590 run_message_loop_(true), |
| 574 notify_result_(ProcessSingleton::PROCESS_NONE), | 591 notify_result_(ProcessSingleton::PROCESS_NONE), |
| 575 local_state_(NULL), | 592 local_state_(NULL), |
| 576 restart_last_session_(false) { | 593 restart_last_session_(false) { |
| 594 const version_info::Channel channel = chrome::GetChannel(); |
| 595 if (channel == version_info::Channel::UNKNOWN || |
| 596 channel == version_info::Channel::CANARY || |
| 597 channel == version_info::Channel::DEV) { |
| 598 sampling_profiler_.Start(); |
| 599 } |
| 600 |
| 577 // If we're running tests (ui_task is non-null). | 601 // If we're running tests (ui_task is non-null). |
| 578 if (parameters.ui_task) | 602 if (parameters.ui_task) |
| 579 browser_defaults::enable_help_app = false; | 603 browser_defaults::enable_help_app = false; |
| 580 | 604 |
| 581 // Chrome disallows cookies by default. All code paths that want to use | 605 // Chrome disallows cookies by default. All code paths that want to use |
| 582 // cookies need to go through one of Chrome's URLRequestContexts which have | 606 // cookies need to go through one of Chrome's URLRequestContexts which have |
| 583 // a ChromeNetworkDelegate attached that selectively allows cookies again. | 607 // a ChromeNetworkDelegate attached that selectively allows cookies again. |
| 584 net::URLRequest::SetDefaultCookiePolicyToBlock(); | 608 net::URLRequest::SetDefaultCookiePolicyToBlock(); |
| 585 } | 609 } |
| 586 | 610 |
| (...skipping 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1802 chromeos::CrosSettings::Shutdown(); | 1826 chromeos::CrosSettings::Shutdown(); |
| 1803 #endif // defined(OS_CHROMEOS) | 1827 #endif // defined(OS_CHROMEOS) |
| 1804 #endif // defined(OS_ANDROID) | 1828 #endif // defined(OS_ANDROID) |
| 1805 } | 1829 } |
| 1806 | 1830 |
| 1807 // Public members: | 1831 // Public members: |
| 1808 | 1832 |
| 1809 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { | 1833 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { |
| 1810 chrome_extra_parts_.push_back(parts); | 1834 chrome_extra_parts_.push_back(parts); |
| 1811 } | 1835 } |
| OLD | NEW |