[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75
eric at webkit.org
eric at webkit.org
Thu Oct 29 20:52:10 UTC 2009
The following commit has been merged in the webkit-1.1 branch:
commit 8a39d172f75cb1342dbf07e6cc2272a2fb5af49e
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Oct 26 16:46:48 2009 +0000
2009-10-26 Kelly Norton <knorton at google.com>
Reviewed by Pavel Feldman.
Adds DOMTimer support to InspectorTimelineAgent.
https://bugs.webkit.org/show_bug.cgi?id=30467
* inspector/InspectorTimelineAgent.cpp: Added timer support and fixed some method names.
(WebCore::InspectorTimelineAgent::didDispatchDOMEvent):
(WebCore::InspectorTimelineAgent::didLayout):
(WebCore::InspectorTimelineAgent::didRecalculateStyle):
(WebCore::InspectorTimelineAgent::didPaint):
(WebCore::InspectorTimelineAgent::didWriteHTML):
(WebCore::InspectorTimelineAgent::didInstallTimer): Added.
(WebCore::InspectorTimelineAgent::didRemoveTimer): Added.
(WebCore::InspectorTimelineAgent::willFireTimer): Added.
(WebCore::InspectorTimelineAgent::didFireTimer): Added.
(WebCore::InspectorTimelineAgent::addItemToTimeline): Added.
(WebCore::InspectorTimelineAgent::didCompleteCurrentTimelineItem): Renamed.
* inspector/InspectorTimelineAgent.h:
(WebCore::):
* inspector/TimelineItemFactory.cpp: Add methods for timer-related ScriptObjects.
(WebCore::TimelineItemFactory::createGenericTimerTimelineItem):
(WebCore::TimelineItemFactory::createTimerInstallTimelineItem):
* inspector/TimelineItemFactory.h:
* page/DOMTimer.cpp: Added instrumentation points.
(WebCore::DOMTimer::install):
(WebCore::DOMTimer::removeById):
(WebCore::DOMTimer::fired):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50068 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 62915eb..b1621b4 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,33 @@
+2009-10-26 Kelly Norton <knorton at google.com>
+
+ Reviewed by Pavel Feldman.
+
+ Adds DOMTimer support to InspectorTimelineAgent.
+ https://bugs.webkit.org/show_bug.cgi?id=30467
+
+ * inspector/InspectorTimelineAgent.cpp: Added timer support and fixed some method names.
+ (WebCore::InspectorTimelineAgent::didDispatchDOMEvent):
+ (WebCore::InspectorTimelineAgent::didLayout):
+ (WebCore::InspectorTimelineAgent::didRecalculateStyle):
+ (WebCore::InspectorTimelineAgent::didPaint):
+ (WebCore::InspectorTimelineAgent::didWriteHTML):
+ (WebCore::InspectorTimelineAgent::didInstallTimer): Added.
+ (WebCore::InspectorTimelineAgent::didRemoveTimer): Added.
+ (WebCore::InspectorTimelineAgent::willFireTimer): Added.
+ (WebCore::InspectorTimelineAgent::didFireTimer): Added.
+ (WebCore::InspectorTimelineAgent::addItemToTimeline): Added.
+ (WebCore::InspectorTimelineAgent::didCompleteCurrentTimelineItem): Renamed.
+ * inspector/InspectorTimelineAgent.h:
+ (WebCore::):
+ * inspector/TimelineItemFactory.cpp: Add methods for timer-related ScriptObjects.
+ (WebCore::TimelineItemFactory::createGenericTimerTimelineItem):
+ (WebCore::TimelineItemFactory::createTimerInstallTimelineItem):
+ * inspector/TimelineItemFactory.h:
+ * page/DOMTimer.cpp: Added instrumentation points.
+ (WebCore::DOMTimer::install):
+ (WebCore::DOMTimer::removeById):
+ (WebCore::DOMTimer::fired):
+
2009-10-26 Simon Fraser <simon.fraser at apple.com>
Reviewed by Sam Weinig.
diff --git a/WebCore/inspector/InspectorTimelineAgent.cpp b/WebCore/inspector/InspectorTimelineAgent.cpp
index d1d54f3..4a3409e 100644
--- a/WebCore/inspector/InspectorTimelineAgent.cpp
+++ b/WebCore/inspector/InspectorTimelineAgent.cpp
@@ -58,7 +58,7 @@ void InspectorTimelineAgent::willDispatchDOMEvent(const Event& event)
void InspectorTimelineAgent::didDispatchDOMEvent()
{
- didCompleteCurrentRecord(DOMDispatchTimelineItemType);
+ didCompleteCurrentTimelineItem(DOMDispatchTimelineItemType);
}
void InspectorTimelineAgent::willLayout()
@@ -68,7 +68,7 @@ void InspectorTimelineAgent::willLayout()
void InspectorTimelineAgent::didLayout()
{
- didCompleteCurrentRecord(LayoutTimelineItemType);
+ didCompleteCurrentTimelineItem(LayoutTimelineItemType);
}
void InspectorTimelineAgent::willRecalculateStyle()
@@ -78,7 +78,7 @@ void InspectorTimelineAgent::willRecalculateStyle()
void InspectorTimelineAgent::didRecalculateStyle()
{
- didCompleteCurrentRecord(RecalculateStylesTimelineItemType);
+ didCompleteCurrentTimelineItem(RecalculateStylesTimelineItemType);
}
void InspectorTimelineAgent::willPaint()
@@ -88,7 +88,7 @@ void InspectorTimelineAgent::willPaint()
void InspectorTimelineAgent::didPaint()
{
- didCompleteCurrentRecord(PaintTimelineItemType);
+ didCompleteCurrentTimelineItem(PaintTimelineItemType);
}
void InspectorTimelineAgent::willWriteHTML()
@@ -98,7 +98,30 @@ void InspectorTimelineAgent::willWriteHTML()
void InspectorTimelineAgent::didWriteHTML()
{
- didCompleteCurrentRecord(ParseHTMLTimelineItemType);
+ didCompleteCurrentTimelineItem(ParseHTMLTimelineItemType);
+}
+
+void InspectorTimelineAgent::didInstallTimer(int timerId, int timeout, bool singleShot)
+{
+ addItemToTimeline(TimelineItemFactory::createTimerInstallTimelineItem(m_frontend, currentTimeInMilliseconds(), timerId,
+ timeout, singleShot), TimerInstallTimelineItemType);
+}
+
+void InspectorTimelineAgent::didRemoveTimer(int timerId)
+{
+ addItemToTimeline(TimelineItemFactory::createGenericTimerTimelineItem(m_frontend, currentTimeInMilliseconds(), timerId),
+ TimerRemoveTimelineItemType);
+}
+
+void InspectorTimelineAgent::willFireTimer(int timerId)
+{
+ pushCurrentTimelineItem(TimelineItemFactory::createGenericTimerTimelineItem(m_frontend, currentTimeInMilliseconds(), timerId),
+ TimerFireTimelineItemType);
+}
+
+void InspectorTimelineAgent::didFireTimer()
+{
+ didCompleteCurrentTimelineItem(TimerFireTimelineItemType);
}
void InspectorTimelineAgent::reset()
@@ -106,21 +129,26 @@ void InspectorTimelineAgent::reset()
m_itemStack.clear();
}
-void InspectorTimelineAgent::didCompleteCurrentRecord(TimelineItemType type)
+void InspectorTimelineAgent::addItemToTimeline(ScriptObject item, TimelineItemType type)
{
+ item.set("type", type);
+ if (m_itemStack.isEmpty())
+ m_frontend->addItemToTimeline(item);
+ else {
+ TimelineItemEntry parent = m_itemStack.last();
+ parent.children.set(parent.children.length(), item);
+ }
+}
+
+void InspectorTimelineAgent::didCompleteCurrentTimelineItem(TimelineItemType type)
+{
+ ASSERT(!m_itemStack.isEmpty());
TimelineItemEntry entry = m_itemStack.last();
m_itemStack.removeLast();
ASSERT(entry.type == type);
- entry.item.set("type", type);
entry.item.set("children", entry.children);
entry.item.set("endTime", currentTimeInMilliseconds());
-
- if (m_itemStack.isEmpty()) {
- m_frontend->addItemToTimeline(entry.item);
- } else {
- TimelineItemEntry parent = m_itemStack.last();
- parent.children.set(parent.children.length(), entry.item);
- }
+ addItemToTimeline(entry.item, type);
}
double InspectorTimelineAgent::currentTimeInMilliseconds()
diff --git a/WebCore/inspector/InspectorTimelineAgent.h b/WebCore/inspector/InspectorTimelineAgent.h
index ceefed7..0bf3965 100644
--- a/WebCore/inspector/InspectorTimelineAgent.h
+++ b/WebCore/inspector/InspectorTimelineAgent.h
@@ -31,9 +31,10 @@
#ifndef InspectorTimelineAgent_h
#define InspectorTimelineAgent_h
+#include "Document.h"
+#include "ScriptExecutionContext.h"
#include "ScriptObject.h"
#include "ScriptArray.h"
-
#include <wtf/Vector.h>
namespace WebCore {
@@ -47,6 +48,9 @@ namespace WebCore {
RecalculateStylesTimelineItemType = 2,
PaintTimelineItemType = 3,
ParseHTMLTimelineItemType = 4,
+ TimerInstallTimelineItemType = 5,
+ TimerRemoveTimelineItemType = 6,
+ TimerFireTimelineItemType = 7,
};
class InspectorTimelineAgent {
@@ -59,15 +63,25 @@ namespace WebCore {
// Methods called from WebCore.
void willDispatchDOMEvent(const Event&);
void didDispatchDOMEvent();
+
void willLayout();
void didLayout();
+
void willRecalculateStyle();
void didRecalculateStyle();
+
void willPaint();
void didPaint();
- void didWriteHTML();
+
void willWriteHTML();
+ void didWriteHTML();
+
+ void didInstallTimer(int timerId, int timeout, bool singleShot);
+ void didRemoveTimer(int timerId);
+ void willFireTimer(int timerId);
+ void didFireTimer();
+ static InspectorTimelineAgent* retrieve(ScriptExecutionContext*);
private:
struct TimelineItemEntry {
TimelineItemEntry(ScriptObject item, ScriptArray children, TimelineItemType type) : item(item), children(children), type(type) { }
@@ -80,13 +94,22 @@ namespace WebCore {
static double currentTimeInMilliseconds();
- void didCompleteCurrentRecord(TimelineItemType);
+ void didCompleteCurrentTimelineItem(TimelineItemType);
+ void addItemToTimeline(ScriptObject, TimelineItemType);
+
InspectorFrontend* m_frontend;
Vector< TimelineItemEntry > m_itemStack;
};
+inline InspectorTimelineAgent* InspectorTimelineAgent::retrieve(ScriptExecutionContext* context)
+{
+ if (context->isDocument())
+ return static_cast<Document*>(context)->inspectorTimelineAgent();
+ return 0;
+}
+
} // namespace WebCore
#endif // !defined(InspectorTimelineAgent_h)
diff --git a/WebCore/inspector/TimelineItemFactory.cpp b/WebCore/inspector/TimelineItemFactory.cpp
index d10bd51..3255e78 100644
--- a/WebCore/inspector/TimelineItemFactory.cpp
+++ b/WebCore/inspector/TimelineItemFactory.cpp
@@ -57,6 +57,28 @@ ScriptObject TimelineItemFactory::createDOMDispatchTimelineItem(InspectorFronten
return item;
}
+// static
+ScriptObject TimelineItemFactory::createGenericTimerTimelineItem(InspectorFrontend* frontend, double startTime, int timerId)
+{
+ ScriptObject item = createGenericTimelineItem(frontend, startTime);
+ ScriptObject data = frontend->newScriptObject();
+ data.set("timerId", timerId);
+ item.set("data", data);
+ return item;
+}
+
+// static
+ScriptObject TimelineItemFactory::createTimerInstallTimelineItem(InspectorFrontend* frontend, double startTime, int timerId, int timeout, bool singleShot)
+{
+ ScriptObject item = createGenericTimelineItem(frontend, startTime);
+ ScriptObject data = frontend->newScriptObject();
+ data.set("timerId", timerId);
+ data.set("timeout", timeout);
+ data.set("singleShot", singleShot);
+ item.set("data", data);
+ return item;
+}
+
} // namespace WebCore
#endif // ENABLE(INSPECTOR)
diff --git a/WebCore/inspector/TimelineItemFactory.h b/WebCore/inspector/TimelineItemFactory.h
index 395d645..b41f769 100644
--- a/WebCore/inspector/TimelineItemFactory.h
+++ b/WebCore/inspector/TimelineItemFactory.h
@@ -40,8 +40,13 @@ namespace WebCore {
class TimelineItemFactory {
public:
static ScriptObject createGenericTimelineItem(InspectorFrontend*, double startTime);
+
+ static ScriptObject createDOMDispatchTimelineItem(InspectorFrontend*, double startTime, const Event&);
+
+ static ScriptObject createGenericTimerTimelineItem(InspectorFrontend*, double startTime, int timerId);
+
+ static ScriptObject createTimerInstallTimelineItem(InspectorFrontend*, double startTime, int timerId, int timeout, bool singleShot);
- static ScriptObject createDOMDispatchTimelineItem(InspectorFrontend*, double startTime, const Event&);
private:
TimelineItemFactory() { }
};
diff --git a/WebCore/inspector/front-end/TimelineAgent.js b/WebCore/inspector/front-end/TimelineAgent.js
index a310c38..edd97a9 100644
--- a/WebCore/inspector/front-end/TimelineAgent.js
+++ b/WebCore/inspector/front-end/TimelineAgent.js
@@ -38,7 +38,10 @@ WebInspector.TimelineAgent.ItemType = {
Layout : 1,
RecalculateStyles : 2,
Paint : 3,
- ParseHTML : 4
+ ParseHTML : 4,
+ TimerInstall : 5,
+ TimerRemove : 6,
+ TimerFire : 7,
};
WebInspector.addItemToTimeline = function(record) {
diff --git a/WebCore/page/DOMTimer.cpp b/WebCore/page/DOMTimer.cpp
index dd1e842..83bcb02 100644
--- a/WebCore/page/DOMTimer.cpp
+++ b/WebCore/page/DOMTimer.cpp
@@ -27,6 +27,7 @@
#include "config.h"
#include "DOMTimer.h"
+#include "InspectorTimelineAgent.h"
#include "ScheduledAction.h"
#include "ScriptExecutionContext.h"
#include <wtf/HashSet.h>
@@ -87,6 +88,12 @@ int DOMTimer::install(ScriptExecutionContext* context, ScheduledAction* action,
// The timer is deleted when context is deleted (DOMTimer::contextDestroyed) or explicitly via DOMTimer::removeById(),
// or if it is a one-time timer and it has fired (DOMTimer::fired).
DOMTimer* timer = new DOMTimer(context, action, timeout, singleShot);
+
+#if ENABLE(INSPECTOR)
+ if (InspectorTimelineAgent* timelineAgent = InspectorTimelineAgent::retrieve(context))
+ timelineAgent->didInstallTimer(timer->m_timeoutId, timeout, singleShot);
+#endif
+
return timer->m_timeoutId;
}
@@ -97,6 +104,12 @@ void DOMTimer::removeById(ScriptExecutionContext* context, int timeoutId)
// respectively
if (timeoutId <= 0)
return;
+
+#if ENABLE(INSPECTOR)
+ if (InspectorTimelineAgent* timelineAgent = InspectorTimelineAgent::retrieve(context))
+ timelineAgent->didRemoveTimer(timeoutId);
+#endif
+
delete context->findTimeout(timeoutId);
}
@@ -105,6 +118,12 @@ void DOMTimer::fired()
ScriptExecutionContext* context = scriptExecutionContext();
timerNestingLevel = m_nestingLevel;
+#if ENABLE(INSPECTOR)
+ InspectorTimelineAgent* timelineAgent = InspectorTimelineAgent::retrieve(context);
+ if (timelineAgent)
+ timelineAgent->willFireTimer(m_timeoutId);
+#endif
+
// Simple case for non-one-shot timers.
if (isActive()) {
if (repeatInterval() && repeatInterval() < s_minTimerInterval) {
@@ -115,6 +134,10 @@ void DOMTimer::fired()
// No access to member variables after this point, it can delete the timer.
m_action->execute(context);
+#if ENABLE(INSPECTOR)
+ if (timelineAgent)
+ timelineAgent->didFireTimer();
+#endif
return;
}
@@ -125,6 +148,10 @@ void DOMTimer::fired()
delete this;
action->execute(context);
+#if ENABLE(INSPECTOR)
+ if (timelineAgent)
+ timelineAgent->didFireTimer();
+#endif
delete action;
timerNestingLevel = 0;
}
diff --git a/WebCore/page/DOMTimer.h b/WebCore/page/DOMTimer.h
index 3c65258..460430f 100644
--- a/WebCore/page/DOMTimer.h
+++ b/WebCore/page/DOMTimer.h
@@ -33,6 +33,7 @@
namespace WebCore {
+ class InspectorTimelineAgent;
class ScheduledAction;
class DOMTimer : public TimerBase, public ActiveDOMObject {
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list