Changeset 57505 in webkit


Ignore:
Timestamp:
Apr 13, 2010 12:22:14 AM (14 years ago)
Author:
mnaganov@chromium.org
Message:

2010-04-12 Mikhail Naganov <mnaganov@chromium.org>

Replace hand-written JavaScriptProfile* bindings with idl-based, and
in Chromium port, bind them to the new V8's profiler API that is
aligned with JSC.

https://bugs.webkit.org/show_bug.cgi?id=37448

  • DerivedSources.cpp:
  • DerivedSources.make:
  • GNUmakefile.am:
  • WebCore.gypi:
  • WebCore.pro:
  • WebCore.vcproj/WebCore.vcproj:
  • WebCore.xcodeproj/project.pbxproj:
  • bindings/js/JSBindingsAllInOne.cpp:
  • bindings/js/JSConsoleCustom.cpp:
  • bindings/js/JSScriptProfileNodeCustom.cpp: Added. (WebCore::JSScriptProfileNode::callUID): (WebCore::JSScriptProfileNode::children):
  • bindings/js/JavaScriptProfile.cpp: Removed.
  • bindings/js/JavaScriptProfile.h: Removed.
  • bindings/js/JavaScriptProfileNode.cpp: Removed.
  • bindings/js/JavaScriptProfileNode.h: Removed.
  • bindings/js/ScriptProfileNode.h: Added.
  • bindings/scripts/CodeGeneratorJS.pm:
  • bindings/scripts/CodeGeneratorV8.pm:
  • bindings/v8/ScriptProfile.cpp: Added. (WebCore::ScriptProfile::title): (WebCore::ScriptProfile::uid): (WebCore::ScriptProfile::head):
  • bindings/v8/ScriptProfile.h: (WebCore::ScriptProfile::create): (WebCore::ScriptProfile::ScriptProfile):
  • bindings/v8/ScriptProfileNode.cpp: Added. (WebCore::ScriptProfileNode::functionName): (WebCore::ScriptProfileNode::url): (WebCore::ScriptProfileNode::lineNumber): (WebCore::ScriptProfileNode::totalTime): (WebCore::ScriptProfileNode::selfTime): (WebCore::ScriptProfileNode::numberOfCalls): (WebCore::ScriptProfileNode::children): (WebCore::ScriptProfileNode::visible): (WebCore::ScriptProfileNode::callUID):
  • bindings/v8/ScriptProfileNode.h: Added. (WebCore::ScriptProfileNode::create): (WebCore::ScriptProfileNode::~ScriptProfileNode): (WebCore::ScriptProfileNode::ScriptProfileNode):
  • bindings/v8/ScriptProfiler.cpp: (WebCore::ScriptProfiler::start): (WebCore::ScriptProfiler::stop):
  • bindings/v8/custom/V8ConsoleCustom.cpp: Added. (WebCore::V8Console::profilesAccessorGetter):
  • bindings/v8/custom/V8ScriptProfileCustom.cpp: Added. (WebCore::toV8):
  • bindings/v8/custom/V8ScriptProfileNodeCustom.cpp: Added. (WebCore::V8ScriptProfileNode::childrenAccessorGetter): (WebCore::V8ScriptProfileNode::callUIDAccessorGetter): (WebCore::toV8):
  • inspector/InspectorController.cpp: (WebCore::InspectorController::getProfile):
  • inspector/ScriptProfile.idl: Added.
  • inspector/ScriptProfileNode.idl: Added.
  • inspector/front-end/InspectorBackendStub.js: (.WebInspector.InspectorBackendStub.prototype.getProfile):
  • inspector/front-end/ProfilesPanel.js: (WebInspector.ProfilesPanel.prototype.populateInterface): (WebInspector.ProfilesPanel.prototype.profilerWasEnabled):
  • page/Console.idl:
  • platform/android/TemporaryLinkStubs.cpp:
  • src/js/InspectorControllerImpl.js: (devtools.InspectorBackendImpl):
  • src/js/ProfilerAgent.js: (devtools.ProfilerAgent): (devtools.ProfilerAgent.prototype.initializeProfiling): (devtools.ProfilerAgent.prototype._didGetActiveProfilerModules): (devtools.ProfilerAgent.prototype._didGetLogLines):
  • src/js/Tests.js:
