@@ -208,7 +208,7 @@ void V8ProfilerAgentImpl::enable(ErrorString*) {
208208 if (m_enabled) return ;
209209 m_enabled = true ;
210210 DCHECK (!m_profiler);
211- m_profiler = v8::CpuProfiler::New ( m_isolate);
211+ m_profiler = m_isolate-> GetCpuProfiler ( );
212212 m_state->setBoolean (ProfilerAgentState::profilerEnabled, true );
213213}
214214
@@ -218,8 +218,9 @@ void V8ProfilerAgentImpl::disable(ErrorString* errorString) {
218218 stopProfiling (m_startedProfiles[i - 1 ].m_id , false );
219219 m_startedProfiles.clear ();
220220 stop (nullptr , nullptr );
221- m_profiler-> Dispose ();
221+
222222 m_profiler = nullptr ;
223+
223224 m_enabled = false ;
224225 m_state->setBoolean (ProfilerAgentState::profilerEnabled, false );
225226}
@@ -240,7 +241,7 @@ void V8ProfilerAgentImpl::restore() {
240241 return ;
241242 m_enabled = true ;
242243 DCHECK (!m_profiler);
243- m_profiler = v8::CpuProfiler::New ( m_isolate);
244+ m_profiler = m_isolate-> GetCpuProfiler ( );
244245 int interval = 0 ;
245246 m_state->getInteger (ProfilerAgentState::samplingInterval, &interval);
246247 if (interval) m_profiler->SetSamplingInterval (interval);
@@ -282,8 +283,10 @@ void V8ProfilerAgentImpl::stop(
282283}
283284
284285String16 V8ProfilerAgentImpl::nextProfileId () {
285- return String16::fromInteger (
286- v8::base::NoBarrier_AtomicIncrement (&s_lastProfileId, 1 ));
286+ const int one = 1 ;
287+ int oldValue = __sync_fetch_and_add (&s_lastProfileId, one);
288+
289+ return String16::fromInteger (s_lastProfileId);
287290}
288291
289292void V8ProfilerAgentImpl::startProfiling (const String16& title) {
0 commit comments