Index: src/inspector/V8ProfilerAgentImpl.cpp |
diff --git a/src/inspector/V8ProfilerAgentImpl.cpp b/src/inspector/V8ProfilerAgentImpl.cpp |
index c9c9cd61b9023f1ed9e5bd8df4cac246b712c090..54fb50b8d9e3f28a62136cd13109014ffd25a091 100644 |
--- a/src/inspector/V8ProfilerAgentImpl.cpp |
+++ b/src/inspector/V8ProfilerAgentImpl.cpp |
@@ -16,9 +16,6 @@ |
#include <vector> |
-#define ENSURE_V8_VERSION(major, minor) \ |
- (V8_MAJOR_VERSION * 1000 + V8_MINOR_VERSION >= (major)*1000 + (minor)) |
- |
namespace v8_inspector { |
namespace ProfilerAgentState { |
@@ -162,9 +159,7 @@ V8ProfilerAgentImpl::V8ProfilerAgentImpl( |
m_recordingCPUProfile(false) {} |
V8ProfilerAgentImpl::~V8ProfilerAgentImpl() { |
-#if ENSURE_V8_VERSION(5, 4) |
if (m_profiler) m_profiler->Dispose(); |
-#endif |
} |
void V8ProfilerAgentImpl::consoleProfile(const String16& title) { |
@@ -209,10 +204,8 @@ void V8ProfilerAgentImpl::consoleProfileEnd(const String16& title) { |
void V8ProfilerAgentImpl::enable(ErrorString*) { |
if (m_enabled) return; |
m_enabled = true; |
-#if ENSURE_V8_VERSION(5, 4) |
DCHECK(!m_profiler); |
m_profiler = v8::CpuProfiler::New(m_isolate); |
-#endif |
m_state->setBoolean(ProfilerAgentState::profilerEnabled, true); |
} |
@@ -222,10 +215,8 @@ void V8ProfilerAgentImpl::disable(ErrorString* errorString) { |
stopProfiling(m_startedProfiles[i - 1].m_id, false); |
m_startedProfiles.clear(); |
stop(nullptr, nullptr); |
-#if ENSURE_V8_VERSION(5, 4) |
m_profiler->Dispose(); |
m_profiler = nullptr; |
-#endif |
m_enabled = false; |
m_state->setBoolean(ProfilerAgentState::profilerEnabled, false); |
} |
@@ -237,7 +228,7 @@ void V8ProfilerAgentImpl::setSamplingInterval(ErrorString* error, |
return; |
} |
m_state->setInteger(ProfilerAgentState::samplingInterval, interval); |
- profiler()->SetSamplingInterval(interval); |
+ m_profiler->SetSamplingInterval(interval); |
} |
void V8ProfilerAgentImpl::restore() { |
@@ -245,13 +236,11 @@ void V8ProfilerAgentImpl::restore() { |
if (!m_state->booleanProperty(ProfilerAgentState::profilerEnabled, false)) |
return; |
m_enabled = true; |
-#if ENSURE_V8_VERSION(5, 4) |
DCHECK(!m_profiler); |
m_profiler = v8::CpuProfiler::New(m_isolate); |
-#endif |
int interval = 0; |
m_state->getInteger(ProfilerAgentState::samplingInterval, &interval); |
- if (interval) profiler()->SetSamplingInterval(interval); |
+ if (interval) m_profiler->SetSamplingInterval(interval); |
if (m_state->booleanProperty(ProfilerAgentState::userInitiatedProfiling, |
false)) { |
ErrorString error; |
@@ -295,14 +284,14 @@ String16 V8ProfilerAgentImpl::nextProfileId() { |
void V8ProfilerAgentImpl::startProfiling(const String16& title) { |
v8::HandleScope handleScope(m_isolate); |
- profiler()->StartProfiling(toV8String(m_isolate, title), true); |
+ m_profiler->StartProfiling(toV8String(m_isolate, title), true); |
} |
std::unique_ptr<protocol::Profiler::Profile> V8ProfilerAgentImpl::stopProfiling( |
const String16& title, bool serialize) { |
v8::HandleScope handleScope(m_isolate); |
v8::CpuProfile* profile = |
- profiler()->StopProfiling(toV8String(m_isolate, title)); |
+ m_profiler->StopProfiling(toV8String(m_isolate, title)); |
if (!profile) return nullptr; |
std::unique_ptr<protocol::Profiler::Profile> result; |
if (serialize) result = createCPUProfile(m_isolate, profile); |
@@ -314,12 +303,4 @@ bool V8ProfilerAgentImpl::isRecording() const { |
return m_recordingCPUProfile || !m_startedProfiles.empty(); |
} |
-v8::CpuProfiler* V8ProfilerAgentImpl::profiler() { |
-#if ENSURE_V8_VERSION(5, 4) |
- return m_profiler; |
-#else |
- return m_isolate->GetCpuProfiler(); |
-#endif |
-} |
- |
} // namespace v8_inspector |