Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: refactor V8ProfilerConnection to be more reusable #27475

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/env-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -673,16 +673,16 @@ Environment::cpu_profiler_connection() {
return cpu_profiler_connection_.get();
}

inline void Environment::set_cpu_profile_path(const std::string& path) {
cpu_profile_path_ = path;
inline void Environment::set_cpu_prof_name(const std::string& name) {
cpu_prof_name_ = name;
}

inline const std::string& Environment::cpu_profile_path() const {
return cpu_profile_path_;
inline const std::string& Environment::cpu_prof_name() const {
return cpu_prof_name_;
}

inline void Environment::set_cpu_prof_dir(const std::string& path) {
cpu_prof_dir_ = path;
inline void Environment::set_cpu_prof_dir(const std::string& dir) {
cpu_prof_dir_ = dir;
}

inline const std::string& Environment::cpu_prof_dir() const {
Expand Down
14 changes: 0 additions & 14 deletions src/env.cc
Original file line number Diff line number Diff line change
Expand Up @@ -907,20 +907,6 @@ void Environment::stop_sub_worker_contexts() {

#if HAVE_INSPECTOR

void Environment::InitializeCPUProfDir(const std::string& dir) {
if (!dir.empty()) {
cpu_prof_dir_ = dir;
return;
}
char cwd[CWD_BUFSIZE];
size_t size = CWD_BUFSIZE;
int err = uv_cwd(cwd, &size);
// TODO(joyeecheung): fallback to exec path / argv[0]
CHECK_EQ(err, 0);
CHECK_GT(size, 0);
cpu_prof_dir_ = cwd;
}

#endif // HAVE_INSPECTOR

void MemoryTracker::TrackField(const char* edge_name,
Expand Down
10 changes: 4 additions & 6 deletions src/env.h
Original file line number Diff line number Diff line change
Expand Up @@ -1139,13 +1139,11 @@ class Environment : public MemoryRetainer {
std::unique_ptr<profiler::V8CpuProfilerConnection> connection);
profiler::V8CpuProfilerConnection* cpu_profiler_connection();

inline void set_cpu_profile_path(const std::string& path);
inline const std::string& cpu_profile_path() const;
inline void set_cpu_prof_name(const std::string& name);
inline const std::string& cpu_prof_name() const;

inline void set_cpu_prof_dir(const std::string& path);
inline void set_cpu_prof_dir(const std::string& dir);
inline const std::string& cpu_prof_dir() const;

void InitializeCPUProfDir(const std::string& dir);
#endif // HAVE_INSPECTOR

private:
Expand Down Expand Up @@ -1183,7 +1181,7 @@ class Environment : public MemoryRetainer {
std::unique_ptr<profiler::V8CpuProfilerConnection> cpu_profiler_connection_;
std::string coverage_directory_;
std::string cpu_prof_dir_;
std::string cpu_profile_path_;
std::string cpu_prof_name_;
#endif // HAVE_INSPECTOR

std::shared_ptr<EnvironmentOptions> options_;
Expand Down
Loading