- Revision
- 132147
- Author
- commit-qu...@webkit.org
- Date
- 2012-10-22 15:36:59 -0700 (Mon, 22 Oct 2012)
Log Message
[User Timing]Integrate with Perforamnce Timeline.
https://bugs.webkit.org/show_bug.cgi?id=91072.
Patch by Pan Deng <pan.d...@intel.com> on 2012-10-22
Reviewed by Tony Gentilcore.
This patch expose user timing entries via performance timeline interface. _javascript_Core custom binding will be another patch
No new tests, user timing test cases have been landed.
* page/Performance.cpp:
(WebCore::Performance::Performance):
(WebCore::Performance::webkitGetEntries):
(WebCore::Performance::webkitGetEntriesByType):
(WebCore::Performance::webkitGetEntriesByName):
* page/PerformanceEntry.h:
(WebCore::PerformanceEntry::startTimeCompareLessThan):
(PerformanceEntry):
* page/PerformanceEntryList.cpp:
(WebCore::PerformanceEntryList::sort):
(WebCore):
* page/PerformanceEntryList.h:
(PerformanceEntryList):
* page/PerformanceUserTiming.cpp:
(WebCore::convertToEntrySequence):
(WebCore):
(WebCore::getEntrySequenceByName):
(WebCore::UserTiming::getMarks):
(WebCore::UserTiming::getMeasures):
* page/PerformanceUserTiming.h:
(UserTiming):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (132146 => 132147)
--- trunk/Source/WebCore/ChangeLog 2012-10-22 22:34:37 UTC (rev 132146)
+++ trunk/Source/WebCore/ChangeLog 2012-10-22 22:36:59 UTC (rev 132147)
@@ -1,5 +1,38 @@
2012-10-22 Pan Deng <pan.d...@intel.com>
+ [User Timing]Integrate with Perforamnce Timeline.
+ https://bugs.webkit.org/show_bug.cgi?id=91072.
+
+ Reviewed by Tony Gentilcore.
+
+ This patch expose user timing entries via performance timeline interface. _javascript_Core custom binding will be another patch
+
+ No new tests, user timing test cases have been landed.
+
+ * page/Performance.cpp:
+ (WebCore::Performance::Performance):
+ (WebCore::Performance::webkitGetEntries):
+ (WebCore::Performance::webkitGetEntriesByType):
+ (WebCore::Performance::webkitGetEntriesByName):
+ * page/PerformanceEntry.h:
+ (WebCore::PerformanceEntry::startTimeCompareLessThan):
+ (PerformanceEntry):
+ * page/PerformanceEntryList.cpp:
+ (WebCore::PerformanceEntryList::sort):
+ (WebCore):
+ * page/PerformanceEntryList.h:
+ (PerformanceEntryList):
+ * page/PerformanceUserTiming.cpp:
+ (WebCore::convertToEntrySequence):
+ (WebCore):
+ (WebCore::getEntrySequenceByName):
+ (WebCore::UserTiming::getMarks):
+ (WebCore::UserTiming::getMeasures):
+ * page/PerformanceUserTiming.h:
+ (UserTiming):
+
+2012-10-22 Pan Deng <pan.d...@intel.com>
+
Modify obsolete code in User Timing
https://bugs.webkit.org/show_bug.cgi?id=99851
Modified: trunk/Source/WebCore/page/Performance.cpp (132146 => 132147)
--- trunk/Source/WebCore/page/Performance.cpp 2012-10-22 22:34:37 UTC (rev 132146)
+++ trunk/Source/WebCore/page/Performance.cpp 2012-10-22 22:36:59 UTC (rev 132147)
@@ -57,7 +57,10 @@
: DOMWindowProperty(frame)
#if ENABLE(RESOURCE_TIMING)
, m_resourceTimingBufferSize(defaultResourceTimingBufferSize)
-#endif
+#endif // ENABLE(RESOURCE_TIMING)
+#if ENABLE(USER_TIMING)
+ , m_userTiming(0)
+#endif // ENABLE(USER_TIMING)
{
}
@@ -108,7 +111,14 @@
entries->appendAll(m_resourceTimingBuffer);
#endif // ENABLE(RESOURCE_TIMING)
- // FIXME: User Timing entries should be handled here. see https://bugs.webkit.org/show_bug.cgi?id=91072
+#if ENABLE(USER_TIMING)
+ if (m_userTiming) {
+ entries->appendAll(m_userTiming->getMarks());
+ entries->appendAll(m_userTiming->getMeasures());
+ }
+#endif // ENABLE(USER_TIMING)
+
+ entries->sort();
return entries;
}
@@ -122,7 +132,16 @@
entries->append(*resource);
#endif // ENABLE(RESOURCE_TIMING)
- // FIXME: User Timing entries should be handled here. see https://bugs.webkit.org/show_bug.cgi?id=91072
+#if ENABLE(USER_TIMING)
+ if (m_userTiming) {
+ if (equalIgnoringCase(entryType, "mark"))
+ entries->appendAll(m_userTiming->getMarks());
+ else if (equalIgnoringCase(entryType, "measure"))
+ entries->appendAll(m_userTiming->getMeasures());
+ }
+#endif // ENABLE(USER_TIMING)
+
+ entries->sort();
return entries;
}
@@ -137,7 +156,16 @@
entries->append(*resource);
#endif // ENABLE(RESOURCE_TIMING)
- // FIXME: User Timing entries should be handled here. see https://bugs.webkit.org/show_bug.cgi?id=91072
+#if ENABLE(USER_TIMING)
+ if (m_userTiming) {
+ if (entryType.isNull() || equalIgnoringCase(entryType, "mark"))
+ entries->appendAll(m_userTiming->getMarks(name));
+ if (entryType.isNull() || equalIgnoringCase(entryType, "measure"))
+ entries->appendAll(m_userTiming->getMeasures(name));
+ }
+#endif // ENABLE(USER_TIMING)
+
+ entries->sort();
return entries;
}
Modified: trunk/Source/WebCore/page/PerformanceEntry.h (132146 => 132147)
--- trunk/Source/WebCore/page/PerformanceEntry.h 2012-10-22 22:34:37 UTC (rev 132146)
+++ trunk/Source/WebCore/page/PerformanceEntry.h 2012-10-22 22:36:59 UTC (rev 132147)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Intel Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -51,6 +52,11 @@
virtual bool isResource() { return false; }
+ static bool startTimeCompareLessThan(PassRefPtr<PerformanceEntry> a, PassRefPtr<PerformanceEntry> b)
+ {
+ return a->startTime() < b->startTime();
+ }
+
protected:
PerformanceEntry(const String& name, const String& entryType, double startTime, double duration);
Modified: trunk/Source/WebCore/page/PerformanceEntryList.cpp (132146 => 132147)
--- trunk/Source/WebCore/page/PerformanceEntryList.cpp 2012-10-22 22:34:37 UTC (rev 132146)
+++ trunk/Source/WebCore/page/PerformanceEntryList.cpp 2012-10-22 22:36:59 UTC (rev 132147)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Intel Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -67,6 +68,11 @@
m_entries.append(entries);
}
+void PerformanceEntryList::sort()
+{
+ std::sort(m_entries.begin(), m_entries.end(), PerformanceEntry::startTimeCompareLessThan);
+}
+
} // namespace WebCore
#endif // ENABLE(WEB_TIMING) && ENABLE(PERFORMANCE_TIMELINE)
Modified: trunk/Source/WebCore/page/PerformanceEntryList.h (132146 => 132147)
--- trunk/Source/WebCore/page/PerformanceEntryList.h 2012-10-22 22:34:37 UTC (rev 132146)
+++ trunk/Source/WebCore/page/PerformanceEntryList.h 2012-10-22 22:36:59 UTC (rev 132147)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Intel Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -53,6 +54,8 @@
void append(PassRefPtr<PerformanceEntry>);
void appendAll(const Vector<RefPtr<PerformanceEntry> >&);
+ void sort();
+
private:
PerformanceEntryList();
Modified: trunk/Source/WebCore/page/PerformanceUserTiming.cpp (132146 => 132147)
--- trunk/Source/WebCore/page/PerformanceUserTiming.cpp 2012-10-22 22:34:37 UTC (rev 132146)
+++ trunk/Source/WebCore/page/PerformanceUserTiming.cpp 2012-10-22 22:36:59 UTC (rev 132147)
@@ -162,6 +162,47 @@
clearPeformanceEntries(m_measuresMap, measureName);
}
+static Vector<RefPtr<PerformanceEntry> > convertToEntrySequence(const PerformanceEntryMap& performanceEntryMap)
+{
+ Vector<RefPtr<PerformanceEntry> > entries;
+
+ for (PerformanceEntryMap::const_iterator it = performanceEntryMap.begin(); it != performanceEntryMap.end(); ++it)
+ entries.append(it->value);
+
+ return entries;
+}
+
+static Vector<RefPtr<PerformanceEntry> > getEntrySequenceByName(const PerformanceEntryMap& performanceEntryMap, const String& name)
+{
+ Vector<RefPtr<PerformanceEntry> > entries;
+
+ PerformanceEntryMap::const_iterator it = performanceEntryMap.find(name);
+ if (it != performanceEntryMap.end())
+ entries.append(it->value);
+
+ return entries;
+}
+
+Vector<RefPtr<PerformanceEntry> > UserTiming::getMarks() const
+{
+ return convertToEntrySequence(m_marksMap);
+}
+
+Vector<RefPtr<PerformanceEntry> > UserTiming::getMarks(const String& name) const
+{
+ return getEntrySequenceByName(m_marksMap, name);
+}
+
+Vector<RefPtr<PerformanceEntry> > UserTiming::getMeasures() const
+{
+ return convertToEntrySequence(m_measuresMap);
+}
+
+Vector<RefPtr<PerformanceEntry> > UserTiming::getMeasures(const String& name) const
+{
+ return getEntrySequenceByName(m_measuresMap, name);
+}
+
} // namespace WebCore
#endif // ENABLE(USER_TIMING)
Modified: trunk/Source/WebCore/page/PerformanceUserTiming.h (132146 => 132147)
--- trunk/Source/WebCore/page/PerformanceUserTiming.h 2012-10-22 22:34:37 UTC (rev 132146)
+++ trunk/Source/WebCore/page/PerformanceUserTiming.h 2012-10-22 22:36:59 UTC (rev 132147)
@@ -55,6 +55,12 @@
void measure(const String& measureName, const String& startMark, const String& endMark, ExceptionCode&);
void clearMeasures(const String& measureName);
+ Vector<RefPtr<PerformanceEntry> > getMarks() const;
+ Vector<RefPtr<PerformanceEntry> > getMeasures() const;
+
+ Vector<RefPtr<PerformanceEntry> > getMarks(const String& name) const;
+ Vector<RefPtr<PerformanceEntry> > getMeasures(const String& name) const;
+
private:
explicit UserTiming(Performance*);
static HashMap<String, NavigationTimingFunction> m_restrictedKeyMap;