[Webkit-unassigned] [Bug 30707] WebInspector: Refactors InspectorTimelineAgent to eliminate TimelineItem classes

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Oct 23 07:37:54 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=30707


Pavel Feldman <pfeldman at chromium.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #41715|review?                     |review-
               Flag|                            |




--- Comment #2 from Pavel Feldman <pfeldman at chromium.org>  2009-10-23 07:37:54 PDT ---
(From update of attachment 41715)
I see how lack of getters hurts you, sorry about that - we should probably
implement those. It would be great if you made the stack explicit other than
encapuslating it into your new class. It would look really short then, no heap
allocations, brought back assert. What do I miss, why the additional
complexity?

struct TimelineEventEntry {
    public TimelineEvent(object, children, type) : object(object),
children(children), type(type) {}
    ScriptObject object;
    ScriptArray children;
    int type;
}

Vector< TimelineEventEntry > m_eventStack;


InspectorTimelineAgent::willRecalculateStyle()
{
    pushTimelineItem(TimelineItemFactory::createGenericTimelineItem(m_frontend,
currentTimeInMilliseconds()), RecalculateStylesTimelineItemType);
}

InspectorTimelineAgent::didRecalculateStyle()
{
    popTimelineItem(RecalculateStylesTimelineItemType);
}

InspectorTimelineAgent::pushTimelineItem(ScriptObject event, int type)
{
    ScriptArray children = m_frontend->newScriptArray();
    event.set("type", type);
    event.set("children", children);
    m_eventStack.append(TimelineEventEntry(event, children, type));
}

InspectorTimelineAgent::popTimelineItem(int type)
{
    TimelineEventEntry event = m_eventStack.last();
    m_eventStack.removeLast();
    ASSERT(event.type == type);
    event.object.set("endTime", currentTimeInMilliseconds());

    if (m_eventStack.size()) {
        TimelineEventEntry parent = m_eventStack.last();
        parent.children.set(parent.children.length(), event.object);
    } else {
        m_frontend->addItemToTimeline(event.object);
    }
}

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list