⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 102187 in webkit


Ignore:
Timestamp:
Dec 6, 2011, 3:49:19 PM (15 years ago)
Author:
pfeldman@chromium.org
Message:

Web Inspector: introduce a memory agent stub.
https://bugs.webkit.org/show_bug.cgi?id=73930

Reviewed by Timothy Hatcher.

We'd like to experiment with the memory stats and hence need a
nice home for that. Adding this undocumented agent / domain for now.

  • CMakeLists.txt:
  • GNUmakefile.list.am:
  • Target.pri:
  • WebCore.gypi:
  • WebCore.vcproj/WebCore.vcproj:
  • WebCore.xcodeproj/project.pbxproj:
  • bindings/js/ScriptProfiler.h:

(WebCore::ScriptProfiler::nodeCount):

  • bindings/v8/ScriptProfiler.cpp:

(WebCore::ScriptProfiler::nodeCount):

  • bindings/v8/ScriptProfiler.h:
  • inspector/Inspector.json:
  • inspector/InspectorController.cpp:

(WebCore::InspectorController::InspectorController):

  • inspector/InspectorMemoryAgent.cpp: Added.

(WebCore::InspectorMemoryAgent::~InspectorMemoryAgent):
(WebCore::InspectorMemoryAgent::getNodeCounter):
(WebCore::InspectorMemoryAgent::InspectorMemoryAgent):

  • inspector/InspectorMemoryAgent.h: Added.

(WebCore::InspectorMemoryAgent::create):

