- Revision
- 121980
- Author
- [email protected]
- Date
- 2012-07-06 09:41:00 -0700 (Fri, 06 Jul 2012)
Log Message
Web Inspector: get rid of cancellable records in Timeline, manage frame records explicitly
https://bugs.webkit.org/show_bug.cgi?id=90684
Reviewed by Pavel Feldman.
- drop handling of "cancelable" records;
- keep frame record until other records come (or frame is canceled)
* inspector/InspectorTimelineAgent.cpp:
(WebCore::InspectorTimelineAgent::didBeginFrame):
(WebCore::InspectorTimelineAgent::didCancelFrame):
(WebCore::InspectorTimelineAgent::addRecordToTimeline):
(WebCore::InspectorTimelineAgent::pushCurrentRecord):
(WebCore::InspectorTimelineAgent::commitFrameRecord):
(WebCore::InspectorTimelineAgent::clearRecordStack):
* inspector/InspectorTimelineAgent.h:
(WebCore::InspectorTimelineAgent::TimelineRecordEntry::TimelineRecordEntry):
(TimelineRecordEntry):
(InspectorTimelineAgent):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (121979 => 121980)
--- trunk/Source/WebCore/ChangeLog 2012-07-06 16:35:32 UTC (rev 121979)
+++ trunk/Source/WebCore/ChangeLog 2012-07-06 16:41:00 UTC (rev 121980)
@@ -1,3 +1,25 @@
+2012-07-06 Andrey Kosyakov <[email protected]>
+
+ Web Inspector: get rid of cancellable records in Timeline, manage frame records explicitly
+ https://bugs.webkit.org/show_bug.cgi?id=90684
+
+ Reviewed by Pavel Feldman.
+
+ - drop handling of "cancelable" records;
+ - keep frame record until other records come (or frame is canceled)
+
+ * inspector/InspectorTimelineAgent.cpp:
+ (WebCore::InspectorTimelineAgent::didBeginFrame):
+ (WebCore::InspectorTimelineAgent::didCancelFrame):
+ (WebCore::InspectorTimelineAgent::addRecordToTimeline):
+ (WebCore::InspectorTimelineAgent::pushCurrentRecord):
+ (WebCore::InspectorTimelineAgent::commitFrameRecord):
+ (WebCore::InspectorTimelineAgent::clearRecordStack):
+ * inspector/InspectorTimelineAgent.h:
+ (WebCore::InspectorTimelineAgent::TimelineRecordEntry::TimelineRecordEntry):
+ (TimelineRecordEntry):
+ (InspectorTimelineAgent):
+
2012-07-06 Alexei Filippov <[email protected]>
Web Inspector: Add native memory used by GlyphCache to the snapshot
Modified: trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp (121979 => 121980)
--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp 2012-07-06 16:35:32 UTC (rev 121979)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp 2012-07-06 16:41:00 UTC (rev 121980)
@@ -195,12 +195,13 @@
void InspectorTimelineAgent::didBeginFrame()
{
- pushCancelableRecord(InspectorObject::create(), TimelineRecordType::BeginFrame, 0);
+ m_pendingFrameRecord = TimelineRecordFactory::createGenericRecord(timestamp(), 0);
}
void InspectorTimelineAgent::didCancelFrame()
{
- cancelRecord(TimelineRecordType::BeginFrame);
+ ASSERT(m_pendingFrameRecord);
+ m_pendingFrameRecord.clear();
}
void InspectorTimelineAgent::willCallFunction(const String& scriptName, int scriptLine, Frame* frame)
@@ -438,7 +439,7 @@
void InspectorTimelineAgent::addRecordToTimeline(PassRefPtr<InspectorObject> record, const String& type, const String& frameId)
{
- commitCancelableRecords();
+ commitFrameRecord();
innerAddRecordToTimeline(record, type, frameId);
}
@@ -526,7 +527,7 @@
void InspectorTimelineAgent::pushCurrentRecord(PassRefPtr<InspectorObject> data, const String& type, bool captureCallStack, Frame* frame, bool hasOrphanDetails)
{
pushGCEventRecords();
- commitCancelableRecords();
+ commitFrameRecord();
RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(timestamp(), captureCallStack ? m_maxCallStackDepth : 0);
String frameId;
if (frame && m_pageAgent)
@@ -538,44 +539,17 @@
}
}
-void InspectorTimelineAgent::pushCancelableRecord(PassRefPtr<InspectorObject> data, const String& type, Frame* frame)
+void InspectorTimelineAgent::commitFrameRecord()
{
- RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(timestamp(), 0);
- String frameId;
- if (frame && m_pageAgent)
- frameId = m_pageAgent->frameId(frame);
- m_recordStack.append(TimelineRecordEntry(record.release(), data, 0, type, frameId, true));
-}
-
-void InspectorTimelineAgent::commitCancelableRecords()
-{
- Vector<TimelineRecordEntry> cancelableRecords;
- while (!m_recordStack.isEmpty()) {
- TimelineRecordEntry entry = m_recordStack.last();
- if (!m_recordStack.last().cancelable)
- break;
- m_recordStack.removeLast();
- cancelableRecords.append(entry);
- }
- while (!cancelableRecords.isEmpty()) {
- TimelineRecordEntry entry = cancelableRecords.last();
- cancelableRecords.removeLast();
- entry.record->setObject("data", entry.data);
- innerAddRecordToTimeline(entry.record.release(), entry.type, entry.frameId);
- }
-}
-
-void InspectorTimelineAgent::cancelRecord(const String& type)
-{
- if (m_recordStack.isEmpty())
+ if (!m_pendingFrameRecord)
return;
- TimelineRecordEntry entry = m_recordStack.last();
- if (entry.cancelable && entry.type == type)
- m_recordStack.removeLast();
+
+ innerAddRecordToTimeline(m_pendingFrameRecord.release(), TimelineRecordType::BeginFrame, "");
}
void InspectorTimelineAgent::clearRecordStack()
{
+ m_pendingFrameRecord.clear();
m_recordStack.clear();
m_id++;
}
Modified: trunk/Source/WebCore/inspector/InspectorTimelineAgent.h (121979 => 121980)
--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.h 2012-07-06 16:35:32 UTC (rev 121979)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.h 2012-07-06 16:41:00 UTC (rev 121980)
@@ -148,8 +148,8 @@
private:
struct TimelineRecordEntry {
- TimelineRecordEntry(PassRefPtr<InspectorObject> record, PassRefPtr<InspectorObject> data, PassRefPtr<InspectorArray> children, const String& type, const String& frameId, bool cancelable = false)
- : record(record), data(data), children(children), type(type), frameId(frameId), cancelable(cancelable)
+ TimelineRecordEntry(PassRefPtr<InspectorObject> record, PassRefPtr<InspectorObject> data, PassRefPtr<InspectorArray> children, const String& type, const String& frameId)
+ : record(record), data(data), children(children), type(type), frameId(frameId)
{
}
RefPtr<InspectorObject> record;
@@ -157,19 +157,16 @@
RefPtr<InspectorArray> children;
String type;
String frameId;
- bool cancelable;
};
InspectorTimelineAgent(InstrumentingAgents*, InspectorPageAgent*, InspectorState*, InspectorType, InspectorClient*);
void pushCurrentRecord(PassRefPtr<InspectorObject>, const String& type, bool captureCallStack, Frame*, bool hasOrphanDetails = false);
void setHeapSizeStatistic(InspectorObject* record);
-
+
void didCompleteCurrentRecord(const String& type);
+ void commitFrameRecord();
void appendRecord(PassRefPtr<InspectorObject> data, const String& type, bool captureCallStack, Frame*);
- void pushCancelableRecord(PassRefPtr<InspectorObject>, const String& type, Frame*);
- void commitCancelableRecords();
- void cancelRecord(const String& type);
void addRecordToTimeline(PassRefPtr<InspectorObject>, const String& type, const String& frameId);
void innerAddRecordToTimeline(PassRefPtr<InspectorObject>, const String& type, const String& frameId);
@@ -200,6 +197,7 @@
GCEvents m_gcEvents;
int m_maxCallStackDepth;
unsigned m_orphanEventsEnabledStackMark;
+ RefPtr<InspectorObject> m_pendingFrameRecord;
InspectorType m_inspectorType;
InspectorClient* m_client;
};