fix: record cpu_profiler data for main process (#21187)
* fix: record cpu_profiler data for main process * kick ci
This commit is contained in:
parent
135a64955c
commit
033d309874
4 changed files with 17 additions and 0 deletions
|
@ -24,6 +24,7 @@
|
||||||
#include "ipc/ipc_buildflags.h"
|
#include "ipc/ipc_buildflags.h"
|
||||||
#include "services/service_manager/embedder/switches.h"
|
#include "services/service_manager/embedder/switches.h"
|
||||||
#include "services/service_manager/sandbox/switches.h"
|
#include "services/service_manager/sandbox/switches.h"
|
||||||
|
#include "services/tracing/public/cpp/stack_sampling/tracing_sampler_profiler.h"
|
||||||
#include "shell/app/atom_content_client.h"
|
#include "shell/app/atom_content_client.h"
|
||||||
#include "shell/browser/atom_browser_client.h"
|
#include "shell/browser/atom_browser_client.h"
|
||||||
#include "shell/browser/atom_gpu_client.h"
|
#include "shell/browser/atom_gpu_client.h"
|
||||||
|
@ -182,6 +183,9 @@ bool AtomMainDelegate::BasicStartupComplete(int* exit_code) {
|
||||||
if (env->HasVar("ELECTRON_DISABLE_SANDBOX"))
|
if (env->HasVar("ELECTRON_DISABLE_SANDBOX"))
|
||||||
command_line->AppendSwitch(service_manager::switches::kNoSandbox);
|
command_line->AppendSwitch(service_manager::switches::kNoSandbox);
|
||||||
|
|
||||||
|
tracing_sampler_profiler_ =
|
||||||
|
tracing::TracingSamplerProfiler::CreateOnMainThread();
|
||||||
|
|
||||||
chrome::RegisterPathProvider();
|
chrome::RegisterPathProvider();
|
||||||
|
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
|
|
|
@ -11,6 +11,10 @@
|
||||||
#include "content/public/app/content_main_delegate.h"
|
#include "content/public/app/content_main_delegate.h"
|
||||||
#include "content/public/common/content_client.h"
|
#include "content/public/common/content_client.h"
|
||||||
|
|
||||||
|
namespace tracing {
|
||||||
|
class TracingSamplerProfiler;
|
||||||
|
}
|
||||||
|
|
||||||
namespace electron {
|
namespace electron {
|
||||||
|
|
||||||
void LoadResourceBundle(const std::string& locale);
|
void LoadResourceBundle(const std::string& locale);
|
||||||
|
@ -51,6 +55,7 @@ class AtomMainDelegate : public content::ContentMainDelegate {
|
||||||
std::unique_ptr<content::ContentGpuClient> gpu_client_;
|
std::unique_ptr<content::ContentGpuClient> gpu_client_;
|
||||||
std::unique_ptr<content::ContentRendererClient> renderer_client_;
|
std::unique_ptr<content::ContentRendererClient> renderer_client_;
|
||||||
std::unique_ptr<content::ContentUtilityClient> utility_client_;
|
std::unique_ptr<content::ContentUtilityClient> utility_client_;
|
||||||
|
std::unique_ptr<tracing::TracingSamplerProfiler> tracing_sampler_profiler_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(AtomMainDelegate);
|
DISALLOW_COPY_AND_ASSIGN(AtomMainDelegate);
|
||||||
};
|
};
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include "services/device/public/mojom/constants.mojom.h"
|
#include "services/device/public/mojom/constants.mojom.h"
|
||||||
#include "services/network/public/cpp/features.h"
|
#include "services/network/public/cpp/features.h"
|
||||||
#include "services/service_manager/public/cpp/connector.h"
|
#include "services/service_manager/public/cpp/connector.h"
|
||||||
|
#include "services/tracing/public/cpp/stack_sampling/tracing_sampler_profiler.h"
|
||||||
#include "shell/app/atom_main_delegate.h"
|
#include "shell/app/atom_main_delegate.h"
|
||||||
#include "shell/browser/api/atom_api_app.h"
|
#include "shell/browser/api/atom_api_app.h"
|
||||||
#include "shell/browser/atom_browser_client.h"
|
#include "shell/browser/atom_browser_client.h"
|
||||||
|
@ -389,6 +390,12 @@ int AtomBrowserMainParts::PreCreateThreads() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AtomBrowserMainParts::PostCreateThreads() {
|
||||||
|
base::PostTask(
|
||||||
|
FROM_HERE, {content::BrowserThread::IO},
|
||||||
|
base::BindOnce(&tracing::TracingSamplerProfiler::CreateOnChildThread));
|
||||||
|
}
|
||||||
|
|
||||||
void AtomBrowserMainParts::PostDestroyThreads() {
|
void AtomBrowserMainParts::PostDestroyThreads() {
|
||||||
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
||||||
extensions_browser_client_.reset();
|
extensions_browser_client_.reset();
|
||||||
|
|
|
@ -92,6 +92,7 @@ class AtomBrowserMainParts : public content::BrowserMainParts {
|
||||||
void PostMainMessageLoopStart() override;
|
void PostMainMessageLoopStart() override;
|
||||||
void PostMainMessageLoopRun() override;
|
void PostMainMessageLoopRun() override;
|
||||||
void PreMainMessageLoopStart() override;
|
void PreMainMessageLoopStart() override;
|
||||||
|
void PostCreateThreads() override;
|
||||||
void PostDestroyThreads() override;
|
void PostDestroyThreads() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue