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

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

Issue 1029653002: Enable startup profiling by Win x64 stack sampling profiler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@statprof-metrics-provider
Patch Set: address comments Created 5 years, 9 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
OLDNEW
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 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 // BrowserMainParts ------------------------------------------------------------ 570 // BrowserMainParts ------------------------------------------------------------
571 571
572 ChromeBrowserMainParts::ChromeBrowserMainParts( 572 ChromeBrowserMainParts::ChromeBrowserMainParts(
573 const content::MainFunctionParams& parameters) 573 const content::MainFunctionParams& parameters)
574 : parameters_(parameters), 574 : parameters_(parameters),
575 parsed_command_line_(parameters.command_line), 575 parsed_command_line_(parameters.command_line),
576 result_code_(content::RESULT_CODE_NORMAL_EXIT), 576 result_code_(content::RESULT_CODE_NORMAL_EXIT),
577 startup_watcher_(new StartupTimeBomb()), 577 startup_watcher_(new StartupTimeBomb()),
578 shutdown_watcher_(new ShutdownWatcherHelper()), 578 shutdown_watcher_(new ShutdownWatcherHelper()),
579 browser_field_trials_(parameters.command_line), 579 browser_field_trials_(parameters.command_line),
580 sampling_profiler_(base::PlatformThread::CurrentId(),
581 GetStartupSamplingParams()),
580 profile_(NULL), 582 profile_(NULL),
581 run_message_loop_(true), 583 run_message_loop_(true),
582 notify_result_(ProcessSingleton::PROCESS_NONE), 584 notify_result_(ProcessSingleton::PROCESS_NONE),
583 local_state_(NULL), 585 local_state_(NULL),
584 restart_last_session_(false) { 586 restart_last_session_(false) {
587 sampling_profiler_.Start();
585 // If we're running tests (ui_task is non-null). 588 // If we're running tests (ui_task is non-null).
586 if (parameters.ui_task) 589 if (parameters.ui_task)
587 browser_defaults::enable_help_app = false; 590 browser_defaults::enable_help_app = false;
588 591
589 // Chrome disallows cookies by default. All code paths that want to use 592 // Chrome disallows cookies by default. All code paths that want to use
590 // cookies need to go through one of Chrome's URLRequestContexts which have 593 // cookies need to go through one of Chrome's URLRequestContexts which have
591 // a ChromeNetworkDelegate attached that selectively allows cookies again. 594 // a ChromeNetworkDelegate attached that selectively allows cookies again.
592 net::URLRequest::SetDefaultCookiePolicyToBlock(); 595 net::URLRequest::SetDefaultCookiePolicyToBlock();
593 } 596 }
594 597
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 } 720 }
718 #endif // defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_LINUX) 721 #endif // defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_LINUX)
719 722
720 // Record collected startup metrics. 723 // Record collected startup metrics.
721 startup_metric_utils::OnBrowserStartupComplete(is_first_run); 724 startup_metric_utils::OnBrowserStartupComplete(is_first_run);
722 725
723 // Deletes self. 726 // Deletes self.
724 new LoadCompleteListener(); 727 new LoadCompleteListener();
725 } 728 }
726 729
730 // static
731 base::StackSamplingProfiler::SamplingParams
732 ChromeBrowserMainParts::GetStartupSamplingParams() {
733 // Sample at 10Hz for 30 seconds.
734 base::StackSamplingProfiler::SamplingParams params;
735 params.initial_delay = base::TimeDelta::FromMilliseconds(0);
736 params.bursts = 1;
737 params.samples_per_burst = 300;
738 params.sampling_interval = base::TimeDelta::FromMilliseconds(100);
739 params.preserve_sample_ordering = false;
740 return params;
741 }
742
727 // ----------------------------------------------------------------------------- 743 // -----------------------------------------------------------------------------
728 // TODO(viettrungluu): move more/rest of BrowserMain() into BrowserMainParts. 744 // TODO(viettrungluu): move more/rest of BrowserMain() into BrowserMainParts.
729 745
730 #if defined(OS_WIN) 746 #if defined(OS_WIN)
731 #define DLLEXPORT __declspec(dllexport) 747 #define DLLEXPORT __declspec(dllexport)
732 748
733 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling. 749 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling.
734 extern "C" { 750 extern "C" {
735 DLLEXPORT void __cdecl RelaunchChromeBrowserWithNewCommandLineIfNeeded(); 751 DLLEXPORT void __cdecl RelaunchChromeBrowserWithNewCommandLineIfNeeded();
736 } 752 }
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after
1730 chromeos::CrosSettings::Shutdown(); 1746 chromeos::CrosSettings::Shutdown();
1731 #endif // defined(OS_CHROMEOS) 1747 #endif // defined(OS_CHROMEOS)
1732 #endif // defined(OS_ANDROID) 1748 #endif // defined(OS_ANDROID)
1733 } 1749 }
1734 1750
1735 // Public members: 1751 // Public members:
1736 1752
1737 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { 1753 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) {
1738 chrome_extra_parts_.push_back(parts); 1754 chrome_extra_parts_.push_back(parts);
1739 } 1755 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698