Changeset 50013 in webkit


Ignore:
Timestamp:
Oct 23, 2009 5:24:49 PM (14 years ago)
Author:
pfeldman@chromium.org
Message:

2009-10-23 Kelly Norton <knorton@google.com>

Reviewed by Pavel Feldman.

Removes the need for C++ Timeline types in InspectorTimelineAgent in favor
of ScriptObjects.
https://bugs.webkit.org/show_bug.cgi?id=30707

  • GNUmakefile.am:
  • WebCore.vcproj/WebCore.vcproj:
  • WebCore.xcodeproj/project.pbxproj:
  • inspector/DOMDispatchTimelineItem.cpp: Removed.
  • inspector/DOMDispatchTimelineItem.h: Removed.
  • inspector/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::InspectorTimelineAgent): (WebCore::InspectorTimelineAgent::willDispatchDOMEvent): (WebCore::InspectorTimelineAgent::didDispatchDOMEvent): (WebCore::InspectorTimelineAgent::willLayout): (WebCore::InspectorTimelineAgent::didLayout): (WebCore::InspectorTimelineAgent::willRecalculateStyle): (WebCore::InspectorTimelineAgent::didRecalculateStyle): (WebCore::InspectorTimelineAgent::willPaint): (WebCore::InspectorTimelineAgent::didPaint): (WebCore::InspectorTimelineAgent::willWriteHTML): (WebCore::InspectorTimelineAgent::didWriteHTML): (WebCore::InspectorTimelineAgent::reset): (WebCore::InspectorTimelineAgent::didCompleteCurrentRecord): (WebCore::InspectorTimelineAgent::pushCurrentTimelineItem):
  • inspector/InspectorTimelineAgent.h: (WebCore::InspectorTimelineAgent::TimelineItemEntry::TimelineItemEntry):
  • inspector/TimelineItem.cpp: Removed.
  • inspector/TimelineItem.h: Removed.
  • inspector/TimelineItemFactory.cpp: Added. (WebCore::TimelineItemFactory::createGenericTimelineItem): (WebCore::TimelineItemFactory::createDOMDispatchTimelineItem):
  • inspector/TimelineItemFactory.h: Added. (WebCore::): (WebCore::TimelineItemFactory::TimelineItemFactory):