Location:
trunk/Source/WebCore
Files:
2 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/CMakeLists.txt

    r101932 r102187  
    887887    inspector/InspectorFrontendHost.cpp
    888888    inspector/InspectorInstrumentation.cpp
     889    inspector/InspectorMemoryAgent.cpp
    889890    inspector/InspectorProfilerAgent.cpp
    890891    inspector/InspectorResourceAgent.cpp
  • trunk/Source/WebCore/ChangeLog

    r102186 r102187  
     12011-12-06  Pavel Feldman  <pfeldman@google.com>
     2
     3        Web Inspector: introduce a memory agent stub.
     4        https://bugs.webkit.org/show_bug.cgi?id=73930
     5
     6        Reviewed by Timothy Hatcher.
     7
     8        We'd like to experiment with the memory stats and hence need a
     9        nice home for that. Adding this undocumented agent / domain for now.
     10
     11        * CMakeLists.txt:
     12        * GNUmakefile.list.am:
     13        * Target.pri:
     14        * WebCore.gypi:
     15        * WebCore.vcproj/WebCore.vcproj:
     16        * WebCore.xcodeproj/project.pbxproj:
     17        * bindings/js/ScriptProfiler.h:
     18        (WebCore::ScriptProfiler::nodeCount):
     19        * bindings/v8/ScriptProfiler.cpp:
     20        (WebCore::ScriptProfiler::nodeCount):
     21        * bindings/v8/ScriptProfiler.h:
     22        * inspector/Inspector.json:
     23        * inspector/InspectorController.cpp:
     24        (WebCore::InspectorController::InspectorController):
     25        * inspector/InspectorMemoryAgent.cpp: Added.
     26        (WebCore::InspectorMemoryAgent::~InspectorMemoryAgent):
     27        (WebCore::InspectorMemoryAgent::getNodeCounter):
     28        (WebCore::InspectorMemoryAgent::InspectorMemoryAgent):
     29        * inspector/InspectorMemoryAgent.h: Added.
     30        (WebCore::InspectorMemoryAgent::create):
     31
    1322011-12-06  Julien Chaffraix  <jchaffraix@webkit.org>
    233
  • trunk/Source/WebCore/GNUmakefile.list.am

    r101932 r102187  
    20682068        Source/WebCore/inspector/InspectorInstrumentation.cpp \
    20692069        Source/WebCore/inspector/InspectorInstrumentation.h \
     2070        Source/WebCore/inspector/InspectorMemoryAgent.cpp \
     2071        Source/WebCore/inspector/InspectorMemoryAgent.h \
    20702072        Source/WebCore/inspector/InspectorPageAgent.cpp \
    20712073        Source/WebCore/inspector/InspectorPageAgent.h \
  • trunk/Source/WebCore/Target.pri

    r102067 r102187  
    867867    inspector/InspectorFrontendHost.cpp \
    868868    inspector/InspectorInstrumentation.cpp \
     869    inspector/InspectorMemoryAgent.cpp \
    869870    inspector/InspectorPageAgent.cpp \
    870871    inspector/InspectorProfilerAgent.cpp \
     
    19111912    inspector/InspectorFrontendHost.h \
    19121913    inspector/InspectorInstrumentation.h \
     1914    inspector/InspectorMemoryAgent.h \
    19131915    inspector/InspectorPageAgent.h \
    19141916    inspector/InspectorProfilerAgent.h \
  • trunk/Source/WebCore/WebCore.gypi

    r102181 r102187  
    27562756            'inspector/InspectorInstrumentation.cpp',
    27572757            'inspector/InspectorInstrumentation.h',
     2758            'inspector/InspectorMemoryAgent.cpp',
     2759            'inspector/InspectorMemoryAgent.h',
    27582760            'inspector/InspectorPageAgent.cpp',
    27592761            'inspector/InspectorPageAgent.h',
  • trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj

    r101932 r102187  
    6853568535                        </File>
    6853668536                        <File
     68537                                RelativePath="..\inspector\InspectorMemoryAgent.cpp"
     68538                                >
     68539                        </File>
     68540                        <File
     68541                                RelativePath="..\inspector\InspectorMemoryAgent.h"
     68542                                >
     68543                        </File>
     68544                        <File
    6853768545                                RelativePath="..\inspector\InspectorPageAgent.cpp"
    6853868546                                >
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r102097 r102187  
    18201820                7AA51B6E1483B61600AD2752 /* InspectorBaseAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AA51B6C1483B61600AD2752 /* InspectorBaseAgent.h */; settings = {ATTRIBUTES = (Private, ); }; };
    18211821                7AA51B6F1483B61600AD2752 /* InspectorBaseAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AA51B6D1483B61600AD2752 /* InspectorBaseAgent.cpp */; };
     1822                7AA51DD5148506A900AD2752 /* InspectorMemoryAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AA51DD3148506A900AD2752 /* InspectorMemoryAgent.cpp */; };
     1823                7AA51DD6148506A900AD2752 /* InspectorMemoryAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AA51DD4148506A900AD2752 /* InspectorMemoryAgent.h */; };
    18221824                7AB0B1C01211A62200A76940 /* InspectorDatabaseAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AB0B1BE1211A62200A76940 /* InspectorDatabaseAgent.cpp */; };
    18231825                7AB0B1C11211A62200A76940 /* InspectorDatabaseAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AB0B1BF1211A62200A76940 /* InspectorDatabaseAgent.h */; };
     
    90679069                7AA51B6C1483B61600AD2752 /* InspectorBaseAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorBaseAgent.h; sourceTree = "<group>"; };
    90689070                7AA51B6D1483B61600AD2752 /* InspectorBaseAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorBaseAgent.cpp; sourceTree = "<group>"; };
     9071                7AA51DD3148506A900AD2752 /* InspectorMemoryAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorMemoryAgent.cpp; sourceTree = "<group>"; };
     9072                7AA51DD4148506A900AD2752 /* InspectorMemoryAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorMemoryAgent.h; sourceTree = "<group>"; };
    90699073                7AB0B1BE1211A62200A76940 /* InspectorDatabaseAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorDatabaseAgent.cpp; sourceTree = "<group>"; };
    90709074                7AB0B1BF1211A62200A76940 /* InspectorDatabaseAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorDatabaseAgent.h; sourceTree = "<group>"; };
     
    1454914553                                20D629241253690B00081543 /* InspectorInstrumentation.cpp */,
    1455014554                                20D629251253690B00081543 /* InspectorInstrumentation.h */,
     14555                                7AA51DD3148506A900AD2752 /* InspectorMemoryAgent.cpp */,
     14556                                7AA51DD4148506A900AD2752 /* InspectorMemoryAgent.h */,
    1455114557                                4F6FDD621341DEDD001F8EE3 /* InspectorPageAgent.cpp */,
    1455214558                                4F6FDD631341DEDD001F8EE3 /* InspectorPageAgent.h */,
     
    2474324749                                312C0C41146DC6CC0016C911 /* Notification.h in Headers */,
    2474424750                                3128CA6B147331630074C72A /* NotificationController.h in Headers */,
     24751                                7AA51DD6148506A900AD2752 /* InspectorMemoryAgent.h in Headers */,
    2474524752                                5038BF2814750F190095E0D1 /* CustomFilterOperation.h in Headers */,
    2474624753                                5038BF2914750F190095E0D1 /* FilterOperation.h in Headers */,
     
    2762027627                                A10DC76A14747BAB005E2471 /* StyleGridData.cpp in Sources */,
    2762127628                                3128CA68147331520074C72A /* NotificationController.cpp in Sources */,
     27629                                7AA51DD5148506A900AD2752 /* InspectorMemoryAgent.cpp in Sources */,
    2762227630                                5038BF2A14750F190095E0D1 /* FilterOperations.cpp in Sources */,
    2762327631                                6E3FAD3814733F4000E42306 /* JSWebGLCompressedTextures.cpp in Sources */,
  • trunk/Source/WebCore/bindings/js/ScriptProfiler.h

    r101651 r102187  
    5959    static bool isSampling() { return false; }
    6060    static bool hasHeapProfiler() { return false; }
     61    // FIXME: Implement this counter for JSC. See bug 73936 for more details.
     62    static unsigned domNodeCount() { return 0; }
    6163};
    6264
  • trunk/Source/WebCore/bindings/v8/ScriptProfiler.cpp

    r97611 r102187  
    3636#include "RetainedDOMInfo.h"
    3737#include "V8Binding.h"
     38#include "V8DOMMap.h"
    3839#include "V8Node.h"
    3940
     
    146147}
    147148
     149namespace {
     150
     151class CounterVisitor : public DOMWrapperMap<Node>::Visitor {
     152public:
     153    CounterVisitor() : m_count(0) { }
     154
     155    void visitDOMWrapper(DOMDataStore* store, Node* node, v8::Persistent<v8::Object> wrapper)
     156    {
     157        Node* rootNode = node;
     158        while (rootNode->parentNode())
     159            rootNode = rootNode->parentNode();
     160
     161        if (m_roots.contains(rootNode))
     162            return;
     163        m_roots.add(rootNode);
     164
     165        Node* currentNode = rootNode;
     166        while ((currentNode = currentNode->traverseNextNode(rootNode)))
     167            ++m_count;
     168    }
     169
     170    unsigned nodeCount()
     171    {
     172        return m_count;
     173    }
     174private:
     175    HashSet<Node*> m_roots;
     176    unsigned m_count;
     177};
     178
     179} // namespace
     180
     181unsigned ScriptProfiler::domNodeCount()
     182{
     183    CounterVisitor counterVisitor;
     184    visitDOMNodes(&counterVisitor);
     185    return counterVisitor.nodeCount();
     186}
     187
    148188
    149189} // namespace WebCore
  • trunk/Source/WebCore/bindings/v8/ScriptProfiler.h

    r101651 r102187  
    6464    static bool hasHeapProfiler() { return true; }
    6565    static void initialize();
     66    static unsigned domNodeCount();
    6667};
    6768
  • trunk/Source/WebCore/inspector/Inspector.json

    r102140 r102187  
    4242                "parameters": [
    4343                    { "name": "id", "type": "integer" }
     44                ]
     45            }
     46        ]
     47    },
     48    {
     49        "domain": "Memory",
     50        "hidden": true,
     51        "commands": [
     52            {
     53                "name": "getDOMNodeCount",
     54                "returns": [
     55                    { "name": "count", "type": "integer" }
    4456                ]
    4557            }
  • trunk/Source/WebCore/inspector/InspectorController.cpp

    r101754 r102187  
    5454#include "InspectorFrontendClient.h"
    5555#include "InspectorInstrumentation.h"
     56#include "InspectorMemoryAgent.h"
    5657#include "InspectorPageAgent.h"
    5758#include "InspectorProfilerAgent.h"
     
    136137#endif
    137138
     139    m_agents.append(InspectorMemoryAgent::create(m_instrumentingAgents.get(), m_state.get(), m_page));
     140
    138141    ASSERT_ARG(inspectorClient, inspectorClient);
    139142    m_injectedScriptManager->injectedScriptHost()->init(m_inspectorAgent
Note: See TracChangeset for help on using the changeset viewer.