Source/WebCore: [User Timing]Change class name that presented in Javascript for user...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 26 Jan 2013 00:54:33 +0000 (00:54 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 26 Jan 2013 00:54:33 +0000 (00:54 +0000)
https://bugs.webkit.org/show_bug.cgi?id=107925.

Patch by Pan Deng <pan.deng@intel.com> on 2013-01-25
Reviewed by Tony Gentilcore.

In current implementation, class type of user timing entries are PerformanceEntry, according
to W3C spec, they should be PerformanceMark and PerformanceMeasure.

Test: http/tests/w3c/webperf/submission/Intel/user-timing/test_user_timing_entry_type.html

* bindings/v8/custom/V8PerformanceEntryCustom.cpp:
(WebCore::wrap):
* page/PerformanceEntry.h:
(WebCore::PerformanceEntry::isMark):
(WebCore::PerformanceEntry::isMeasure):
* page/PerformanceMark.h:
(WebCore::PerformanceMark::isMark):
(PerformanceMark):
* page/PerformanceMeasure.h:
(WebCore::PerformanceMeasure::isMeasure):
(PerformanceMeasure):

LayoutTests: [User Timing] Class name of user timing entries should be PerformanceMark/PerformanceMeasure.
https://bugs.webkit.org/show_bug.cgi?id=107925.

Patch by Pan Deng <pan.deng@intel.com> on 2013-01-25
Reviewed by Tony Gentilcore.

* http/tests/w3c/webperf/submission/Intel/user-timing/test_user_timing_entry_type-expected.txt: Added.
* http/tests/w3c/webperf/submission/Intel/user-timing/test_user_timing_entry_type.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@140882 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/http/tests/w3c/webperf/submission/Intel/user-timing/test_user_timing_entry_type-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/w3c/webperf/submission/Intel/user-timing/test_user_timing_entry_type.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/bindings/v8/custom/V8PerformanceEntryCustom.cpp
Source/WebCore/page/PerformanceEntry.h
Source/WebCore/page/PerformanceMark.h
Source/WebCore/page/PerformanceMeasure.h

index 92e7f40..42aa489 100644 (file)
@@ -1,3 +1,13 @@
+2013-01-25  Pan Deng  <pan.deng@intel.com>
+
+        [User Timing] Class name of user timing entries should be PerformanceMark/PerformanceMeasure.
+        https://bugs.webkit.org/show_bug.cgi?id=107925.
+
+        Reviewed by Tony Gentilcore.
+
+        * http/tests/w3c/webperf/submission/Intel/user-timing/test_user_timing_entry_type-expected.txt: Added.
+        * http/tests/w3c/webperf/submission/Intel/user-timing/test_user_timing_entry_type.html: Added.
+
 2013-01-24  Ojan Vafai  <ojan@chromium.org>
 
         MathML preferred widths should not depend on layout information
diff --git a/LayoutTests/http/tests/w3c/webperf/submission/Intel/user-timing/test_user_timing_entry_type-expected.txt b/LayoutTests/http/tests/w3c/webperf/submission/Intel/user-timing/test_user_timing_entry_type-expected.txt
new file mode 100644 (file)
index 0000000..9693957
--- /dev/null
@@ -0,0 +1,8 @@
+Description
+
+This test validates the user timing entry type, PerformanceMark and PerformanceMeasure.
+
+
+PASS Class name of mark entry should be PerformanceMark. 
+PASS Class name of measure entry should be PerformanceMeasure. 
+
diff --git a/LayoutTests/http/tests/w3c/webperf/submission/Intel/user-timing/test_user_timing_entry_type.html b/LayoutTests/http/tests/w3c/webperf/submission/Intel/user-timing/test_user_timing_entry_type.html
new file mode 100644 (file)
index 0000000..f25d2e5
--- /dev/null
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <meta charset="utf-8" />
+        <title>user timing entry type</title>
+        <link rel="author" title="Intel" href="http://www.intel.com/" />
+        <link rel="help" href="http://www.w3.org/TR/user-timing/#extensions-performance-interface"/>
+        <script src="/w3c/resources/testharness.js"></script>
+        <script src="/w3c/resources/testharnessreport.js"></script>
+        <script src="/w3c/webperf/resources/webperftestharness.js"></script>
+        <script src="/w3c/webperf/resources/webperftestharnessextension.js"></script>
+    </head>
+    <body>
+        <h1>Description</h1>
+        <p>This test validates the user timing entry type, PerformanceMark and PerformanceMeasure.</p>
+
+        <div id="log"></div>
+        <script>
+        var context = new PerformanceContext(window.performance);
+        context.mark('mark');
+        context.measure('measure');
+        var mark_entry = context.getEntriesByName('mark')[0];
+        var measure_entry = context.getEntriesByName('measure')[0];
+
+        test_equals(Object.prototype.toString.call(mark_entry), '[object PerformanceMark]', 'Class name of mark entry should be PerformanceMark.');
+        test_equals(Object.prototype.toString.call(measure_entry), '[object PerformanceMeasure]', 'Class name of measure entry should be PerformanceMeasure.');
+        </script>
+    </body>
+</html>
index 4d502d4..a42a9fc 100644 (file)
@@ -1,3 +1,27 @@
+2013-01-25  Pan Deng  <pan.deng@intel.com>
+
+        [User Timing]Change class name that presented in Javascript for user timing entry.
+        https://bugs.webkit.org/show_bug.cgi?id=107925.
+
+        Reviewed by Tony Gentilcore.
+
+        In current implementation, class type of user timing entries are PerformanceEntry, according
+        to W3C spec, they should be PerformanceMark and PerformanceMeasure.
+
+        Test: http/tests/w3c/webperf/submission/Intel/user-timing/test_user_timing_entry_type.html
+
+        * bindings/v8/custom/V8PerformanceEntryCustom.cpp:
+        (WebCore::wrap):
+        * page/PerformanceEntry.h:
+        (WebCore::PerformanceEntry::isMark):
+        (WebCore::PerformanceEntry::isMeasure):
+        * page/PerformanceMark.h:
+        (WebCore::PerformanceMark::isMark):
+        (PerformanceMark):
+        * page/PerformanceMeasure.h:
+        (WebCore::PerformanceMeasure::isMeasure):
+        (PerformanceMeasure):
+
 2013-01-24  Roger Fong  <roger_fong@apple.com>
 
         Updated WebCore property sheets and added a WebCore solution file.
index e548c3b..ce98367 100644 (file)
 #if ENABLE(PERFORMANCE_TIMELINE)
 
 #include "Performance.h"
+#include "PerformanceMark.h"
+#include "PerformanceMeasure.h"
 #include "PerformanceResourceTiming.h"
 
 #include "V8PerformanceEntry.h"
+#include "V8PerformanceMark.h"
+#include "V8PerformanceMeasure.h"
 #include "V8PerformanceResourceTiming.h"
 
 #include <wtf/RefPtr.h>
@@ -50,6 +54,15 @@ v8::Handle<v8::Object> wrap(PerformanceEntry* impl, v8::Handle<v8::Object> creat
     if (impl->isResource())
         return wrap(static_cast<PerformanceResourceTiming*>(impl), creationContext, isolate);
 #endif
+
+#if ENABLE(USER_TIMING)
+    if (impl->isMark())
+        return wrap(static_cast<PerformanceMark*>(impl), creationContext, isolate);
+
+    if (impl->isMeasure())
+        return wrap(static_cast<PerformanceMeasure*>(impl), creationContext, isolate);
+#endif
+
     return V8PerformanceEntry::createWrapper(impl, creationContext, isolate);
 }
 
index 4db101d..129a246 100644 (file)
@@ -51,6 +51,8 @@ public:
     double duration() const;
 
     virtual bool isResource() { return false; }
+    virtual bool isMark() { return false; }
+    virtual bool isMeasure() { return false; }
 
     static bool startTimeCompareLessThan(PassRefPtr<PerformanceEntry> a, PassRefPtr<PerformanceEntry> b)
     {
index cc53b00..64b39ab 100644 (file)
@@ -38,6 +38,8 @@ class PerformanceMark : public PerformanceEntry {
 public:
     static PassRefPtr<PerformanceMark> create(const String& name, double startTime) { return adoptRef(new PerformanceMark(name, startTime)); }
 
+    virtual bool isMark() { return true; }
+    
 private:
     PerformanceMark(const String& name, double startTime) : PerformanceEntry(name, "mark", startTime, startTime) { }
     ~PerformanceMark() { }
index b0243d1..6556495 100644 (file)
@@ -38,6 +38,8 @@ class PerformanceMeasure : public PerformanceEntry {
 public:
     static PassRefPtr<PerformanceMeasure> create(const String& name, double startTime, double duration) { return adoptRef(new PerformanceMeasure(name, startTime, duration)); }
 
+    virtual bool isMeasure() { return true; }
+
 private:
     PerformanceMeasure(const String& name, double startTime, double duration) : PerformanceEntry(name, "measure", startTime, duration) { }
     ~PerformanceMeasure() { }