Beispiel #1
0
void Profiler::stopProfiling(ExecState* exec, const UString& title)
{
    ExecState* globalExec = exec->lexicalGlobalObject()->globalExec();
    for (ptrdiff_t i = m_currentProfiles.size() - 1; i >= 0; --i) {
        ProfileGenerator* profileGenerator = m_currentProfiles[i].get();
        if (!profileGenerator->stoppedProfiling() && profileGenerator->originatingGlobalExec() == globalExec && (title.isNull() || profileGenerator->title() == title))
            m_currentProfiles[i]->stopProfiling();
    }
}
Beispiel #2
0
void Profiler::startProfiling(ExecState* exec, const UString& title, ProfilerClient* client)
{
    ASSERT_ARG(exec, exec);

    // Check if we currently have a Profile for this global ExecState and title.
    // If so return early and don't create a new Profile.
    ExecState* globalExec = exec->lexicalGlobalObject()->globalExec();
    for (size_t i = 0; i < m_currentProfiles.size(); ++i) {
        ProfileGenerator* profileGenerator = m_currentProfiles[i].get();
        if (!profileGenerator->stoppedProfiling() && profileGenerator->originatingGlobalExec() == globalExec && profileGenerator->title() == title)
            return;
    }

    s_sharedEnabledProfilerReference = this;
    RefPtr<ProfileGenerator> profileGenerator = ProfileGenerator::create(title, globalExec, exec->lexicalGlobalObject()->profileGroup(), client);
    m_currentProfiles.append(profileGenerator);
}