Changeset 132147 in webkit


Ignore:
Timestamp:
Oct 22, 2012 3:36:59 PM (11 years ago)
Author:
commit-queue@webkit.org
Message:

[User Timing]Integrate with Perforamnce Timeline.
https://bugs.webkit.org/show_bug.cgi?id=91072.

Patch by Pan Deng <pan.deng@intel.com> on 2012-10-22
Reviewed by Tony Gentilcore.

This patch expose user timing entries via performance timeline interface. JavaScriptCore 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):

Location:
trunk/Source/WebCore
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r132146 r132147  
     12012-10-22  Pan Deng  <pan.deng@intel.com>
     2
     3        [User Timing]Integrate with Perforamnce Timeline.
     4        https://bugs.webkit.org/show_bug.cgi?id=91072.
     5
     6        Reviewed by Tony Gentilcore.
     7
     8        This patch expose user timing entries via performance timeline interface. JavaScriptCore custom binding will be another patch
     9
     10        No new tests, user timing test cases have been landed.
     11
     12        * page/Performance.cpp:
     13        (WebCore::Performance::Performance):
     14        (WebCore::Performance::webkitGetEntries):
     15        (WebCore::Performance::webkitGetEntriesByType):
     16        (WebCore::Performance::webkitGetEntriesByName):
     17        * page/PerformanceEntry.h:
     18        (WebCore::PerformanceEntry::startTimeCompareLessThan):
     19        (PerformanceEntry):
     20        * page/PerformanceEntryList.cpp:
     21        (WebCore::PerformanceEntryList::sort):
     22        (WebCore):
     23        * page/PerformanceEntryList.h:
     24        (PerformanceEntryList):
     25        * page/PerformanceUserTiming.cpp:
     26        (WebCore::convertToEntrySequence):
     27        (WebCore):
     28        (WebCore::getEntrySequenceByName):
     29        (WebCore::UserTiming::getMarks):
     30        (WebCore::UserTiming::getMeasures):
     31        * page/PerformanceUserTiming.h:
     32        (UserTiming):
     33
    1342012-10-22  Pan Deng  <pan.deng@intel.com>
    235
  • trunk/Source/WebCore/page/Performance.cpp

    r131829 r132147  
    5858#if ENABLE(RESOURCE_TIMING)
    5959    , m_resourceTimingBufferSize(defaultResourceTimingBufferSize)
    60 #endif
     60#endif // ENABLE(RESOURCE_TIMING)
     61#if ENABLE(USER_TIMING)
     62    , m_userTiming(0)
     63#endif // ENABLE(USER_TIMING)
    6164{
    6265}
     
    109112#endif // ENABLE(RESOURCE_TIMING)
    110113
    111     // FIXME: User Timing entries should be handled here. see https://bugs.webkit.org/show_bug.cgi?id=91072
     114#if ENABLE(USER_TIMING)
     115    if (m_userTiming) {
     116        entries->appendAll(m_userTiming->getMarks());
     117        entries->appendAll(m_userTiming->getMeasures());
     118    }
     119#endif // ENABLE(USER_TIMING)
     120
     121    entries->sort();
    112122    return entries;
    113123}
     
    123133#endif // ENABLE(RESOURCE_TIMING)
    124134
    125     // FIXME: User Timing entries should be handled here. see https://bugs.webkit.org/show_bug.cgi?id=91072
     135#if ENABLE(USER_TIMING)
     136    if (m_userTiming) {
     137        if (equalIgnoringCase(entryType, "mark"))
     138            entries->appendAll(m_userTiming->getMarks());
     139        else if (equalIgnoringCase(entryType, "measure"))
     140            entries->appendAll(m_userTiming->getMeasures());
     141    }
     142#endif // ENABLE(USER_TIMING)
     143
     144    entries->sort();
    126145    return entries;
    127146}
     
    138157#endif // ENABLE(RESOURCE_TIMING)
    139158
    140     // FIXME: User Timing entries should be handled here. see https://bugs.webkit.org/show_bug.cgi?id=91072
     159#if ENABLE(USER_TIMING)
     160    if (m_userTiming) {
     161        if (entryType.isNull() || equalIgnoringCase(entryType, "mark"))
     162            entries->appendAll(m_userTiming->getMarks(name));
     163        if (entryType.isNull() || equalIgnoringCase(entryType, "measure"))
     164            entries->appendAll(m_userTiming->getMeasures(name));
     165    }
     166#endif // ENABLE(USER_TIMING)
     167
     168    entries->sort();
    141169    return entries;
    142170}
  • trunk/Source/WebCore/page/PerformanceEntry.h

    r120962 r132147  
    11/*
    22 * Copyright (C) 2012 Google Inc. All rights reserved.
     3 * Copyright (C) 2012 Intel Inc. All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    5253    virtual bool isResource() { return false; }
    5354
     55    static bool startTimeCompareLessThan(PassRefPtr<PerformanceEntry> a, PassRefPtr<PerformanceEntry> b)
     56    {
     57        return a->startTime() < b->startTime();
     58    }
     59
    5460protected:
    5561    PerformanceEntry(const String& name, const String& entryType, double startTime, double duration);
  • trunk/Source/WebCore/page/PerformanceEntryList.cpp

    r120962 r132147  
    11/*
    22 * Copyright (C) 2012 Google Inc. All rights reserved.
     3 * Copyright (C) 2012 Intel Inc. All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    6869}
    6970
     71void PerformanceEntryList::sort()
     72{
     73    std::sort(m_entries.begin(), m_entries.end(), PerformanceEntry::startTimeCompareLessThan);
     74}
     75
    7076} // namespace WebCore
    7177
  • trunk/Source/WebCore/page/PerformanceEntryList.h

    r120962 r132147  
    11/*
    22 * Copyright (C) 2012 Google Inc. All rights reserved.
     3 * Copyright (C) 2012 Intel Inc. All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    5455    void appendAll(const Vector<RefPtr<PerformanceEntry> >&);
    5556
     57    void sort();
     58
    5659private:
    5760    PerformanceEntryList();
  • trunk/Source/WebCore/page/PerformanceUserTiming.cpp

    r132146 r132147  
    163163}
    164164
     165static Vector<RefPtr<PerformanceEntry> > convertToEntrySequence(const PerformanceEntryMap& performanceEntryMap)
     166{
     167    Vector<RefPtr<PerformanceEntry> > entries;
     168
     169    for (PerformanceEntryMap::const_iterator it = performanceEntryMap.begin(); it != performanceEntryMap.end(); ++it)
     170        entries.append(it->value);
     171
     172    return entries;
     173}
     174
     175static Vector<RefPtr<PerformanceEntry> > getEntrySequenceByName(const PerformanceEntryMap& performanceEntryMap, const String& name)
     176{
     177    Vector<RefPtr<PerformanceEntry> > entries;
     178
     179    PerformanceEntryMap::const_iterator it = performanceEntryMap.find(name);
     180    if (it != performanceEntryMap.end())
     181        entries.append(it->value);
     182
     183    return entries;
     184}
     185
     186Vector<RefPtr<PerformanceEntry> > UserTiming::getMarks() const
     187{
     188    return convertToEntrySequence(m_marksMap);
     189}
     190
     191Vector<RefPtr<PerformanceEntry> > UserTiming::getMarks(const String& name) const
     192{
     193    return getEntrySequenceByName(m_marksMap, name);
     194}
     195
     196Vector<RefPtr<PerformanceEntry> > UserTiming::getMeasures() const
     197{
     198    return convertToEntrySequence(m_measuresMap);
     199}
     200
     201Vector<RefPtr<PerformanceEntry> > UserTiming::getMeasures(const String& name) const
     202{
     203    return getEntrySequenceByName(m_measuresMap, name);
     204}
     205
    165206} // namespace WebCore
    166207
  • trunk/Source/WebCore/page/PerformanceUserTiming.h

    r132146 r132147  
    5656    void clearMeasures(const String& measureName);
    5757
     58    Vector<RefPtr<PerformanceEntry> > getMarks() const;
     59    Vector<RefPtr<PerformanceEntry> > getMeasures() const;
     60
     61    Vector<RefPtr<PerformanceEntry> > getMarks(const String& name) const;
     62    Vector<RefPtr<PerformanceEntry> > getMeasures(const String& name) const;
     63
    5864private:
    5965    explicit UserTiming(Performance*);
Note: See TracChangeset for help on using the changeset viewer.