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