Skip to content

Commit

Permalink
[Sampling profiler] Delay profiler start post crashpad init
Browse files Browse the repository at this point in the history
We want to start profiling as early as possible, but also want crash
reporting for this execution.

Also removes the unnecessary ChromeMainDelegate::SandboxInitialized()
overload.

Bug: 1099411
Change-Id: I788cfe5557b5f47cfdabd3c5e03cd045d8f0e037
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2271163
Reviewed-by: David Trainor <dtrainor@chromium.org>
Reviewed-by: Etienne Pierre-Doray <etiennep@chromium.org>
Commit-Queue: Mike Wittman <wittman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#784077}
  • Loading branch information
Mike Wittman authored and Commit Bot committed Jun 30, 2020
1 parent c90a171 commit 2435174
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 5 additions & 6 deletions chrome/app/android/chrome_main_delegate_android.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ ChromeMainDelegateAndroid::ChromeMainDelegateAndroid() = default;
ChromeMainDelegateAndroid::~ChromeMainDelegateAndroid() = default;

bool ChromeMainDelegateAndroid::BasicStartupComplete(int* exit_code) {
// Start the sampling profiler as early as possible.
sampling_profiler_ = std::make_unique<MainThreadStackSamplingProfiler>();

#if BUILDFLAG(SAFE_BROWSING_DB_REMOTE)
safe_browsing_api_handler_.reset(
new safe_browsing::SafeBrowsingApiHandlerBridge());
Expand All @@ -48,9 +45,11 @@ bool ChromeMainDelegateAndroid::BasicStartupComplete(int* exit_code) {
return ChromeMainDelegate::BasicStartupComplete(exit_code);
}

void ChromeMainDelegateAndroid::SandboxInitialized(
const std::string& process_type) {
ChromeMainDelegate::SandboxInitialized(process_type);
void ChromeMainDelegateAndroid::PreSandboxStartup() {
ChromeMainDelegate::PreSandboxStartup();

// Start the sampling profiler after crashpad initialization.
sampling_profiler_ = std::make_unique<MainThreadStackSamplingProfiler>();
}

void ChromeMainDelegateAndroid::SecureDataDirectory() {
Expand Down
2 changes: 1 addition & 1 deletion chrome/app/android/chrome_main_delegate_android.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ChromeMainDelegateAndroid : public ChromeMainDelegate {
~ChromeMainDelegateAndroid() override;

bool BasicStartupComplete(int* exit_code) override;
void SandboxInitialized(const std::string& process_type) override;
void PreSandboxStartup() override;
int RunProcess(
const std::string& process_type,
const content::MainFunctionParams& main_function_params) override;
Expand Down

0 comments on commit 2435174

Please sign in to comment.