Location:
trunk/WebCore
Files:
2 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r50012 r50013  
     12009-10-23  Kelly Norton  <knorton@google.com>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Removes the need for C++ Timeline types in InspectorTimelineAgent in favor
     6        of ScriptObjects.
     7        https://bugs.webkit.org/show_bug.cgi?id=30707
     8
     9        * GNUmakefile.am:
     10        * WebCore.vcproj/WebCore.vcproj:
     11        * WebCore.xcodeproj/project.pbxproj:
     12        * inspector/DOMDispatchTimelineItem.cpp: Removed.
     13        * inspector/DOMDispatchTimelineItem.h: Removed.
     14        * inspector/InspectorTimelineAgent.cpp:
     15        (WebCore::InspectorTimelineAgent::InspectorTimelineAgent):
     16        (WebCore::InspectorTimelineAgent::willDispatchDOMEvent):
     17        (WebCore::InspectorTimelineAgent::didDispatchDOMEvent):
     18        (WebCore::InspectorTimelineAgent::willLayout):
     19        (WebCore::InspectorTimelineAgent::didLayout):
     20        (WebCore::InspectorTimelineAgent::willRecalculateStyle):
     21        (WebCore::InspectorTimelineAgent::didRecalculateStyle):
     22        (WebCore::InspectorTimelineAgent::willPaint):
     23        (WebCore::InspectorTimelineAgent::didPaint):
     24        (WebCore::InspectorTimelineAgent::willWriteHTML):
     25        (WebCore::InspectorTimelineAgent::didWriteHTML):
     26        (WebCore::InspectorTimelineAgent::reset):
     27        (WebCore::InspectorTimelineAgent::didCompleteCurrentRecord):
     28        (WebCore::InspectorTimelineAgent::pushCurrentTimelineItem):
     29        * inspector/InspectorTimelineAgent.h:
     30        (WebCore::InspectorTimelineAgent::TimelineItemEntry::TimelineItemEntry):
     31        * inspector/TimelineItem.cpp: Removed.
     32        * inspector/TimelineItem.h: Removed.
     33        * inspector/TimelineItemFactory.cpp: Added.
     34        (WebCore::TimelineItemFactory::createGenericTimelineItem):
     35        (WebCore::TimelineItemFactory::createDOMDispatchTimelineItem):
     36        * inspector/TimelineItemFactory.h: Added.
     37        (WebCore::):
     38        (WebCore::TimelineItemFactory::TimelineItemFactory):
     39
    1402009-10-23  Gavin Barraclough  <barraclough@apple.com>
    241
  • trunk/WebCore/GNUmakefile.am

    r49998 r50013  
    11641164        WebCore/inspector/ConsoleMessage.cpp \
    11651165        WebCore/inspector/ConsoleMessage.h \
    1166         WebCore/inspector/DOMDispatchTimelineItem.cpp \
    1167         WebCore/inspector/DOMDispatchTimelineItem.h \
    11681166        WebCore/inspector/InspectorBackend.cpp \
    11691167        WebCore/inspector/InspectorBackend.h \
     
    11921190        WebCore/inspector/JavaScriptProfileNode.cpp \
    11931191        WebCore/inspector/JavaScriptProfileNode.h \
    1194         WebCore/inspector/TimelineItem.cpp \
    1195         WebCore/inspector/TimelineItem.h \
     1192        WebCore/inspector/TimelineItemFactory.cpp \
     1193        WebCore/inspector/TimelineItemFactory.h \
    11961194        WebCore/loader/Cache.cpp \
    11971195        WebCore/loader/Cache.h \
  • trunk/WebCore/WebCore.gypi

    r49998 r50013  
    15111511            'inspector/ConsoleMessage.cpp',
    15121512            'inspector/ConsoleMessage.h',
    1513             'inspector/DOMDispatchTimelineItem.cpp',
    1514             'inspector/DOMDispatchTimelineItem.h',
    15151513            'inspector/InspectorBackend.cpp',
    15161514            'inspector/InspectorBackend.h',
     
    15381536            'inspector/JavaScriptProfileNode.cpp',
    15391537            'inspector/JavaScriptProfileNode.h',
    1540             'inspector/TimelineItem.cpp',
    1541             'inspector/TimelineItem.h',
     1538            'inspector/TimelineItemFactory.cpp',
     1539            'inspector/TimelineItemFactory.h',
    15421540            'loader/appcache/ApplicationCache.cpp',
    15431541            'loader/appcache/ApplicationCache.h',
  • trunk/WebCore/WebCore.vcproj/WebCore.vcproj

    r49998 r50013  
    3610436104                        </File>
    3610536105                        <File
    36106                                 RelativePath="..\inspector\DOMDispatchTimelineItem.cpp"
    36107                                 >
    36108                         </File>
    36109                         <File
    36110                                 RelativePath="..\inspector\DOMDispatchTimelineItem.h"
    36111                                 >
    36112                         </File>
    36113                         <File
    3611436106                                RelativePath="..\inspector\InspectorBackend.cpp"
    3611536107                                >
     
    3621636208                        </File>
    3621736209                        <File
    36218                                 RelativePath="..\inspector\TimelineItem.cpp"
    36219                                 >
    36220                         </File>
    36221                         <File
    36222                                 RelativePath="..\inspector\TimelineItem.h"
     36210                                RelativePath="..\inspector\TimelineItemFactory.cpp"
     36211                                >
     36212                        </File>
     36213                        <File
     36214                                RelativePath="..\inspector\TimelineItemFactory.h"
    3622336215                                >
    3622436216                        </File>
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r49998 r50013  
    11921192                65FEA86909833ADE00BED4AB /* Page.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65FEA86809833ADE00BED4AB /* Page.cpp */; };
    11931193                72626E020EF022FE00A07E20 /* FontFastPath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 72626E010EF022FE00A07E20 /* FontFastPath.cpp */; };
    1194                 75092BFE104B80F9003DD168 /* DOMDispatchTimelineItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 75092BFC104B80F9003DD168 /* DOMDispatchTimelineItem.cpp */; };
    1195                 75092BFF104B80F9003DD168 /* DOMDispatchTimelineItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 75092BFD104B80F9003DD168 /* DOMDispatchTimelineItem.h */; };
    11961194                754133A8102E00E800075D00 /* InspectorTimelineAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 754133A7102E00E800075D00 /* InspectorTimelineAgent.h */; };
    11971195                754133AA102E00F400075D00 /* InspectorTimelineAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 754133A9102E00F400075D00 /* InspectorTimelineAgent.cpp */; };
     1196                7553CFE8108F473F00EA281E /* TimelineItemFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 7553CFE6108F473F00EA281E /* TimelineItemFactory.h */; };
     1197                7553CFE9108F473F00EA281E /* TimelineItemFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7553CFE7108F473F00EA281E /* TimelineItemFactory.cpp */; };
    11981198                75793E830D0CE0B3007FC0AC /* MessageEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 75793E800D0CE0B3007FC0AC /* MessageEvent.cpp */; };
    11991199                75793E840D0CE0B3007FC0AC /* MessageEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 75793E810D0CE0B3007FC0AC /* MessageEvent.h */; };
     
    12031203                75793ED40D0CE85B007FC0AC /* DOMMessageEvent.mm in Sources */ = {isa = PBXBuildFile; fileRef = 75793ED10D0CE85B007FC0AC /* DOMMessageEvent.mm */; };
    12041204                75793ED50D0CE85B007FC0AC /* DOMMessageEventInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 75793ED20D0CE85B007FC0AC /* DOMMessageEventInternal.h */; };
    1205                 75A94A03104B74FB0006673C /* TimelineItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 75A94A01104B74FB0006673C /* TimelineItem.cpp */; };
    1206                 75A94A04104B74FB0006673C /* TimelineItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 75A94A02104B74FB0006673C /* TimelineItem.h */; };
    12071205                7693BAD2106C2DCA007B0823 /* HaltablePlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 7693BACE106C2DCA007B0823 /* HaltablePlugin.h */; settings = {ATTRIBUTES = (Private, ); }; };
    12081206                7693BAD3106C2DCA007B0823 /* PluginHalter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7693BACF106C2DCA007B0823 /* PluginHalter.cpp */; };
     
    64846482                65FEA86809833ADE00BED4AB /* Page.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Page.cpp; sourceTree = "<group>"; };
    64856483                72626E010EF022FE00A07E20 /* FontFastPath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontFastPath.cpp; sourceTree = "<group>"; };
    6486                 75092BFC104B80F9003DD168 /* DOMDispatchTimelineItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMDispatchTimelineItem.cpp; sourceTree = "<group>"; };
    6487                 75092BFD104B80F9003DD168 /* DOMDispatchTimelineItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMDispatchTimelineItem.h; sourceTree = "<group>"; };
    64886484                754133A7102E00E800075D00 /* InspectorTimelineAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorTimelineAgent.h; sourceTree = "<group>"; };
    64896485                754133A9102E00F400075D00 /* InspectorTimelineAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorTimelineAgent.cpp; sourceTree = "<group>"; };
     6486                7553CFE6108F473F00EA281E /* TimelineItemFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TimelineItemFactory.h; sourceTree = "<group>"; };
     6487                7553CFE7108F473F00EA281E /* TimelineItemFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TimelineItemFactory.cpp; sourceTree = "<group>"; };
    64906488                75793E800D0CE0B3007FC0AC /* MessageEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = MessageEvent.cpp; path = dom/MessageEvent.cpp; sourceTree = SOURCE_ROOT; };
    64916489                75793E810D0CE0B3007FC0AC /* MessageEvent.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = MessageEvent.h; path = dom/MessageEvent.h; sourceTree = SOURCE_ROOT; };
     
    64966494                75793ED10D0CE85B007FC0AC /* DOMMessageEvent.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMMessageEvent.mm; sourceTree = "<group>"; };
    64976495                75793ED20D0CE85B007FC0AC /* DOMMessageEventInternal.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DOMMessageEventInternal.h; sourceTree = "<group>"; };
    6498                 75A94A01104B74FB0006673C /* TimelineItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TimelineItem.cpp; sourceTree = "<group>"; };
    6499                 75A94A02104B74FB0006673C /* TimelineItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TimelineItem.h; sourceTree = "<group>"; };
    65006496                7693BACE106C2DCA007B0823 /* HaltablePlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HaltablePlugin.h; sourceTree = "<group>"; };
    65016497                7693BACF106C2DCA007B0823 /* PluginHalter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginHalter.cpp; sourceTree = "<group>"; };
     
    1036410360                                41F0618D0F5F069800A07EAC /* ConsoleMessage.cpp */,
    1036510361                                41F0618C0F5F069800A07EAC /* ConsoleMessage.h */,
    10366                                 75092BFC104B80F9003DD168 /* DOMDispatchTimelineItem.cpp */,
    10367                                 75092BFD104B80F9003DD168 /* DOMDispatchTimelineItem.h */,
    1036810362                                7A74ECB8101839A500BF939E /* InspectorBackend.cpp */,
    1036910363                                7A74ECB9101839A600BF939E /* InspectorBackend.h */,
     
    1039510389                                1C81B9FB0E9733CB00266E07 /* JavaScriptProfileNode.h */,
    1039610390                                BCC64F5F0DCFB84E0081EF3B /* localizedStrings.js */,
    10397                                 75A94A01104B74FB0006673C /* TimelineItem.cpp */,
    10398                                 75A94A02104B74FB0006673C /* TimelineItem.h */,
     10391                                7553CFE6108F473F00EA281E /* TimelineItemFactory.h */,
     10392                                7553CFE7108F473F00EA281E /* TimelineItemFactory.cpp */,
    1039910393                        );
    1040010394                        path = inspector;
     
    1597215966                                E10B9CCC0B747A44003ED890 /* DOMCustomXPathNSResolver.h in Headers */,
    1597315967                                BC7DAAEF0FF9615D00CE0138 /* DOMDataGridDataSource.h in Headers */,
    15974                                 75092BFF104B80F9003DD168 /* DOMDispatchTimelineItem.h in Headers */,
    1597515968                                85ACABB00A9CAF8000671E90 /* DOMDocument.h in Headers */,
    1597615969                                85089CDB0A98C42800A275AA /* DOMDocumentFragment.h in Headers */,
     
    1792117914                                E1FF57A30F01255B00891EBB /* ThreadGlobalData.h in Headers */,
    1792217915                                185BCF290F3279CE000EA262 /* ThreadTimers.h in Headers */,
    17923                                 75A94A04104B74FB0006673C /* TimelineItem.h in Headers */,
    1792417916                                9305B24D098F1B6B00C28855 /* Timer.h in Headers */,
    1792517917                                E44613B00CD6331000FADA75 /* TimeRanges.h in Headers */,
     
    1807418066                                973E325710883B7C005BC493 /* ResourceLoadNotifier.h in Headers */,
    1807518067                                84801955108BAFB300CB2B1F /* FEGaussianBlur.h in Headers */,
     18068                                7553CFE8108F473F00EA281E /* TimelineItemFactory.h in Headers */,
    1807618069                                BC97E23A109144950010D361 /* HTMLAllCollection.h in Headers */,
    1807718070                                BC97E413109154FA0010D361 /* JSHTMLAllCollection.h in Headers */,
     
    1854818541                                E10B9CCD0B747A44003ED890 /* DOMCustomXPathNSResolver.mm in Sources */,
    1854918542                                BC7DAAEE0FF9615D00CE0138 /* DOMDataGridDataSource.cpp in Sources */,
    18550                                 75092BFE104B80F9003DD168 /* DOMDispatchTimelineItem.cpp in Sources */,
    1855118543                                85ACABB10A9CAF8000671E90 /* DOMDocument.mm in Sources */,
    1855218544                                85089CDC0A98C42800A275AA /* DOMDocumentFragment.mm in Sources */,
     
    2007720069                                E1FF57A60F01256B00891EBB /* ThreadGlobalData.cpp in Sources */,
    2007820070                                185BCF280F3279CE000EA262 /* ThreadTimers.cpp in Sources */,
    20079                                 75A94A03104B74FB0006673C /* TimelineItem.cpp in Sources */,
    2008020071                                93309EA4099EB78C0056E581 /* Timer.cpp in Sources */,
    2008120072                                E44613AF0CD6331000FADA75 /* TimeRanges.cpp in Sources */,
     
    2020920200                                973E325610883B7C005BC493 /* ResourceLoadNotifier.cpp in Sources */,
    2021020201                                84801954108BAFB300CB2B1F /* FEGaussianBlur.cpp in Sources */,
     20202                                7553CFE9108F473F00EA281E /* TimelineItemFactory.cpp in Sources */,
    2021120203                                BC97E23B109144950010D361 /* HTMLAllCollection.cpp in Sources */,
    2021220204                                BC97E412109154FA0010D361 /* JSHTMLAllCollection.cpp in Sources */,
  • trunk/WebCore/inspector/DOMDispatchTimelineItem.cpp

    r48430 r50013  
    1 /*
    2 * Copyright (C) 2009 Google Inc. All rights reserved.
    3 *
    4 * Redistribution and use in source and binary forms, with or without
    5 * modification, are permitted provided that the following conditions are
    6 * met:
    7 *
    8 *     * Redistributions of source code must retain the above copyright
    9 * notice, this list of conditions and the following disclaimer.
    10 *     * Redistributions in binary form must reproduce the above
    11 * copyright notice, this list of conditions and the following disclaimer
    12 * in the documentation and/or other materials provided with the
    13 * distribution.
    14 *     * Neither the name of Google Inc. nor the names of its
    15 * contributors may be used to endorse or promote products derived from
    16 * this software without specific prior written permission.
    17 *
    18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    29 */
    30 
    31 #include "config.h"
    32 #include "DOMDispatchTimelineItem.h"
    33 
    34 #if ENABLE(INSPECTOR)
    35 
    36 #include "Event.h"
    37 #include "InspectorFrontend.h"
    38 
    39 namespace WebCore {
    40 
    41 DOMDispatchTimelineItem::DOMDispatchTimelineItem(PassOwnPtr<TimelineItem> previous, double startTime, const Event& event)
    42     : TimelineItem(previous, startTime, DOMDispatchTimelineItemType)
    43     , m_eventType(event.type().string())
    44 {
    45 }
    46 
    47 ScriptObject DOMDispatchTimelineItem::convertToScriptObject(InspectorFrontend* frontend)
    48 {
    49     ScriptObject selfObj = TimelineItem::convertToScriptObject(frontend);
    50     ScriptObject dataObj = frontend->newScriptObject();
    51     dataObj.set("type", m_eventType);
    52     selfObj.set("data", dataObj);
    53     return selfObj;
    54 }
    55 
    56 } // namespace WebCore
    57 
    58 #endif // ENABLE(INSPECTOR)
  • trunk/WebCore/inspector/DOMDispatchTimelineItem.h

    r48167 r50013  
    1 /*
    2 * Copyright (C) 2009 Google Inc. All rights reserved.
    3 *
    4 * Redistribution and use in source and binary forms, with or without
    5 * modification, are permitted provided that the following conditions are
    6 * met:
    7 *
    8 *     * Redistributions of source code must retain the above copyright
    9 * notice, this list of conditions and the following disclaimer.
    10 *     * Redistributions in binary form must reproduce the above
    11 * copyright notice, this list of conditions and the following disclaimer
    12 * in the documentation and/or other materials provided with the
    13 * distribution.
    14 *     * Neither the name of Google Inc. nor the names of its
    15 * contributors may be used to endorse or promote products derived from
    16 * this software without specific prior written permission.
    17 *
    18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    29 */
    30 
    31 #ifndef DOMDispatchTimelineItem_h
    32 #define DOMDispatchTimelineItem_h
    33 
    34 #include "TimelineItem.h"
    35 #include "PlatformString.h"
    36 
    37 namespace WebCore {
    38 
    39     class Event;
    40     class InspectorFrontend;
    41 
    42     class DOMDispatchTimelineItem : public TimelineItem {
    43     public:
    44         DOMDispatchTimelineItem(PassOwnPtr<TimelineItem> previous, double startTime, const Event&);
    45 
    46         virtual ~DOMDispatchTimelineItem() { }
    47 
    48     protected:
    49         virtual ScriptObject convertToScriptObject(InspectorFrontend*);
    50 
    51     private:
    52         String m_eventType;
    53     };
    54 
    55 } // namespace WebCore
    56 
    57 #endif // !defined(DOMDispatchTimelineItem_h)
    58 
  • trunk/WebCore/inspector/InspectorTimelineAgent.cpp

    r49898 r50013  
    3434#if ENABLE(INSPECTOR)
    3535
    36 #include "DOMDispatchTimelineItem.h"
    3736#include "Event.h"
    3837#include "InspectorFrontend.h"
    39 #include "TimelineItem.h"
     38#include "TimelineItemFactory.h"
    4039
    4140#include <wtf/CurrentTime.h>
     
    4544InspectorTimelineAgent::InspectorTimelineAgent(InspectorFrontend* frontend)
    4645    : m_frontend(frontend)
    47     , m_currentTimelineItem(0)
    4846{
    4947    ASSERT(m_frontend);
     
    5654void InspectorTimelineAgent::willDispatchDOMEvent(const Event& event)
    5755{
    58     m_currentTimelineItem = new DOMDispatchTimelineItem(m_currentTimelineItem.release(), currentTimeInMilliseconds(), event);
     56    pushCurrentTimelineItem(TimelineItemFactory::createDOMDispatchTimelineItem(m_frontend, currentTimeInMilliseconds(), event), DOMDispatchTimelineItemType);
    5957}
    6058
    6159void InspectorTimelineAgent::didDispatchDOMEvent()
    6260{
    63     ASSERT(m_currentTimelineItem->type() == DOMDispatchTimelineItemType);
    64     didCompleteCurrentRecord();
     61    didCompleteCurrentRecord(DOMDispatchTimelineItemType);
    6562}
    6663
    6764void InspectorTimelineAgent::willLayout()
    6865{
    69     m_currentTimelineItem = new TimelineItem(m_currentTimelineItem.release(), currentTimeInMilliseconds(), LayoutTimelineItemType);
     66    pushCurrentTimelineItem(TimelineItemFactory::createGenericTimelineItem(m_frontend, currentTimeInMilliseconds()), LayoutTimelineItemType);
    7067}
    7168
    7269void InspectorTimelineAgent::didLayout()
    7370{
    74     ASSERT(m_currentTimelineItem->type() == LayoutTimelineItemType);
    75     didCompleteCurrentRecord();
     71    didCompleteCurrentRecord(LayoutTimelineItemType);
    7672}
    7773
    7874void InspectorTimelineAgent::willRecalculateStyle()
    7975{
    80     m_currentTimelineItem = new TimelineItem(m_currentTimelineItem.release(), currentTimeInMilliseconds(), RecalculateStylesTimelineItemType);
     76    pushCurrentTimelineItem(TimelineItemFactory::createGenericTimelineItem(m_frontend, currentTimeInMilliseconds()), RecalculateStylesTimelineItemType);
    8177}
    8278
    8379void InspectorTimelineAgent::didRecalculateStyle()
    8480{
    85     ASSERT(m_currentTimelineItem->type() == RecalculateStylesTimelineItemType);
    86     didCompleteCurrentRecord();
     81    didCompleteCurrentRecord(RecalculateStylesTimelineItemType);
    8782}
    8883
    8984void InspectorTimelineAgent::willPaint()
    9085{
    91     m_currentTimelineItem = new TimelineItem(m_currentTimelineItem.release(), currentTimeInMilliseconds(), PaintTimelineItemType);
     86    pushCurrentTimelineItem(TimelineItemFactory::createGenericTimelineItem(m_frontend, currentTimeInMilliseconds()), PaintTimelineItemType);
    9287}
    9388
    9489void InspectorTimelineAgent::didPaint()
    9590{
    96     ASSERT(m_currentTimelineItem->type() == PaintTimelineItemType);
    97     didCompleteCurrentRecord();
     91    didCompleteCurrentRecord(PaintTimelineItemType);
    9892}
    9993
    10094void InspectorTimelineAgent::willWriteHTML()
    10195{
    102     m_currentTimelineItem = new TimelineItem(m_currentTimelineItem.release(), currentTimeInMilliseconds(), ParseHTMLTimelineItemType);
     96    pushCurrentTimelineItem(TimelineItemFactory::createGenericTimelineItem(m_frontend, currentTimeInMilliseconds()), ParseHTMLTimelineItemType);
    10397}
    10498
    10599void InspectorTimelineAgent::didWriteHTML()
    106100{
    107     ASSERT(m_currentTimelineItem->type() == ParseHTMLTimelineItemType);
    108     didCompleteCurrentRecord();
     101    didCompleteCurrentRecord(ParseHTMLTimelineItemType);
    109102}
    110103
    111104void InspectorTimelineAgent::reset()
    112105{
    113     m_currentTimelineItem.set(0);
     106    m_itemStack.clear();
    114107}
    115108
    116 void InspectorTimelineAgent::didCompleteCurrentRecord()
     109void InspectorTimelineAgent::didCompleteCurrentRecord(TimelineItemType type)
    117110{
    118     OwnPtr<TimelineItem> item(m_currentTimelineItem.release());
    119     m_currentTimelineItem = item->releasePrevious();
    120 
    121     item->setEndTime(currentTimeInMilliseconds());
    122     if (m_currentTimelineItem.get())
    123         m_currentTimelineItem->addChildItem(item.release());
    124     else
    125         item->addToTimeline(m_frontend);
     111    TimelineItemEntry entry = m_itemStack.last();
     112    m_itemStack.removeLast();
     113    ASSERT(entry.type == type);
     114    entry.item.set("type", type);
     115    entry.item.set("children", entry.children);
     116    entry.item.set("endTime", currentTimeInMilliseconds());
     117   
     118    if (m_itemStack.isEmpty()) {
     119        m_frontend->addItemToTimeline(entry.item);
     120    } else {
     121        TimelineItemEntry parent = m_itemStack.last();
     122        parent.children.set(parent.children.length(), entry.item);
     123    }
    126124}
    127125
     
    131129}
    132130
     131void InspectorTimelineAgent::pushCurrentTimelineItem(ScriptObject item, TimelineItemType type)
     132{
     133    m_itemStack.append(TimelineItemEntry(item, m_frontend->newScriptArray(), type));
     134}
     135
    133136} // namespace WebCore
    134137
  • trunk/WebCore/inspector/InspectorTimelineAgent.h

    r49898 r50013  
    3535#include "ScriptArray.h"
    3636
    37 #include <wtf/OwnPtr.h>
    38 #include <wtf/PassOwnPtr.h>
     37#include <wtf/Vector.h>
    3938
    4039namespace WebCore {
    4140    class Event;
    4241    class InspectorFrontend;
    43     class TimelineItem;
     42
     43    // Must be kept in sync with TimelineAgent.js
     44    enum TimelineItemType {
     45        DOMDispatchTimelineItemType = 0,
     46        LayoutTimelineItemType = 1,
     47        RecalculateStylesTimelineItemType = 2,
     48        PaintTimelineItemType = 3,
     49        ParseHTMLTimelineItemType = 4,
     50    };
    4451
    4552    class InspectorTimelineAgent {
     
    6168        void didWriteHTML();
    6269        void willWriteHTML();
     70
    6371    private:
     72        struct TimelineItemEntry {
     73            TimelineItemEntry(ScriptObject item, ScriptArray children, TimelineItemType type) : item(item), children(children), type(type) { }
     74            ScriptObject item;
     75            ScriptArray children;
     76            TimelineItemType type;
     77        };
     78       
     79        void pushCurrentTimelineItem(ScriptObject, TimelineItemType);
     80       
    6481        static double currentTimeInMilliseconds();
    6582
    66         void didCompleteCurrentRecord();
    67 
     83        void didCompleteCurrentRecord(TimelineItemType);
     84       
    6885        InspectorFrontend* m_frontend;
    69         OwnPtr<TimelineItem> m_currentTimelineItem;
     86       
     87        Vector< TimelineItemEntry > m_itemStack;
    7088    };
    7189
  • trunk/WebCore/inspector/TimelineItem.cpp

    r48430 r50013  
    1 /*
    2 * Copyright (C) 2009 Google Inc. All rights reserved.
    3 *
    4 * Redistribution and use in source and binary forms, with or without
    5 * modification, are permitted provided that the following conditions are
    6 * met:
    7 *
    8 *     * Redistributions of source code must retain the above copyright
    9 * notice, this list of conditions and the following disclaimer.
    10 *     * Redistributions in binary form must reproduce the above
    11 * copyright notice, this list of conditions and the following disclaimer
    12 * in the documentation and/or other materials provided with the
    13 * distribution.
    14 *     * Neither the name of Google Inc. nor the names of its
    15 * contributors may be used to endorse or promote products derived from
    16 * this software without specific prior written permission.
    17 *
    18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    29 */
    30 
    31 #include "config.h"
    32 #include "TimelineItem.h"
    33 
    34 #if ENABLE(INSPECTOR)
    35 
    36 #include "InspectorFrontend.h"
    37 #include "ScriptArray.h"
    38 #include "ScriptObject.h"
    39 
    40 namespace WebCore {
    41 
    42 TimelineItem::TimelineItem(PassOwnPtr<TimelineItem> previous, double startTime, TimelineItemType itemType)
    43     : m_startTime(startTime)
    44     , m_endTime(0.0)
    45     , m_itemType(itemType)
    46     , m_previous(previous)
    47 {
    48 }
    49 
    50 void TimelineItem::addToTimeline(InspectorFrontend* frontend)
    51 {
    52     frontend->addItemToTimeline(convertToScriptObject(frontend));
    53 }
    54 
    55 ScriptObject TimelineItem::convertToScriptObject(InspectorFrontend* frontend)
    56 {
    57     ScriptObject selfObj = frontend->newScriptObject();
    58     selfObj.set("time", m_startTime);
    59     selfObj.set("type", static_cast<int>(m_itemType));
    60     selfObj.set("duration", m_endTime - m_startTime);
    61     ScriptArray children = convertChildrenToScriptArray(frontend);
    62     selfObj.set("children", children);
    63     return selfObj;
    64 }
    65 
    66 ScriptArray TimelineItem::convertChildrenToScriptArray(InspectorFrontend* frontend)
    67 {
    68     ScriptArray children = frontend->newScriptArray();
    69     for (unsigned i = 0; i < m_children.size(); ++i)
    70         children.set(i, m_children[i]->convertToScriptObject(frontend));
    71     return children;
    72 }
    73 
    74 void TimelineItem::addChildItem(PassOwnPtr<TimelineItem> timelineItem)
    75 {
    76     m_children.append(timelineItem);
    77 }
    78 
    79 } // namespace WebCore
    80 
    81 #endif // ENABLE(INSPECTOR)
  • trunk/WebCore/inspector/TimelineItem.h

    r48167 r50013  
    1 /*
    2 * Copyright (C) 2009 Google Inc. All rights reserved.
    3 *
    4 * Redistribution and use in source and binary forms, with or without
    5 * modification, are permitted provided that the following conditions are
    6 * met:
    7 *
    8 *     * Redistributions of source code must retain the above copyright
    9 * notice, this list of conditions and the following disclaimer.
    10 *     * Redistributions in binary form must reproduce the above
    11 * copyright notice, this list of conditions and the following disclaimer
    12 * in the documentation and/or other materials provided with the
    13 * distribution.
    14 *     * Neither the name of Google Inc. nor the names of its
    15 * contributors may be used to endorse or promote products derived from
    16 * this software without specific prior written permission.
    17 *
    18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    29 */
    30 
    31 #ifndef TimelineItem_h
    32 #define TimelineItem_h
    33 
    34 #include <wtf/OwnPtr.h>
    35 #include <wtf/PassOwnPtr.h>
    36 #include <wtf/Vector.h>
    37 
    38 namespace WebCore {
    39 
    40     class InspectorFrontend;
    41     class TimelineItem;
    42     class ScriptArray;
    43     class ScriptObject;
    44 
    45     typedef Vector<OwnPtr<TimelineItem> > TimelineItems;
    46 
    47     // Must be kept in sync with TimelineAgent.js
    48     enum TimelineItemType {
    49         DOMDispatchTimelineItemType = 0,
    50         LayoutTimelineItemType = 1,
    51         RecalculateStylesTimelineItemType = 2,
    52         PaintTimelineItemType = 3,
    53         ParseHTMLTimelineItemType = 4,
    54     };
    55 
    56     class TimelineItem {
    57     public:
    58         TimelineItem(PassOwnPtr<TimelineItem>, double startTime, TimelineItemType);
    59 
    60         virtual ~TimelineItem() { }
    61 
    62         TimelineItem* previous() const { return m_previous.get(); }
    63 
    64         PassOwnPtr<TimelineItem*> releasePrevious() { return m_previous.release(); }
    65 
    66         void addToTimeline(InspectorFrontend*);
    67 
    68         void addChildItem(PassOwnPtr<TimelineItem>);
    69 
    70         void setEndTime(double endTime) { m_endTime = endTime; }
    71 
    72         TimelineItemType type() { return m_itemType; }
    73     protected:
    74         virtual ScriptObject convertToScriptObject(InspectorFrontend*);
    75 
    76         ScriptArray convertChildrenToScriptArray(InspectorFrontend*);
    77      
    78     private:
    79         double m_startTime;
    80         double m_endTime;
    81         TimelineItemType m_itemType;
    82         OwnPtr<TimelineItem> m_previous;
    83         TimelineItems m_children;
    84     };
    85 
    86 } // namespace WebCore
    87 
    88 #endif // !defined(TimelineItem_h)
Note: See TracChangeset for help on using the changeset viewer.