void V8ProfilerAgentImpl::consoleProfileEnd(const String16& title) { if (!m_enabled) return; String16 id; String16 resolvedTitle; // Take last started profile if no title was passed. if (title.isEmpty()) { if (m_startedProfiles.empty()) return; id = m_startedProfiles.back().m_id; resolvedTitle = m_startedProfiles.back().m_title; m_startedProfiles.pop_back(); } else { for (size_t i = 0; i < m_startedProfiles.size(); i++) { if (m_startedProfiles[i].m_title == title) { resolvedTitle = title; id = m_startedProfiles[i].m_id; m_startedProfiles.erase(m_startedProfiles.begin() + i); break; } } if (id.isEmpty()) return; } std::unique_ptr<protocol::Profiler::CPUProfile> profile = stopProfiling(id, true); if (!profile) return; std::unique_ptr<protocol::Debugger::Location> location = currentDebugLocation(m_session->debugger()); m_frontend.consoleProfileFinished(id, std::move(location), std::move(profile), resolvedTitle); }
void V8ProfilerAgentImpl::consoleProfileEnd(const String& title) { ASSERT(m_frontend && m_enabled); String id; String resolvedTitle; // Take last started profile if no title was passed. if (title.isNull()) { if (m_startedProfiles.isEmpty()) return; id = m_startedProfiles.last().m_id; resolvedTitle = m_startedProfiles.last().m_title; m_startedProfiles.removeLast(); } else { for (size_t i = 0; i < m_startedProfiles.size(); i++) { if (m_startedProfiles[i].m_title == title) { resolvedTitle = title; id = m_startedProfiles[i].m_id; m_startedProfiles.remove(i); break; } } if (id.isEmpty()) return; } RefPtr<TypeBuilder::Profiler::CPUProfile> profile = stopProfiling(id, true); if (!profile) return; RefPtr<TypeBuilder::Debugger::Location> location = currentDebugLocation(); m_frontend->consoleProfileFinished(id, location, profile, resolvedTitle.isNull() ? 0 : &resolvedTitle); }
void V8ProfilerAgentImpl::consoleProfile(const String& title) { ASSERT(m_frontend && m_enabled); String id = nextProfileId(); m_startedProfiles.append(ProfileDescriptor(id, title)); startProfiling(id); m_frontend->consoleProfileStarted(id, currentDebugLocation(), title.isNull() ? 0 : &title); }
void V8ProfilerAgentImpl::consoleProfile(const String16& title) { if (!m_enabled) return; String16 id = nextProfileId(); m_startedProfiles.push_back(ProfileDescriptor(id, title)); startProfiling(id); m_frontend.consoleProfileStarted(id, currentDebugLocation(m_session->debugger()), title); }