Location:
trunk
Files:
1 added
2 deleted
23 edited
7 copied
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r57496 r57505  
     12010-04-12  Mikhail Naganov  <mnaganov@chromium.org>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Replace hand-written JavaScriptProfile* bindings with idl-based, and
     6        in Chromium port, bind them to the new V8's profiler API that is
     7        aligned with JSC.
     8
     9        https://bugs.webkit.org/show_bug.cgi?id=37448
     10
     11        * DerivedSources.cpp:
     12        * DerivedSources.make:
     13        * GNUmakefile.am:
     14        * WebCore.gypi:
     15        * WebCore.pro:
     16        * WebCore.vcproj/WebCore.vcproj:
     17        * WebCore.xcodeproj/project.pbxproj:
     18        * bindings/js/JSBindingsAllInOne.cpp:
     19        * bindings/js/JSConsoleCustom.cpp:
     20        * bindings/js/JSScriptProfileNodeCustom.cpp: Added.
     21        (WebCore::JSScriptProfileNode::callUID):
     22        (WebCore::JSScriptProfileNode::children):
     23        * bindings/js/JavaScriptProfile.cpp: Removed.
     24        * bindings/js/JavaScriptProfile.h: Removed.
     25        * bindings/js/JavaScriptProfileNode.cpp: Removed.
     26        * bindings/js/JavaScriptProfileNode.h: Removed.
     27        * bindings/js/ScriptProfileNode.h: Added.
     28        * bindings/scripts/CodeGeneratorJS.pm:
     29        * bindings/scripts/CodeGeneratorV8.pm:
     30        * bindings/v8/ScriptProfile.cpp: Added.
     31        (WebCore::ScriptProfile::title):
     32        (WebCore::ScriptProfile::uid):
     33        (WebCore::ScriptProfile::head):
     34        * bindings/v8/ScriptProfile.h:
     35        (WebCore::ScriptProfile::create):
     36        (WebCore::ScriptProfile::ScriptProfile):
     37        * bindings/v8/ScriptProfileNode.cpp: Added.
     38        (WebCore::ScriptProfileNode::functionName):
     39        (WebCore::ScriptProfileNode::url):
     40        (WebCore::ScriptProfileNode::lineNumber):
     41        (WebCore::ScriptProfileNode::totalTime):
     42        (WebCore::ScriptProfileNode::selfTime):
     43        (WebCore::ScriptProfileNode::numberOfCalls):
     44        (WebCore::ScriptProfileNode::children):
     45        (WebCore::ScriptProfileNode::visible):
     46        (WebCore::ScriptProfileNode::callUID):
     47        * bindings/v8/ScriptProfileNode.h: Added.
     48        (WebCore::ScriptProfileNode::create):
     49        (WebCore::ScriptProfileNode::~ScriptProfileNode):
     50        (WebCore::ScriptProfileNode::ScriptProfileNode):
     51        * bindings/v8/ScriptProfiler.cpp:
     52        (WebCore::ScriptProfiler::start):
     53        (WebCore::ScriptProfiler::stop):
     54        * bindings/v8/custom/V8ConsoleCustom.cpp: Added.
     55        (WebCore::V8Console::profilesAccessorGetter):
     56        * bindings/v8/custom/V8ScriptProfileCustom.cpp: Added.
     57        (WebCore::toV8):
     58        * bindings/v8/custom/V8ScriptProfileNodeCustom.cpp: Added.
     59        (WebCore::V8ScriptProfileNode::childrenAccessorGetter):
     60        (WebCore::V8ScriptProfileNode::callUIDAccessorGetter):
     61        (WebCore::toV8):
     62        * inspector/InspectorController.cpp:
     63        (WebCore::InspectorController::getProfile):
     64        * inspector/ScriptProfile.idl: Added.
     65        * inspector/ScriptProfileNode.idl: Added.
     66        * inspector/front-end/InspectorBackendStub.js:
     67        (.WebInspector.InspectorBackendStub.prototype.getProfile):
     68        * inspector/front-end/ProfilesPanel.js:
     69        (WebInspector.ProfilesPanel.prototype.populateInterface):
     70        (WebInspector.ProfilesPanel.prototype.profilerWasEnabled):
     71        * page/Console.idl:
     72        * platform/android/TemporaryLinkStubs.cpp:
     73
    1742010-04-12  Antonio Gomes  <tonikitoo@webkit.org>
    275
  • trunk/WebCore/DerivedSources.cpp

    r57204 r57505  
    198198#include "JSRGBColor.cpp"
    199199#include "JSScreen.cpp"
     200#include "JSScriptProfile.cpp"
     201#include "JSScriptProfileNode.cpp"
    200202#include "JSSharedWorker.cpp"
    201203#include "JSSharedWorkerContext.cpp"
  • trunk/WebCore/DerivedSources.make

    r57204 r57505  
    244244    SharedWorker \
    245245    SharedWorkerContext \
     246    ScriptProfile \
     247    ScriptProfileNode \
    246248    SQLError \
    247249    SQLResultSet \
  • trunk/WebCore/GNUmakefile.am

    r57494 r57505  
    271271        WebCore/inspector/InspectorBackend.idl \
    272272        WebCore/inspector/InspectorFrontendHost.idl \
     273        WebCore/inspector/ScriptProfile.idl \
     274        WebCore/inspector/ScriptProfileNode.idl \
    273275        WebCore/notifications/Notification.idl \
    274276        WebCore/notifications/NotificationCenter.idl \
     
    470472        WebCore/bindings/js/JSPluginElementFunctions.h \
    471473        WebCore/bindings/js/JSPopStateEventCustom.cpp \
     474        WebCore/bindings/js/JSScriptProfileNodeCustom.cpp \
    472475        WebCore/bindings/js/JSStorageCustom.h \
    473476        WebCore/bindings/js/JSStyleSheetCustom.cpp \
     
    488491        WebCore/bindings/js/JSXSLTProcessorConstructor.h \
    489492        WebCore/bindings/js/JSXSLTProcessorCustom.cpp \
    490         WebCore/bindings/js/JavaScriptProfile.cpp \
    491         WebCore/bindings/js/JavaScriptProfile.h \
    492         WebCore/bindings/js/JavaScriptProfileNode.cpp \
    493         WebCore/bindings/js/JavaScriptProfileNode.h \
    494493        WebCore/bindings/js/ScheduledAction.cpp \
    495494        WebCore/bindings/js/ScheduledAction.h \
     
    515514        WebCore/bindings/js/ScriptObject.h \
    516515        WebCore/bindings/js/ScriptProfile.h \
     516        WebCore/bindings/js/ScriptProfileNode.h \
    517517        WebCore/bindings/js/ScriptProfiler.cpp \
    518518        WebCore/bindings/js/ScriptProfiler.h \
  • trunk/WebCore/WebCore.gypi

    r57494 r57505  
    192192            'inspector/InspectorFrontendHost.idl',
    193193            'inspector/JavaScriptCallFrame.idl',
     194            'inspector/ScriptProfile.idl',
     195            'inspector/ScriptProfileNode.idl',
    194196            'loader/appcache/DOMApplicationCache.idl',
    195197            'notifications/Notification.idl',
     
    599601            'bindings/js/JSSharedWorkerConstructor.h',
    600602            'bindings/js/JSSharedWorkerCustom.cpp',
     603            'bindings/js/JSScriptProfileNodeCustom.cpp',
    601604            'bindings/js/JSSQLResultSetRowListCustom.cpp',
    602605            'bindings/js/JSSQLTransactionCustom.cpp',
     
    637640            'bindings/js/JSXSLTProcessorConstructor.h',
    638641            'bindings/js/JSXSLTProcessorCustom.cpp',
    639             'bindings/js/JavaScriptProfile.cpp',
    640             'bindings/js/JavaScriptProfile.h',
    641             'bindings/js/JavaScriptProfileNode.cpp',
    642             'bindings/js/JavaScriptProfileNode.h',
    643642            'bindings/js/ScheduledAction.cpp',
    644643            'bindings/js/ScheduledAction.h',
     
    695694            'bindings/v8/custom/V8WebGLRenderingContextCustom.cpp',
    696695            'bindings/v8/custom/V8ClipboardCustom.cpp',
     696            'bindings/v8/custom/V8ConsoleCustom.cpp',
    697697            'bindings/v8/custom/V8CoordinatesCustom.cpp',
    698698            'bindings/v8/custom/V8CSSRuleCustom.cpp',
     
    771771            'bindings/v8/custom/V8NotificationCenterCustom.cpp',
    772772            'bindings/v8/custom/V8PopStateEventCustom.cpp',
     773            'bindings/v8/custom/V8ScriptProfileCustom.cpp',
     774            'bindings/v8/custom/V8ScriptProfileNodeCustom.cpp',
    773775            'bindings/v8/custom/V8StorageCustom.cpp',
    774776            'bindings/v8/custom/V8SQLResultSetRowListCustom.cpp',
     
    831833            'bindings/v8/ScriptObject.cpp',
    832834            'bindings/v8/ScriptObject.h',
     835            'bindings/v8/ScriptProfile.cpp',
    833836            'bindings/v8/ScriptProfile.h',
     837            'bindings/v8/ScriptProfileNode.cpp',
     838            'bindings/v8/ScriptProfileNode.h',
    834839            'bindings/v8/ScriptProfiler.cpp',
    835840            'bindings/v8/ScriptProfiler.h',
  • trunk/WebCore/WebCore.pro

    r57494 r57505  
    343343    bindings/js/JSNodeListCustom.cpp \
    344344    bindings/js/JSOptionConstructor.cpp \
     345    bindings/js/JSScriptProfileNodeCustom.cpp \
    345346    bindings/js/JSStyleSheetCustom.cpp \
    346347    bindings/js/JSStyleSheetListCustom.cpp \
     
    366367    bindings/js/JSPopStateEventCustom.cpp \
    367368    bindings/js/JSWorkerContextErrorHandler.cpp \
    368     bindings/js/JavaScriptProfile.h \
    369     bindings/js/JavaScriptProfileNode.h \
    370     bindings/js/JavaScriptProfile.cpp \
    371     bindings/js/JavaScriptProfileNode.cpp \
    372369    bindings/js/ScriptArray.cpp \
    373370    bindings/js/ScriptCachedFrameData.cpp \
     
    379376    bindings/js/ScriptFunctionCall.cpp \
    380377    bindings/js/ScriptObject.cpp \
    381     bindings/js/ScriptProfiler.cpp \
    382378    bindings/js/ScriptState.cpp \
    383379    bindings/js/ScriptValue.cpp \
     
    10911087    bindings/js/ScriptGCEvent.h \
    10921088    bindings/js/ScriptObject.h \
     1089    bindings/js/ScriptProfile.h \
     1090    bindings/js/ScriptProfileNode.h \
     1091    bindings/js/ScriptProfiler.h \
    10931092    bindings/js/ScriptSourceCode.h \
    10941093    bindings/js/ScriptSourceProvider.h \
     
    27292728    SOURCES += \
    27302729        bindings/js/JSJavaScriptCallFrameCustom.cpp \
     2730        bindings/js/ScriptProfiler.cpp \
    27312731        inspector/JavaScriptCallFrame.cpp \
    27322732}
  • trunk/WebCore/WebCore.vcproj/WebCore.vcproj

    r57494 r57505  
    3467334673                                </File>
    3467434674                                <File
    34675                                         RelativePath="..\bindings\js\JavaScriptProfile.cpp"
    34676                                         >
    34677                                 </File>
    34678                                 <File
    34679                                         RelativePath="..\bindings\js\JavaScriptProfile.h"
    34680                                         >
    34681                                 </File>
    34682                                 <File
    34683                                         RelativePath="..\bindings\js\JavaScriptProfileNode.cpp"
    34684                                         >
    34685                                 </File>
    34686                                 <File
    34687                                         RelativePath="..\bindings\js\JavaScriptProfileNode.h"
    34688                                         >
    34689                                 </File>
    34690                                 <File
    3469134675                                        RelativePath="..\bindings\js\JSAbstractWorkerCustom.cpp"
    3469234676                                        >
     
    3964339627                                        RelativePath="..\bindings\js\JSSVGPODTypeWrapper.h"
    3964439628                                        >
     39629                                </File>
     39630                                <File
     39631                                        RelativePath="..\bindings\js\JSScriptProfileNodeCustom.cpp"
     39632                                        >
     39633                                        <FileConfiguration
     39634                                                Name="Debug|Win32"
     39635                                                ExcludedFromBuild="true"
     39636                                                >
     39637                                                <Tool
     39638                                                        Name="VCCLCompilerTool"
     39639                                                />
     39640                                        </FileConfiguration>
     39641                                        <FileConfiguration
     39642                                                Name="Release|Win32"
     39643                                                ExcludedFromBuild="true"
     39644                                                >
     39645                                                <Tool
     39646                                                        Name="VCCLCompilerTool"
     39647                                                />
     39648                                        </FileConfiguration>
     39649                                        <FileConfiguration
     39650                                                Name="Debug_Internal|Win32"
     39651                                                ExcludedFromBuild="true"
     39652                                                >
     39653                                                <Tool
     39654                                                        Name="VCCLCompilerTool"
     39655                                                />
     39656                                        </FileConfiguration>
     39657                                        <FileConfiguration
     39658                                                Name="Debug_Cairo|Win32"
     39659                                                ExcludedFromBuild="true"
     39660                                                >
     39661                                                <Tool
     39662                                                        Name="VCCLCompilerTool"
     39663                                                />
     39664                                        </FileConfiguration>
     39665                                        <FileConfiguration
     39666                                                Name="Release_Cairo|Win32"
     39667                                                ExcludedFromBuild="true"
     39668                                                >
     39669                                                <Tool
     39670                                                        Name="VCCLCompilerTool"
     39671                                                />
     39672                                        </FileConfiguration>
     39673                                        <FileConfiguration
     39674                                                Name="Debug_All|Win32"
     39675                                                ExcludedFromBuild="true"
     39676                                                >
     39677                                                <Tool
     39678                                                        Name="VCCLCompilerTool"
     39679                                                />
     39680                                        </FileConfiguration>
    3964539681                                </File>
    3964639682                                <File
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r57494 r57505  
    24932493                97DD4D870FDF4D6E00ECF9A4 /* XSSAuditor.h in Headers */ = {isa = PBXBuildFile; fileRef = 97DD4D850FDF4D6E00ECF9A4 /* XSSAuditor.h */; };
    24942494                97EF7DFE107E55B700D7C49C /* ScriptControllerBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97EF7DFD107E55B700D7C49C /* ScriptControllerBase.cpp */; };
    2495                 9F2A322B1125A0A2003C3056 /* JavaScriptProfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9F2A32271125A0A2003C3056 /* JavaScriptProfile.cpp */; };
    2496                 9F2A322C1125A0A2003C3056 /* JavaScriptProfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 9F2A32281125A0A2003C3056 /* JavaScriptProfile.h */; };
    2497                 9F2A322D1125A0A2003C3056 /* JavaScriptProfileNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9F2A32291125A0A2003C3056 /* JavaScriptProfileNode.cpp */; };
    2498                 9F2A322E1125A0A2003C3056 /* JavaScriptProfileNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 9F2A322A1125A0A2003C3056 /* JavaScriptProfileNode.h */; };
    24992495                9F6FC1961122E82A00E80196 /* ScriptDebugServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9F6FC1941122E82A00E80196 /* ScriptDebugServer.cpp */; };
    25002496                9F6FC1971122E82A00E80196 /* ScriptDebugServer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9F6FC1951122E82A00E80196 /* ScriptDebugServer.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    25022498                9F72305011184B4100AD0126 /* ScriptProfiler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9F72304D11184B4100AD0126 /* ScriptProfiler.cpp */; };
    25032499                9F72305111184B4100AD0126 /* ScriptProfiler.h in Headers */ = {isa = PBXBuildFile; fileRef = 9F72304E11184B4100AD0126 /* ScriptProfiler.h */; settings = {ATTRIBUTES = (Private, ); }; };
     2500                9FA37EE41172FC8000C4CD55 /* ScriptProfileNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 9FA37EE31172FC8000C4CD55 /* ScriptProfileNode.h */; settings = {ATTRIBUTES = (Private, ); }; };
     2501                9FA37EE71172FCF000C4CD55 /* JSScriptProfileNodeCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9FA37EE61172FCF000C4CD55 /* JSScriptProfileNodeCustom.cpp */; };
     2502                9FA37EFA1172FDA600C4CD55 /* JSScriptProfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9FA37EF61172FD9300C4CD55 /* JSScriptProfile.cpp */; };
     2503                9FA37EFB1172FDA600C4CD55 /* JSScriptProfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 9FA37EF71172FD9300C4CD55 /* JSScriptProfile.h */; };
     2504                9FA37EFC1172FDA600C4CD55 /* JSScriptProfileNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9FA37EF81172FD9300C4CD55 /* JSScriptProfileNode.cpp */; };
     2505                9FA37EFD1172FDA600C4CD55 /* JSScriptProfileNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 9FA37EF91172FD9300C4CD55 /* JSScriptProfileNode.h */; };
    25042506                A136A00C1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A136A00A1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.cpp */; };
    25052507                A136A00D1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.h in Headers */ = {isa = PBXBuildFile; fileRef = A136A00B1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.h */; };
     
    79287930                97DD4D850FDF4D6E00ECF9A4 /* XSSAuditor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XSSAuditor.h; sourceTree = "<group>"; };
    79297931                97EF7DFD107E55B700D7C49C /* ScriptControllerBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptControllerBase.cpp; sourceTree = "<group>"; };
    7930                 9F2A32271125A0A2003C3056 /* JavaScriptProfile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JavaScriptProfile.cpp; sourceTree = "<group>"; };
    7931                 9F2A32281125A0A2003C3056 /* JavaScriptProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JavaScriptProfile.h; sourceTree = "<group>"; };
    7932                 9F2A32291125A0A2003C3056 /* JavaScriptProfileNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JavaScriptProfileNode.cpp; sourceTree = "<group>"; };
    7933                 9F2A322A1125A0A2003C3056 /* JavaScriptProfileNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JavaScriptProfileNode.h; sourceTree = "<group>"; };
    79347932                9F6FC1941122E82A00E80196 /* ScriptDebugServer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptDebugServer.cpp; sourceTree = "<group>"; };
    79357933                9F6FC1951122E82A00E80196 /* ScriptDebugServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptDebugServer.h; sourceTree = "<group>"; };
     
    79377935                9F72304D11184B4100AD0126 /* ScriptProfiler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptProfiler.cpp; sourceTree = "<group>"; };
    79387936                9F72304E11184B4100AD0126 /* ScriptProfiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptProfiler.h; sourceTree = "<group>"; };
     7937                9FA37EE31172FC8000C4CD55 /* ScriptProfileNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptProfileNode.h; sourceTree = "<group>"; };
     7938                9FA37EE61172FCF000C4CD55 /* JSScriptProfileNodeCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSScriptProfileNodeCustom.cpp; sourceTree = "<group>"; };
     7939                9FA37EEF1172FD4100C4CD55 /* ScriptProfile.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ScriptProfile.idl; sourceTree = "<group>"; };
     7940                9FA37EF01172FD4100C4CD55 /* ScriptProfileNode.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ScriptProfileNode.idl; sourceTree = "<group>"; };
     7941                9FA37EF61172FD9300C4CD55 /* JSScriptProfile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSScriptProfile.cpp; sourceTree = "<group>"; };
     7942                9FA37EF71172FD9300C4CD55 /* JSScriptProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSScriptProfile.h; sourceTree = "<group>"; };
     7943                9FA37EF81172FD9300C4CD55 /* JSScriptProfileNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSScriptProfileNode.cpp; sourceTree = "<group>"; };
     7944                9FA37EF91172FD9300C4CD55 /* JSScriptProfileNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSScriptProfileNode.h; sourceTree = "<group>"; };
    79397945                A136A00A1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XMLHttpRequestProgressEventThrottle.cpp; sourceTree = "<group>"; };
    79407946                A136A00B1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XMLHttpRequestProgressEventThrottle.h; sourceTree = "<group>"; };
     
    1078510791                                1C5FAECF0DCFD90100D58F78 /* JSJavaScriptCallFrame.cpp */,
    1078610792                                1C5FAED00DCFD90100D58F78 /* JSJavaScriptCallFrame.h */,
     10793                                9FA37EF61172FD9300C4CD55 /* JSScriptProfile.cpp */,
     10794                                9FA37EF71172FD9300C4CD55 /* JSScriptProfile.h */,
     10795                                9FA37EF81172FD9300C4CD55 /* JSScriptProfileNode.cpp */,
     10796                                9FA37EF91172FD9300C4CD55 /* JSScriptProfileNode.h */,
    1078710797                        );
    1078810798                        name = Inspector;
     
    1083110841                                7AFD4A8A1131C2760035B883 /* ScriptBreakpoint.h */,
    1083210842                                7AFD4FF3113277B60035B883 /* ScriptDebugListener.h */,
     10843                                9FA37EEF1172FD4100C4CD55 /* ScriptProfile.idl */,
     10844                                9FA37EF01172FD4100C4CD55 /* ScriptProfileNode.idl */,
    1083310845                                7553CFE7108F473F00EA281E /* TimelineRecordFactory.cpp */,
    1083410846                                7553CFE6108F473F00EA281E /* TimelineRecordFactory.h */,
     
    1484414856                                1432E8480C51493F00B1500F /* GCController.cpp */,
    1484514857                                1432E8460C51493800B1500F /* GCController.h */,
    14846                                 9F2A32271125A0A2003C3056 /* JavaScriptProfile.cpp */,
    14847                                 9F2A32281125A0A2003C3056 /* JavaScriptProfile.h */,
    14848                                 9F2A32291125A0A2003C3056 /* JavaScriptProfileNode.cpp */,
    14849                                 9F2A322A1125A0A2003C3056 /* JavaScriptProfileNode.h */,
    1485014858                                B5D3601E112F8BA80048DEA8 /* JSDatabaseCallback.cpp */,
    1485114859                                B5D3601C112F8BA00048DEA8 /* JSDatabaseCallback.h */,
     
    1489914907                                41F066E20F64BCF600A07EAC /* ScriptObject.h */,
    1490014908                                9F72304C11184B4100AD0126 /* ScriptProfile.h */,
     14909                                9FA37EE31172FC8000C4CD55 /* ScriptProfileNode.h */,
    1490114910                                9F72304D11184B4100AD0126 /* ScriptProfiler.cpp */,
    1490214911                                9F72304E11184B4100AD0126 /* ScriptProfiler.h */,
     
    1504415053                                B297BC6F0B3C14CF0045A590 /* JSSVGPathSegListCustom.cpp */,
    1504515054                                087D97BE10FB8D7700C00874 /* JSSVGPODListCustom.h */,
     15055                                9FA37EE61172FCF000C4CD55 /* JSScriptProfileNodeCustom.cpp */,
    1504615056                                1A2C40AA0DEB55AA005AF19E /* JSTextCustom.cpp */,
    1504715057                                516BB7920CE91E6800512F79 /* JSTreeWalkerCustom.cpp */,
     
    1757417584                                E16982681134680700894115 /* JavaRuntimeObject.h in Headers */,
    1757517585                                1C81BA0A0E97348300266E07 /* JavaScriptCallFrame.h in Headers */,
    17576                                 9F2A322C1125A0A2003C3056 /* JavaScriptProfile.h in Headers */,
    17577                                 9F2A322E1125A0A2003C3056 /* JavaScriptProfileNode.h in Headers */,
    1757817586                                59BC393F11054A1300FD85DB /* JavaStringJSC.h in Headers */,
    1757917587                                1A569D040D7E2B82007C3983 /* jni_jsobject.h in Headers */,
     
    1883718845                                895253D9116C4C6800CABF00 /* FileStreamClient.h in Headers */,
    1883818846                                5DC87EF011716DF2001C0E6D /* EmptyProtocolDefinitions.h in Headers */,
     18847                                9FA37EE41172FC8000C4CD55 /* ScriptProfileNode.h in Headers */,
     18848                                9FA37EFB1172FDA600C4CD55 /* JSScriptProfile.h in Headers */,
     18849                                9FA37EFD1172FDA600C4CD55 /* JSScriptProfileNode.h in Headers */,
    1883918850                        );
    1884018851                        runOnlyForDeploymentPostprocessing = 0;
     
    1982519836                                E1698264113467F300894115 /* JavaRuntimeObject.cpp in Sources */,
    1982619837                                1C81BA090E97348300266E07 /* JavaScriptCallFrame.cpp in Sources */,
    19827                                 9F2A322B1125A0A2003C3056 /* JavaScriptProfile.cpp in Sources */,
    19828                                 9F2A322D1125A0A2003C3056 /* JavaScriptProfileNode.cpp in Sources */,
    1982919838                                1A569D030D7E2B82007C3983 /* jni_jsobject.mm in Sources */,
    1983019839                                1A569D050D7E2B82007C3983 /* jni_objc.mm in Sources */,
     
    2107021079                                A409C984116D0DDD007197BD /* AccessibilityProgressIndicator.cpp in Sources */,
    2107121080                                895253D7116C4C6800CABF00 /* FileStream.cpp in Sources */,
     21081                                9FA37EE71172FCF000C4CD55 /* JSScriptProfileNodeCustom.cpp in Sources */,
     21082                                9FA37EFA1172FDA600C4CD55 /* JSScriptProfile.cpp in Sources */,
     21083                                9FA37EFC1172FDA600C4CD55 /* JSScriptProfileNode.cpp in Sources */,
    2107221084                        );
    2107321085                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/WebCore/bindings/js/JSBindingsAllInOne.cpp

    r57134 r57505  
    114114#include "JSSVGPathSegCustom.cpp"
    115115#include "JSSVGPathSegListCustom.cpp"
     116#include "JSScriptProfileNodeCustom.cpp"
    116117#include "JSSharedWorkerConstructor.cpp"
    117118#include "JSSharedWorkerCustom.cpp"
  • trunk/WebCore/bindings/js/JSConsoleCustom.cpp

    r54277 r57505  
    2929
    3030#include "Console.h"
    31 #include "JavaScriptProfile.h"
     31#include "JSScriptProfile.h"
    3232#include "ScriptCallStack.h"
     33#include "ScriptProfile.h"
    3334#include <runtime/JSArray.h>
    3435
     
    3940#if ENABLE(JAVASCRIPT_DEBUGGER)
    4041
    41 typedef Vector<RefPtr<JSC::Profile> > ProfilesArray;
     42typedef Vector<RefPtr<ScriptProfile> > ProfilesArray;
    4243
    4344JSValue JSConsole::profiles(ExecState* exec) const
  • trunk/WebCore/bindings/js/JSScriptProfileNodeCustom.cpp

    r57503 r57505  
    11/*
    2  * Copyright (C) 2008 Apple Inc. All Rights Reserved.
     2 * Copyright (C) 2010 Apple Inc. All rights reserved.
     3 * Copyright (C) 2010 Google Inc. All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    1112 *    documentation and/or other materials provided with the distribution.
    1213 *
    13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
     14 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
    1415 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    1516 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    16  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
     17 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
    1718 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    1819 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     
    2627#include "config.h"
    2728
    28 #include "JSConsole.h"
     29#include "JSScriptProfileNode.h"
    2930
    30 #include "Console.h"
    31 #include "JavaScriptProfile.h"
    32 #include "ScriptCallStack.h"
     31#if ENABLE(JAVASCRIPT_DEBUGGER)
     32#include <profiler/ProfileNode.h>
     33#endif
     34
    3335#include <runtime/JSArray.h>
    3436
     
    3941#if ENABLE(JAVASCRIPT_DEBUGGER)
    4042
    41 typedef Vector<RefPtr<JSC::Profile> > ProfilesArray;
     43JSValue JSScriptProfileNode::callUID(ExecState* exec) const
     44{
     45    JSValue result = jsNumber(exec, impl()->callIdentifier().hash());
     46    return result;
     47}
    4248
    43 JSValue JSConsole::profiles(ExecState* exec) const
     49typedef Vector<RefPtr<ProfileNode> > ProfileNodesList;
     50
     51JSValue JSScriptProfileNode::children(ExecState* exec) const
    4452{
    45     const ProfilesArray& profiles = impl()->profiles();
     53    const ProfileNodesList& children = impl()->children();
    4654    MarkedArgumentBuffer list;
    4755
    48     ProfilesArray::const_iterator end = profiles.end();
    49     for (ProfilesArray::const_iterator iter = profiles.begin(); iter != end; ++iter)
     56    ProfileNodesList::const_iterator end = children.end();
     57    for (ProfileNodesList::const_iterator iter = children.begin(); iter != end; ++iter)
    5058        list.append(toJS(exec, iter->get()));
    5159
  • trunk/WebCore/bindings/js/ScriptProfileNode.h

    r57503 r57505  
    11/*
    2  * Copyright (C) 2008 Apple Inc. All Rights Reserved.
     2 * Copyright (C) 2010 Apple Inc. All rights reserved.
     3 * Copyright (C) 2010 Google Inc. All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    1112 *    documentation and/or other materials provided with the distribution.
    1213 *
    13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
     14 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
    1415 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    1516 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    16  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
     17 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
    1718 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    1819 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     
    2425 */
    2526
    26 #ifndef JavaScriptProfile_h
    27 #define JavaScriptProfile_h
     27#ifndef ScriptProfileNode_h
     28#define ScriptProfileNode_h
    2829
    2930#if ENABLE(JAVASCRIPT_DEBUGGER)
    30 
    31 #include <runtime/JSValue.h>
    32 
    33 namespace JSC {
    34 class ExecState;
    35 class Profile;
    36 }
     31#include <profiler/ProfileNode.h>
    3732
    3833namespace WebCore {
    3934
    40 JSC::JSValue toJS(JSC::ExecState*, JSC::Profile*);
     35typedef JSC::ProfileNode ScriptProfileNode;
    4136
    4237} // namespace WebCore
     
    4439#endif // ENABLE(JAVASCRIPT_DEBUGGER)
    4540
    46 #endif
     41#endif // ScriptProfileNode_h
  • trunk/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r57163 r57505  
    215215}
    216216
     217sub IsScriptProfileType
     218{
     219    my $type = shift;
     220    return 1 if ($type eq "ScriptProfile" or $type eq "ScriptProfileNode");
     221    return 0;
     222}
     223
     224sub AddTypedefForScriptProfileType
     225{
     226    my $type = shift;
     227    (my $jscType = $type) =~ s/Script//;
     228
     229    push(@headerContent, "typedef JSC::$jscType $type;\n\n");
     230}
     231
    217232sub AddClassForwardIfNeeded
    218233{
     
    220235
    221236    # SVGAnimatedLength/Number/etc. are typedefs to SVGAnimatedTemplate, so don't use class forwards for them!
    222     push(@headerContent, "class $implClassName;\n\n") unless $codeGenerator->IsSVGAnimatedType($implClassName);
     237    unless ($codeGenerator->IsSVGAnimatedType($implClassName) or IsScriptProfileType($implClassName)) {
     238        push(@headerContent, "class $implClassName;\n\n");
     239    # ScriptProfile and ScriptProfileNode are typedefs to JSC::Profile and JSC::ProfileNode.
     240    } elsif (IsScriptProfileType($implClassName)) {
     241        AddTypedefForScriptProfileType($implClassName);
     242    }
    223243}
    224244
  • trunk/WebCore/bindings/scripts/CodeGeneratorV8.pm

    r57207 r57505  
    21242124    return 1 if $interfaceName eq "SVGDocument";
    21252125    return 1 if $interfaceName eq "SVGElement";
     2126    return 1 if $interfaceName eq "ScriptProfile";
     2127    return 1 if $interfaceName eq "ScriptProfileNode";
    21262128    return 1 if $interfaceName eq "WorkerContext";
    21272129    # We don't generate a custom converter (but JSC does) for the following:
  • trunk/WebCore/bindings/v8/ScriptProfile.cpp

    r57503 r57505  
    3131#include "config.h"
    3232
    33 #include "ScriptProfiler.h"
     33#include "ScriptProfile.h"
     34
     35#include "V8Binding.h"
     36
     37#include <v8-profiler.h>
    3438
    3539namespace WebCore {
    3640
    37 void ScriptProfiler::start(ScriptState* state, const String& title)
     41String ScriptProfile::title() const
    3842{
    39     v8::HandleScope scope;
    40     v8::Context::Scope contextScope(v8::Context::GetCurrent());
    41     v8::V8::ResumeProfiler();
     43    return toWebCoreString(m_profile->GetTitle());
    4244}
    4345
    44 PassRefPtr<ScriptProfile> ScriptProfiler::stop(ScriptState* state, const String& title)
     46unsigned int ScriptProfile::uid() const
    4547{
    46     v8::V8::PauseProfiler();
    47     return 0;
     48    return m_profile->GetUid();
     49}
     50
     51PassRefPtr<ScriptProfileNode> ScriptProfile::head() const
     52{
     53    return ScriptProfileNode::create(m_profile->GetTopDownRoot());
    4854}
    4955
  • trunk/WebCore/bindings/v8/ScriptProfile.h

    r54277 r57505  
    3333
    3434#include "PlatformString.h"
     35#include "ScriptProfileNode.h"
     36
     37namespace v8 {
     38class CpuProfile;
     39}
    3540
    3641namespace WebCore {
     
    3843class ScriptProfile : public RefCounted<ScriptProfile> {
    3944public:
    40     static PassRefPtr<ScriptProfile> create(const String& title, unsigned uid)
     45    static PassRefPtr<ScriptProfile> create(const v8::CpuProfile* profile)
    4146    {
    42       return adoptRef(new ScriptProfile(title, uid));
     47        return adoptRef(new ScriptProfile(profile));
    4348    }
    4449    virtual ~ScriptProfile() {}
    4550
    46     String title() const { return m_title; }
    47     unsigned int uid() const { return m_uid; }
     51    String title() const;
     52    unsigned int uid() const;
     53    PassRefPtr<ScriptProfileNode> head() const;
    4854
    4955protected:
    50     ScriptProfile(const String& title, unsigned uid)
    51         : m_title(title)
    52         , m_uid(uid)
     56    ScriptProfile(const v8::CpuProfile* profile)
     57        : m_profile(profile)
    5358    {}
    5459
    5560private:
    56     String m_title;
    57     unsigned int m_uid;
     61    const v8::CpuProfile* m_profile;
    5862};
    5963
  • trunk/WebCore/bindings/v8/ScriptProfileNode.cpp

    r57503 r57505  
    3131#include "config.h"
    3232
    33 #include "ScriptProfiler.h"
     33#include "ScriptProfile.h"
     34
     35#include "V8Binding.h"
     36
     37#include <v8-profiler.h>
    3438
    3539namespace WebCore {
    3640
    37 void ScriptProfiler::start(ScriptState* state, const String& title)
     41String ScriptProfileNode::functionName() const
    3842{
    39     v8::HandleScope scope;
    40     v8::Context::Scope contextScope(v8::Context::GetCurrent());
    41     v8::V8::ResumeProfiler();
     43    return toWebCoreString(m_profileNode->GetFunctionName());
    4244}
    4345
    44 PassRefPtr<ScriptProfile> ScriptProfiler::stop(ScriptState* state, const String& title)
     46String ScriptProfileNode::url() const
    4547{
    46     v8::V8::PauseProfiler();
     48    return toWebCoreString(m_profileNode->GetScriptResourceName());
     49}
     50
     51unsigned long ScriptProfileNode::lineNumber() const
     52{
     53    return m_profileNode->GetLineNumber();
     54}
     55
     56double ScriptProfileNode::totalTime() const
     57{
     58    // FIXME: use GetTotalMilliseconds once it is implemented in V8.
     59    return m_profileNode->GetTotalSamplesCount();
     60}
     61
     62double ScriptProfileNode::selfTime() const
     63{
     64    // FIXME: use GetSelfMilliseconds once it is implemented in V8.
     65    return m_profileNode->GetSelfSamplesCount();
     66}
     67
     68unsigned long ScriptProfileNode::numberOfCalls() const
     69{
    4770    return 0;
    4871}
    4972
     73ProfileNodesList ScriptProfileNode::children() const
     74{
     75    const int childrenCount = m_profileNode->GetChildrenCount();
     76    ProfileNodesList result(childrenCount);
     77    for (int i = 0; i < childrenCount; ++i)
     78        result[i] = ScriptProfileNode::create(m_profileNode->GetChild(i));
     79    return result;
     80}
     81
     82bool ScriptProfileNode::visible() const
     83{
     84    return true;
     85}
     86
     87unsigned long ScriptProfileNode::callUID() const
     88{
     89    return m_profileNode->GetCallUid();
     90}
     91
    5092} // namespace WebCore
  • trunk/WebCore/bindings/v8/ScriptProfileNode.h

    r57503 r57505  
    2929 */
    3030
    31 #ifndef ScriptProfile_h
    32 #define ScriptProfile_h
     31#ifndef ScriptProfileNode_h
     32#define ScriptProfileNode_h
    3333
    3434#include "PlatformString.h"
    3535
     36namespace v8 {
     37class CpuProfileNode;
     38}
     39
    3640namespace WebCore {
    3741
    38 class ScriptProfile : public RefCounted<ScriptProfile> {
     42class ScriptProfileNode;
     43
     44typedef Vector<RefPtr<ScriptProfileNode> > ProfileNodesList;
     45
     46class ScriptProfileNode : public RefCounted<ScriptProfileNode> {
    3947public:
    40     static PassRefPtr<ScriptProfile> create(const String& title, unsigned uid)
     48    static PassRefPtr<ScriptProfileNode> create(const v8::CpuProfileNode* profileNode)
    4149    {
    42       return adoptRef(new ScriptProfile(title, uid));
     50        return adoptRef(new ScriptProfileNode(profileNode));
    4351    }
    44     virtual ~ScriptProfile() {}
     52    virtual ~ScriptProfileNode() {}
    4553
    46     String title() const { return m_title; }
    47     unsigned int uid() const { return m_uid; }
     54    String functionName() const;
     55    String url() const;
     56    unsigned long lineNumber() const;
     57    double totalTime() const;
     58    double selfTime() const;
     59    unsigned long numberOfCalls() const;
     60    ProfileNodesList children() const;
     61    bool visible() const;
     62    unsigned long callUID() const;
    4863
    4964protected:
    50     ScriptProfile(const String& title, unsigned uid)
    51         : m_title(title)
    52         , m_uid(uid)
     65    ScriptProfileNode(const v8::CpuProfileNode* profileNode)
     66        : m_profileNode(profileNode)
    5367    {}
    5468
    5569private:
    56     String m_title;
    57     unsigned int m_uid;
     70    const v8::CpuProfileNode* m_profileNode;
    5871};
    5972
    6073} // namespace WebCore
    6174
    62 #endif // ScriptProfile_h
     75#endif // ScriptProfileNode_h
  • trunk/WebCore/bindings/v8/ScriptProfiler.cpp

    r54277 r57505  
    3232
    3333#include "ScriptProfiler.h"
     34#include "ScriptString.h"
     35
     36#include <v8-profiler.h>
    3437
    3538namespace WebCore {
     
    3740void ScriptProfiler::start(ScriptState* state, const String& title)
    3841{
    39     v8::HandleScope scope;
    40     v8::Context::Scope contextScope(v8::Context::GetCurrent());
    41     v8::V8::ResumeProfiler();
     42    v8::HandleScope hs;
     43    v8::CpuProfiler::StartProfiling(v8String(title));
    4244}
    4345
    4446PassRefPtr<ScriptProfile> ScriptProfiler::stop(ScriptState* state, const String& title)
    4547{
    46     v8::V8::PauseProfiler();
    47     return 0;
     48    v8::HandleScope hs;
     49    const v8::CpuProfile* profile = v8::CpuProfiler::StopProfiling(v8String(title));
     50    return profile ? ScriptProfile::create(profile) : 0;
    4851}
    4952
  • trunk/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp

    r57503 r57505  
    11/*
    2  * Copyright (c) 2010, Google Inc. All rights reserved.
     2 * Copyright (C) 2010 Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3131#include "config.h"
    3232
    33 #include "ScriptProfiler.h"
     33#include "V8Console.h"
     34
     35#include "Console.h"
     36#include "ScriptProfile.h"
     37#include "V8Binding.h"
     38#include "V8Proxy.h"
     39#include "V8ScriptProfile.h"
    3440
    3541namespace WebCore {
    3642
    37 void ScriptProfiler::start(ScriptState* state, const String& title)
     43typedef Vector<RefPtr<ScriptProfile> > ProfilesArray;
     44
     45v8::Handle<v8::Value> V8Console::profilesAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
    3846{
    39     v8::HandleScope scope;
    40     v8::Context::Scope contextScope(v8::Context::GetCurrent());
    41     v8::V8::ResumeProfiler();
    42 }
    43 
    44 PassRefPtr<ScriptProfile> ScriptProfiler::stop(ScriptState* state, const String& title)
    45 {
    46     v8::V8::PauseProfiler();
    47     return 0;
     47    INC_STATS("DOM.Console.profilesAccessorGetter");
     48    Console* imp = V8Console::toNative(info.Holder());
     49    const ProfilesArray& profiles = imp->profiles();
     50    v8::Handle<v8::Array> result = v8::Array::New(profiles.size());
     51    int index = 0;
     52    ProfilesArray::const_iterator end = profiles.end();
     53    for (ProfilesArray::const_iterator iter = profiles.begin(); iter != end; ++iter)
     54        result->Set(v8::Integer::New(index++), toV8(iter->get()));
     55    return result;
    4856}
    4957
  • trunk/WebCore/bindings/v8/custom/V8ScriptProfileCustom.cpp

    r57503 r57505  
    11/*
    2  * Copyright (c) 2010, Google Inc. All rights reserved.
     2 * Copyright (C) 2010 Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3030
    3131#include "config.h"
     32#include "V8ScriptProfile.h"
    3233
    33 #include "ScriptProfiler.h"
     34#include "ScriptProfile.h"
     35#include "V8Binding.h"
     36#include "V8Proxy.h"
     37
     38#include <v8-profiler.h>
    3439
    3540namespace WebCore {
    3641
    37 void ScriptProfiler::start(ScriptState* state, const String& title)
     42v8::Handle<v8::Value> toV8(ScriptProfile* impl)
    3843{
    39     v8::HandleScope scope;
    40     v8::Context::Scope contextScope(v8::Context::GetCurrent());
    41     v8::V8::ResumeProfiler();
    42 }
    43 
    44 PassRefPtr<ScriptProfile> ScriptProfiler::stop(ScriptState* state, const String& title)
    45 {
    46     v8::V8::PauseProfiler();
    47     return 0;
     44    if (!impl)
     45        return v8::Null();
     46    v8::Local<v8::Function> function = V8ScriptProfile::GetTemplate()->GetFunction();
     47    if (function.IsEmpty()) {
     48        // Return if allocation failed.
     49        return v8::Local<v8::Object>();
     50    }
     51    v8::Local<v8::Object> instance = SafeAllocation::newInstance(function);
     52    if (instance.IsEmpty()) {
     53        // Avoid setting the wrapper if allocation failed.
     54        return v8::Local<v8::Object>();
     55    }
     56    impl->ref();
     57    V8DOMWrapper::setDOMWrapper(instance, &V8ScriptProfile::info, impl);
     58    return instance;
    4859}
    4960
  • trunk/WebCore/inspector/InspectorController.cpp

    r57337 r57505  
    100100#if ENABLE(JAVASCRIPT_DEBUGGER)
    101101#include "ScriptDebugServer.h"
    102 #endif
    103 
    104 #if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC)
    105 #include "JavaScriptProfile.h"
    106 
     102#if USE(JSC)
    107103#include <runtime/JSLock.h>
    108104#include <runtime/UString.h>
     105#include "JSScriptProfile.h"
     106#else
     107#include "V8ScriptProfile.h"
     108#endif
    109109#endif
    110110
     
    13751375        return;
    13761376    ProfilesMap::iterator it = m_profiles.find(uid);
     1377    if (it != m_profiles.end())
    13771378#if USE(JSC)
    1378     if (it != m_profiles.end())
    13791379        m_frontend->didGetProfile(callId, toJS(m_frontend->scriptState(), it->second.get()));
     1380#else
     1381        m_frontend->didGetProfile(callId, toV8(it->second.get()));
    13801382#endif
    13811383}
  • trunk/WebCore/inspector/ScriptProfile.idl

    r57503 r57505  
    11/*
    2  * Copyright (C) 2008 Apple Inc. All Rights Reserved.
     2 * Copyright (C) 2010 Apple Inc. All rights reserved.
     3 * Copyright (C) 2010 Google Inc. All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    1112 *    documentation and/or other materials provided with the distribution.
    1213 *
    13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
     14 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
    1415 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    1516 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    16  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
     17 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
    1718 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    1819 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     
    2425 */
    2526
    26 #ifndef JavaScriptProfileNode_h
    27 #define JavaScriptProfileNode_h
     27module core {
    2828
    29 #if ENABLE(JAVASCRIPT_DEBUGGER)
     29    interface [Conditional=JAVASCRIPT_DEBUGGER, OmitConstructor] ScriptProfile {
     30        readonly attribute DOMString title;
     31        readonly attribute unsigned long uid;
     32        readonly attribute ScriptProfileNode head;
     33    };
    3034
    31 #include <JavaScriptCore/JSBase.h>
    32 #include <runtime/JSValue.h>
    33 
    34 namespace JSC {
    35 class ExecState;
    36 class ProfileNode;
    3735}
    38 
    39 namespace WebCore {
    40 
    41 JSClassRef ProfileNodeClass();
    42 JSC::JSValue toJS(JSC::ExecState*, JSC::ProfileNode*);
    43 
    44 } // namespace WebCore
    45 
    46 #endif // ENABLE(JAVASCRIPT_DEBUGGER)
    47 
    48 #endif
  • trunk/WebCore/inspector/ScriptProfileNode.idl

    r57503 r57505  
    11/*
    2  * Copyright (C) 2008 Apple Inc. All Rights Reserved.
     2 * Copyright (C) 2010 Apple Inc. All rights reserved.
     3 * Copyright (C) 2010 Google Inc. All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    1112 *    documentation and/or other materials provided with the distribution.
    1213 *
    13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
     14 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
    1415 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    1516 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    16  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
     17 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
    1718 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    1819 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     
    2425 */
    2526
    26 #ifndef JavaScriptProfileNode_h
    27 #define JavaScriptProfileNode_h
     27module core {
    2828
    29 #if ENABLE(JAVASCRIPT_DEBUGGER)
     29    interface [Conditional=JAVASCRIPT_DEBUGGER, OmitConstructor] ScriptProfileNode {
     30        readonly attribute DOMString functionName;
     31        readonly attribute DOMString url;
     32        readonly attribute unsigned long lineNumber;
     33        readonly attribute double totalTime;
     34        readonly attribute double selfTime;
     35        readonly attribute unsigned long numberOfCalls;
     36        readonly attribute [CustomGetter] Array children;
     37        readonly attribute boolean visible;
     38        readonly attribute [CustomGetter] unsigned long callUID;
     39    };
    3040
    31 #include <JavaScriptCore/JSBase.h>
    32 #include <runtime/JSValue.h>
    33 
    34 namespace JSC {
    35 class ExecState;
    36 class ProfileNode;
    3741}
    38 
    39 namespace WebCore {
    40 
    41 JSClassRef ProfileNodeClass();
    42 JSC::JSValue toJS(JSC::ExecState*, JSC::ProfileNode*);
    43 
    44 } // namespace WebCore
    45 
    46 #endif // ENABLE(JAVASCRIPT_DEBUGGER)
    47 
    48 #endif
  • trunk/WebCore/inspector/front-end/InspectorBackendStub.js

    r55537 r57505  
    215215    getProfile: function(callId, uid)
    216216    {
    217         if (WebInspector.__fullProfiles && (uid in WebInspector.__fullProfiles))
    218         {
    219             WebInspector.didGetProfile(callId, WebInspector.__fullProfiles[uid]);
    220         }
    221217    },
    222218
  • trunk/WebCore/inspector/front-end/ProfilesPanel.js

    r56711 r57505  
    165165    populateInterface: function()
    166166    {
     167        this.reset();
    167168        if (this.visible)
    168169            this._populateProfiles();
     
    177178
    178179        this._profilerEnabled = true;
    179         this.reset();
    180180        this.populateInterface();
    181181    },
  • trunk/WebCore/page/Console.idl

    r54576 r57505  
    3131    interface [OmitConstructor] Console {
    3232
    33         // Not enabled in V8 because it requires request-reply style.
    34 #if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER && !(defined(V8_BINDING) && V8_BINDING)
     33#if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER
    3534        readonly attribute [CustomGetter] Array profiles;
    3635#endif
  • trunk/WebCore/platform/android/TemporaryLinkStubs.cpp

    r56825 r57505  
    8585#include "JNIUtilityPrivate.h"
    8686#include "JavaScriptCallFrame.h"
    87 #include "JavaScriptProfile.h"
    8887#include "ScriptDebugServer.h"
    8988#endif
  • trunk/WebKit/chromium/ChangeLog

    r57469 r57505  
     12010-04-12  Mikhail Naganov  <mnaganov@chromium.org>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Replace hand-written JavaScriptProfile* bindings with idl-based, and
     6        in Chromium port, bind them to the new V8's profiler API that is
     7        aligned with JSC.
     8
     9        https://bugs.webkit.org/show_bug.cgi?id=37448
     10
     11        * src/js/InspectorControllerImpl.js:
     12        (devtools.InspectorBackendImpl):
     13        * src/js/ProfilerAgent.js:
     14        (devtools.ProfilerAgent):
     15        (devtools.ProfilerAgent.prototype.initializeProfiling):
     16        (devtools.ProfilerAgent.prototype._didGetActiveProfilerModules):
     17        (devtools.ProfilerAgent.prototype._didGetLogLines):
     18        * src/js/Tests.js:
     19
    1202010-04-11  Sheriff Bot  <webkit.review.bot@gmail.com>
    221
  • trunk/WebKit/chromium/src/js/InspectorControllerImpl.js

    r56448 r57505  
    5555    this.installInspectorControllerDelegate_("getDOMStorageEntries");
    5656    this.installInspectorControllerDelegate_("getEventListenersForNode");
     57    this.installInspectorControllerDelegate_("getProfile");
     58    this.installInspectorControllerDelegate_("getProfileHeaders");
    5759    this.installInspectorControllerDelegate_("getResourceContent");
    5860    this.installInspectorControllerDelegate_("highlightDOMNode");
     
    6971    this.installInspectorControllerDelegate_("setInjectedScriptSource");
    7072    this.installInspectorControllerDelegate_("setTextNodeValue");
     73    this.installInspectorControllerDelegate_("startProfiling");
    7174    this.installInspectorControllerDelegate_("startTimelineProfiler");
     75    this.installInspectorControllerDelegate_("stopProfiling");
    7276    this.installInspectorControllerDelegate_("stopTimelineProfiler");
    7377    this.installInspectorControllerDelegate_("storeLastActivePanel");
     
    194198 * @override
    195199 */
    196 devtools.InspectorBackendImpl.prototype.startProfiling = function()
    197 {
    198     devtools.tools.getProfilerAgent().startProfiling(devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_CPU);
    199 };
    200 
    201 
    202 /**
    203  * @override
    204  */
    205 devtools.InspectorBackendImpl.prototype.stopProfiling = function()
    206 {
    207     devtools.tools.getProfilerAgent().stopProfiling( devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_CPU);
    208 };
    209 
    210 
    211 /**
    212  * @override
    213  */
    214 devtools.InspectorBackendImpl.prototype.getProfileHeaders = function(callId)
    215 {
    216     WebInspector.didGetProfileHeaders(callId, []);
    217 };
    218 
    219 
    220 /**
    221  * Emulate WebKit InspectorController behavior. It stores profiles on renderer side,
    222  * and is able to retrieve them by uid using "getProfile".
    223  */
    224 devtools.InspectorBackendImpl.prototype.addFullProfile = function(profile)
    225 {
    226     WebInspector.__fullProfiles = WebInspector.__fullProfiles || {};
    227     WebInspector.__fullProfiles[profile.uid] = profile;
    228 };
    229 
    230 
    231 /**
    232  * @override
    233  */
    234 devtools.InspectorBackendImpl.prototype.getProfile = function(callId, uid)
    235 {
    236     if (WebInspector.__fullProfiles && (uid in WebInspector.__fullProfiles))
    237         WebInspector.didGetProfile(callId, WebInspector.__fullProfiles[uid]);
    238 };
    239 
    240 
    241 /**
    242  * @override
    243  */
    244200devtools.InspectorBackendImpl.prototype.takeHeapSnapshot = function()
    245201{
  • trunk/WebKit/chromium/src/js/ProfilerAgent.js

    r54667 r57505  
    4242
    4343    /**
    44      * Active profiler modules flags.
    45      * @type {number}
    46      */
    47     this._activeProfilerModules = devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_NONE;
    48 
    49     /**
    50      * Interval for polling profiler state.
    51      * @type {number}
    52      */
    53     this._getActiveProfilerModulesInterval = null;
    54 
    55     /**
    5644     * Profiler log position.
    5745     * @type {number}
     
    6452     */
    6553    this._lastRequestedLogPosition = -1;
    66 
    67     /**
    68      * Whether log contents retrieval must be forced next time.
    69      * @type {boolean}
    70      */
    71     this._forceGetLogLines = false;
    7254
    7355    /**
     
    9375
    9476/**
    95  * Sets up callbacks that deal with profiles processing.
    96  */
    97 devtools.ProfilerAgent.prototype.setupProfilerProcessorCallbacks = function()
    98 {
    99     // A temporary icon indicating that the profile is being processed.
    100     var processingIcon = new WebInspector.SidebarTreeElement(
    101         "profile-sidebar-tree-item",
    102         WebInspector.UIString("Processing..."),
    103         '', null, false);
    104     var profilesSidebar = WebInspector.panels.profiles.getProfileType(WebInspector.CPUProfileType.TypeId).treeElement;
    105 
    106     this._profilerProcessor.setCallbacks(
    107         function onProfileProcessingStarted() {
    108             // Set visually empty string. Subtitle hiding is done via styles
    109             // manipulation which doesn't play well with dynamic append / removal.
    110             processingIcon.subtitle = " ";
    111             profilesSidebar.appendChild(processingIcon);
    112         },
    113         function onProfileProcessingStatus(ticksCount) {
    114             processingIcon.subtitle = WebInspector.UIString("%d ticks processed", ticksCount);
    115         },
    116         function onProfileProcessingFinished(profile) {
    117             profilesSidebar.removeChild(processingIcon);
    118             profile.typeId = WebInspector.CPUProfileType.TypeId;
    119             InspectorBackend.addFullProfile(profile);
    120             WebInspector.addProfileHeader(profile);
    121             // If no profile is currently shown, show the new one.
    122             var profilesPanel = WebInspector.panels.profiles;
    123             if (!profilesPanel.visibleView) {
    124                 profilesPanel.showProfile(profile);
    125             }
    126         }
    127     );
    128 };
    129 
    130 
    131 /**
    13277 * Initializes profiling state.
    13378 */
    13479devtools.ProfilerAgent.prototype.initializeProfiling = function()
    13580{
    136     this.setupProfilerProcessorCallbacks();
    137     this._forceGetLogLines = true;
    138     this._getActiveProfilerModulesInterval = setInterval(function() { RemoteProfilerAgent.getActiveProfilerModules(); }, 1000);
     81    this._getNextLogLines(false);
    13982};
    14083
     
    194137devtools.ProfilerAgent.prototype._didGetActiveProfilerModules = function(modules)
    195138{
    196     var profModules = devtools.ProfilerAgent.ProfilerModules;
    197     var profModuleNone = profModules.PROFILER_MODULE_NONE;
    198     if (this._forceGetLogLines || (modules !== profModuleNone && this._activeProfilerModules === profModuleNone)) {
    199         this._forceGetLogLines = false;
    200         // Start to query log data.
    201         this._getNextLogLines(true);
    202     }
    203     this._activeProfilerModules = modules;
    204     // Update buttons.
    205     WebInspector.setRecordingProfile(modules & profModules.PROFILER_MODULE_CPU);
    206139};
    207140
     
    215148{
    216149    this._logPosition = pos;
    217     if (log.length > 0)
     150    if (log.length > 0) {
    218151        this._profilerProcessor.processLogChunk(log);
    219     else {
     152        this._getNextLogLines();
     153    } else {
    220154        // Allow re-reading from the last position.
    221155        this._lastRequestedLogPosition = this._logPosition - 1;
    222         if (this._activeProfilerModules === devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_NONE)
    223             // No new data and profiling is stopped---suspend log reading.
    224             return;
    225156    }
    226     this._getNextLogLines();
    227157};
  • trunk/WebKit/chromium/src/js/Tests.js

    r55538 r57505  
    422422 * Tests that profiler works.
    423423 */
     424/*
     425// FIXME: disable for now. Need to change js_test.html page in Chromium repo first.
     426
    424427TestSuite.prototype.testProfilerTab = function()
    425428{
     
    461464    this.takeControl();
    462465};
     466*/
    463467
    464468
Note: See TracChangeset for help on using the changeset viewer.