Rollout r142618, it broke all the Mac builds.
authorjberlin@webkit.org <jberlin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Feb 2013 17:37:39 +0000 (17:37 +0000)
committerjberlin@webkit.org <jberlin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Feb 2013 17:37:39 +0000 (17:37 +0000)
Source/WebCore:

* inspector/HeapGraphSerializer.cpp:
(WebCore::HeapGraphSerializer::HeapGraphSerializer):
(WebCore::HeapGraphSerializer::pushUpdate):
(WebCore::HeapGraphSerializer::reportNode):
(WebCore::HeapGraphSerializer::toNodeId):
(WebCore::HeapGraphSerializer::addRootNode):
* inspector/HeapGraphSerializer.h:
(WebCore):
(HeapGraphSerializer):
* inspector/InspectorMemoryAgent.cpp:
(WebCore::InspectorMemoryAgent::getProcessMemoryDistributionImpl):

Tools:

* TestWebKitAPI/TestWebKitAPI.gypi:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebCore/HeapGraphSerializerTest.cpp: Removed.
* TestWebKitAPI/win/TestWebKitAPI.vcproj:

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

Source/WebCore/ChangeLog
Source/WebCore/inspector/HeapGraphSerializer.cpp
Source/WebCore/inspector/HeapGraphSerializer.h
Source/WebCore/inspector/InspectorMemoryAgent.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.gypi
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebCore/HeapGraphSerializerTest.cpp [deleted file]
Tools/TestWebKitAPI/win/TestWebKitAPI.vcproj

index 5cbed25..f437580 100644 (file)
@@ -1,3 +1,19 @@
+2013-02-12  Jessie Berlin  <jberlin@apple.com>
+
+        Rollout r142618, it broke all the Mac builds.
+
+        * inspector/HeapGraphSerializer.cpp:
+        (WebCore::HeapGraphSerializer::HeapGraphSerializer):
+        (WebCore::HeapGraphSerializer::pushUpdate):
+        (WebCore::HeapGraphSerializer::reportNode):
+        (WebCore::HeapGraphSerializer::toNodeId):
+        (WebCore::HeapGraphSerializer::addRootNode):
+        * inspector/HeapGraphSerializer.h:
+        (WebCore):
+        (HeapGraphSerializer):
+        * inspector/InspectorMemoryAgent.cpp:
+        (WebCore::InspectorMemoryAgent::getProcessMemoryDistributionImpl):
+
 2013-02-12  Rafael Weinstein  <rafaelw@chromium.org>
 
         [HTMLTemplateElement] <template> inside of <head> may not create <body> if EOF is hit
index dbe2bdc..1479517 100644 (file)
 
 namespace WebCore {
 
-HeapGraphSerializer::HeapGraphSerializer(Client* client)
-    : m_client(client)
+HeapGraphSerializer::HeapGraphSerializer(InspectorFrontend::Memory* frontend)
+    : m_frontend(frontend)
     , m_strings(Strings::create())
     , m_edges(Edges::create())
     , m_nodeEdgesCount(0)
     , m_nodes(Nodes::create())
     , m_baseToRealNodeIdMap(BaseToRealNodeIdMap::create())
-    , m_leafCount(0)
 {
-    ASSERT(m_client);
+    ASSERT(m_frontend);
     m_strings->addItem(String()); // An empty string with 0 index.
 
     memset(m_edgeTypes, 0, sizeof(m_edgeTypes));
@@ -92,7 +91,7 @@ void HeapGraphSerializer::pushUpdate()
         .setEdges(m_edges.release())
         .setBaseToRealNodeId(m_baseToRealNodeIdMap.release());
 
-    m_client->addNativeSnapshotChunk(chunk.release());
+    m_frontend->addNativeSnapshotChunk(chunk);
 
     m_strings = Strings::create();
     m_edges = Edges::create();
@@ -102,7 +101,6 @@ void HeapGraphSerializer::pushUpdate()
 
 void HeapGraphSerializer::reportNode(const WTF::MemoryObjectInfo& info)
 {
-    ASSERT(info.reportedPointer());
     reportNodeImpl(info, m_nodeEdgesCount);
     m_nodeEdgesCount = 0;
     if (info.isRoot())
@@ -184,10 +182,8 @@ int HeapGraphSerializer::addString(const String& string)
 
 int HeapGraphSerializer::toNodeId(const void* to)
 {
-    if (!to)
-        return s_firstNodeId + m_address2NodeIdMap.size() + m_leafCount++;
-
-    Address2NodeId::AddResult result = m_address2NodeIdMap.add(to, s_firstNodeId + m_leafCount + m_address2NodeIdMap.size());
+    ASSERT(to);
+    Address2NodeId::AddResult result = m_address2NodeIdMap.add(to, m_address2NodeIdMap.size());
     return result.iterator->value;
 }
 
@@ -198,7 +194,7 @@ void HeapGraphSerializer::addRootNode()
 
     m_nodes->addItem(addString("Root"));
     m_nodes->addItem(0);
-    m_nodes->addItem(s_firstNodeId + m_address2NodeIdMap.size() + m_leafCount);
+    m_nodes->addItem(m_address2NodeIdMap.size());
     m_nodes->addItem(0);
     m_nodes->addItem(m_roots.size());
 }
index 0f18bfb..6d9c926 100644 (file)
 
 namespace WebCore {
 
+class HeapGraphEdge;
+class HeapGraphNode;
+class InspectorObject;
+
 class HeapGraphSerializer {
     WTF_MAKE_NONCOPYABLE(HeapGraphSerializer);
 public:
-
-    class Client {
-    public:
-        virtual ~Client() { }
-        virtual void addNativeSnapshotChunk(PassRefPtr<TypeBuilder::Memory::HeapSnapshotChunk>) = 0;
-    };
-
-    explicit HeapGraphSerializer(Client*);
+    explicit HeapGraphSerializer(InspectorFrontend::Memory*);
     ~HeapGraphSerializer();
     void reportNode(const WTF::MemoryObjectInfo&);
     void reportEdge(const void*, const char*, WTF::MemberType);
@@ -76,7 +73,7 @@ private:
     void reportEdgeImpl(const int toNodeId, const char* name, int memberType);
     int reportNodeImpl(const WTF::MemoryObjectInfo&, int edgesCount);
 
-    Client* m_client;
+    InspectorFrontend::Memory* m_frontend;
 
     typedef HashMap<String, int> StringMap;
     StringMap m_stringToIndex;
@@ -103,9 +100,6 @@ private:
 
     size_t m_edgeTypes[WTF::LastMemberTypeEntry];
     int m_unknownClassNameId;
-    int m_leafCount;
-
-    static const int s_firstNodeId = 1;
 };
 
 } // namespace WebCore
index c84188a..5f6a73d 100644 (file)
@@ -330,31 +330,11 @@ void InspectorMemoryAgent::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo)
     info.addMember(m_page, "page");
 }
 
-namespace {
-
-class FrontendWrapper : public HeapGraphSerializer::Client {
-public:
-    explicit FrontendWrapper(InspectorFrontend::Memory* frontend) : m_frontend(frontend) { }
-    virtual void addNativeSnapshotChunk(PassRefPtr<TypeBuilder::Memory::HeapSnapshotChunk> heapSnapshotChunk) OVERRIDE
-    {
-        m_frontend->addNativeSnapshotChunk(heapSnapshotChunk);
-    }
-private:
-    InspectorFrontend::Memory* m_frontend;
-};
-
-}
-
 void InspectorMemoryAgent::getProcessMemoryDistributionImpl(bool reportGraph, TypeNameToSizeMap* memoryInfo)
 {
     OwnPtr<HeapGraphSerializer> graphSerializer;
-    OwnPtr<FrontendWrapper> frontendWrapper;
-
-    if (reportGraph) {
-        frontendWrapper = adoptPtr(new FrontendWrapper(m_frontend));
-        graphSerializer = adoptPtr(new HeapGraphSerializer(frontendWrapper.get()));
-    }
-
+    if (reportGraph)
+        graphSerializer = adoptPtr(new HeapGraphSerializer(m_frontend));
     MemoryInstrumentationClientImpl memoryInstrumentationClient(graphSerializer.get());
     m_inspectorClient->getAllocatedObjects(memoryInstrumentationClient.allocatedObjects());
     MemoryInstrumentationImpl memoryInstrumentation(&memoryInstrumentationClient);
@@ -372,8 +352,6 @@ void InspectorMemoryAgent::getProcessMemoryDistributionImpl(bool reportGraph, Ty
     if (graphSerializer) {
         memoryInstrumentation.addRootObject(graphSerializer.get());
         graphSerializer->finish();
-        graphSerializer.release(); // Release it earlier than frontendWrapper
-        frontendWrapper.release();
     }
 
     m_inspectorClient->dumpUncountedAllocatedObjects(memoryInstrumentationClient.countedObjects());
index 63c5ad8..e2aa59e 100644 (file)
@@ -1,3 +1,12 @@
+2013-02-12  Jessie Berlin  <jberlin@apple.com>
+
+        Rollout r142618, it broke all the Mac builds.
+
+        * TestWebKitAPI/TestWebKitAPI.gypi:
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WebCore/HeapGraphSerializerTest.cpp: Removed.
+        * TestWebKitAPI/win/TestWebKitAPI.vcproj:
+
 2013-02-12  Yury Semikhatsky  <yurys@chromium.org>
 
         Unreviewed. Fix Chromium compilation after r142618.
index 2bb0fbd..5e7f17e 100644 (file)
@@ -31,7 +31,6 @@
 {
     'variables': {
         'TestWebKitAPI_files': [
-            'Tests/WebCore/HeapGraphSerializerTest.cpp',
             'Tests/WebCore/LayoutUnit.cpp',
             'Tests/WTF/AtomicString.cpp',
             'Tests/WTF/CheckedArithmeticOperations.cpp',
index 510125f..a1cc291 100644 (file)
@@ -14,7 +14,6 @@
                0FC6C4CC141027E0005B7F0C /* RedBlackTree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FC6C4CB141027E0005B7F0C /* RedBlackTree.cpp */; };
                0FC6C4CF141034AD005B7F0C /* MetaAllocator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FC6C4CE141034AD005B7F0C /* MetaAllocator.cpp */; };
                14464013167A8305000BD218 /* LayoutUnit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14464012167A8305000BD218 /* LayoutUnit.cpp */; };
-               788CB4AE348F4040827FCCD0 /* HeapGraphGeneratorTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 788CB4AE348F4040827FCCD0 /* HeapGraphGeneratorTest.cpp */; };
                14F3B11315E45EAB00210069 /* SaturatedArithmeticOperations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14F3B11215E45EAB00210069 /* SaturatedArithmeticOperations.cpp */; };
                1A02C84F125D4A8400E3F4BD /* Find.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A02C84E125D4A8400E3F4BD /* Find.cpp */; };
                1A02C870125D4CFD00E3F4BD /* find.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 1A02C84B125D4A5E00E3F4BD /* find.html */; };
                0FC6C4CB141027E0005B7F0C /* RedBlackTree.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RedBlackTree.cpp; path = WTF/RedBlackTree.cpp; sourceTree = "<group>"; };
                0FC6C4CE141034AD005B7F0C /* MetaAllocator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MetaAllocator.cpp; path = WTF/MetaAllocator.cpp; sourceTree = "<group>"; };
                14464012167A8305000BD218 /* LayoutUnit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutUnit.cpp; sourceTree = "<group>"; };
-               788CB4AE348F4040827FCCD0 /* HeapGraphGeneratorTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HeapGraphGeneratorTest.cpp; sourceTree = "<group>"; };
                14F3B11215E45EAB00210069 /* SaturatedArithmeticOperations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SaturatedArithmeticOperations.cpp; path = WTF/SaturatedArithmeticOperations.cpp; sourceTree = "<group>"; };
                1A02C84B125D4A5E00E3F4BD /* find.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = find.html; sourceTree = "<group>"; };
                1A02C84E125D4A8400E3F4BD /* Find.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Find.cpp; sourceTree = "<group>"; };
                        children = (
                                440A1D3814A0103A008A66F2 /* KURL.cpp */,
                                14464012167A8305000BD218 /* LayoutUnit.cpp */,
-                               788CB4AE348F4040827FCCD0 /* HeapGraphGeneratorTest.cpp */,
                        );
                        path = WebCore;
                        sourceTree = "<group>";
                                4BB4160216815B2600824238 /* JSWrapperForNodeInWebFrame.mm in Sources */,
                                440A1D3914A0103A008A66F2 /* KURL.cpp in Sources */,
                                14464013167A8305000BD218 /* LayoutUnit.cpp in Sources */,
-                               788CB4AE348F4040827FCCD0 /* HeapGraphGeneratorTest.cpp in Sources */,
                                26300B1816755CD90066886D /* ListHashSet.cpp in Sources */,
                                52CB47411448FB9300873995 /* LoadAlternateHTMLStringWithNonDirectoryURL.cpp in Sources */,
                                33DC8911141953A300747EF7 /* LoadCanceledNoServerRedirectCallback.cpp in Sources */,
diff --git a/Tools/TestWebKitAPI/Tests/WebCore/HeapGraphSerializerTest.cpp b/Tools/TestWebKitAPI/Tests/WebCore/HeapGraphSerializerTest.cpp
deleted file mode 100644 (file)
index 78ac7df..0000000
+++ /dev/null
@@ -1,282 +0,0 @@
-/*
- * Copyright (C) 2013 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "WTFStringUtilities.h"
-#include <gtest/gtest.h>
-
-#include "HeapGraphSerializer.h"
-#include "MemoryInstrumentationImpl.h"
-#include <wtf/MemoryInstrumentation.h>
-#include <wtf/MemoryInstrumentationHashSet.h>
-#include <wtf/MemoryInstrumentationString.h>
-#include <wtf/MemoryObjectInfo.h>
-
-namespace TestWebKitAPI {
-
-using namespace WebCore;
-
-static WTF::MemoryObjectType g_defaultObjectType = "DefaultObjectType";
-
-class HeapGraphReceiver : public HeapGraphSerializer::Client {
-public:
-    HeapGraphReceiver() : m_serializer(this) { }
-
-    virtual void addNativeSnapshotChunk(PassRefPtr<TypeBuilder::Memory::HeapSnapshotChunk> heapSnapshotChunk) OVERRIDE
-    {
-        ASSERT(!m_heapSnapshotChunk);
-        m_heapSnapshotChunk = heapSnapshotChunk;
-        m_strings = chunkPart("strings");
-        m_edges = chunkPart("edges");
-        m_nodes = chunkPart("nodes");
-
-        // Reset platform depended size field values.
-        for (InspectorArray::iterator i = m_nodes->begin(); i != m_nodes->end(); i += s_nodeFieldCount)
-            *(i + s_sizeOffset) = InspectorBasicValue::create(0);
-
-        m_id2index.clear();
-
-        for (unsigned index = 0; index < m_nodes->length(); index += s_nodeFieldCount)
-            m_id2index.add(intValue(m_nodes.get(), index + s_idOffset), index);
-    }
-
-    void printGraph()
-    {
-        EXPECT_TRUE(m_heapSnapshotChunk);
-        int processedEdgesCount = 0;
-        for (unsigned index = 0; index < m_nodes->length(); index += s_nodeFieldCount)
-            processedEdgesCount += printNode(index, processedEdgesCount);
-    }
-
-    String dumpNodes() { return dumpPart("nodes"); }
-    String dumpEdges() { return dumpPart("edges"); }
-    String dumpBaseToRealNodeId() { return dumpPart("baseToRealNodeId"); }
-    String dumpStrings() { return dumpPart("strings"); }
-
-    HeapGraphSerializer* serializer() { return &m_serializer; }
-
-private:
-    PassRefPtr<InspectorArray> chunkPart(String partName)
-    {
-        EXPECT_TRUE(m_heapSnapshotChunk);
-        RefPtr<InspectorObject> chunk = *reinterpret_cast<RefPtr<InspectorObject>*>(&m_heapSnapshotChunk);
-        RefPtr<InspectorValue> partValue = chunk->get(partName);
-        RefPtr<InspectorArray> partArray;
-        EXPECT_TRUE(partValue->asArray(&partArray));
-        return partArray.release();
-    }
-
-    String dumpPart(String partName)
-    {
-        return chunkPart(partName)->toJSONString().replace("\"", "'");
-    }
-
-    String stringValue(InspectorArray* array, int index)
-    {
-        RefPtr<InspectorValue> inspectorValue = array->get(index);
-        String value;
-        EXPECT_TRUE(inspectorValue->asString(&value));
-        return value;
-    }
-
-    int intValue(InspectorArray* array, int index)
-    {
-        RefPtr<InspectorValue> inspectorValue = array->get(index);
-        int value;
-        EXPECT_TRUE(inspectorValue->asNumber(&value));
-        return value;
-    }
-
-    String nodeToString(unsigned nodeIndex)
-    {
-        StringBuilder builder;
-        builder.append("node: ");
-        builder.appendNumber(intValue(m_nodes.get(), nodeIndex + s_idOffset));
-        builder.append(" with className:'");
-        builder.append(stringValue(m_strings.get(), intValue(m_nodes.get(), nodeIndex + s_classNameOffset)));
-        builder.append("' and name: '");
-        builder.append(stringValue(m_strings.get(), intValue(m_nodes.get(), nodeIndex + s_nameOffset)));
-        builder.append("'");
-        return builder.toString();
-    }
-
-    String edgeToString(unsigned edgeOrdinal)
-    {
-        unsigned edgeIndex = edgeOrdinal * s_edgeFieldCount;
-        StringBuilder builder;
-        builder.append("'");
-        builder.append(stringValue(m_strings.get(), intValue(m_edges.get(), edgeIndex + s_edgeTypeOffset)));
-        builder.append("' edge '");
-        builder.append(stringValue(m_strings.get(), intValue(m_edges.get(), edgeIndex + s_edgeNameOffset)));
-        builder.append("' points to ");
-        int nodeId = intValue(m_edges.get(), edgeIndex + s_toNodeIdOffset);
-        builder.append(nodeToString(m_id2index.get(nodeId)));
-        return builder.toString();
-    }
-
-    int printNode(unsigned nodeIndex, unsigned processedEdgesCount)
-    {
-        String nodeString = nodeToString(nodeIndex);
-        int edgeCount = intValue(m_nodes.get(), nodeIndex + s_edgeCountOffset);
-
-        printf("%s\n", nodeString.utf8().data());
-        for (int i = 0; i < edgeCount; ++i) {
-            String edgeText = edgeToString(i + processedEdgesCount);
-            printf("\thas %s\n", edgeText.utf8().data());
-        }
-        return edgeCount;
-    }
-
-    HeapGraphSerializer m_serializer;
-    RefPtr<TypeBuilder::Memory::HeapSnapshotChunk> m_heapSnapshotChunk;
-
-    RefPtr<InspectorArray> m_strings;
-    RefPtr<InspectorArray> m_nodes;
-    RefPtr<InspectorArray> m_edges;
-    HashMap<int, int> m_id2index;
-
-    static const int s_nodeFieldCount = 5;
-    static const int s_classNameOffset = 0;
-    static const int s_nameOffset = 1;
-    static const int s_idOffset = 2;
-    static const int s_sizeOffset = 3;
-    static const int s_edgeCountOffset = 4;
-
-    static const int s_edgeFieldCount = 3;
-    static const int s_edgeTypeOffset = 0;
-    static const int s_edgeNameOffset = 1;
-    static const int s_toNodeIdOffset = 2;
-};
-
-class Helper {
-public:
-    Helper(HeapGraphSerializer* serializer) : m_serializer(serializer), m_currentPointer(0) { }
-    void* addNode(const char* className, const char* name, bool isRoot)
-    {
-        WTF::MemoryObjectInfo info(0, g_defaultObjectType, ++m_currentPointer);
-        info.setClassName(className);
-        info.setName(name);
-        if (isRoot)
-            info.markAsRoot();
-        m_serializer->reportNode(info);
-        return m_currentPointer;
-    }
-
-    void addEdge(void* to, const char* edgeName, WTF::MemberType memberType)
-    {
-        m_serializer->reportEdge(to, edgeName, memberType);
-    }
-
-    void done()
-    {
-        m_serializer->finish();
-    }
-
-private:
-    HeapGraphSerializer* m_serializer;
-
-    class Object {
-        char m_data[sizeof(void*)];
-    };
-    Object* m_currentPointer;
-};
-
-TEST(HeapGraphSerializerTest, snapshotWithoutUserObjects)
-{
-    HeapGraphReceiver receiver;
-    Helper helper(receiver.serializer());
-    helper.done();
-    receiver.printGraph();
-    EXPECT_EQ(String("['','weak','ownRef','countRef','unknown','Root']"), receiver.dumpStrings());
-    EXPECT_EQ(String("[5,0,1,0,0]"), receiver.dumpNodes()); // Only Root object.
-    EXPECT_EQ(String("[]"), receiver.dumpEdges()); // No edges.
-    EXPECT_EQ(String("[]"), receiver.dumpBaseToRealNodeId()); // No id maps.
-}
-
-TEST(HeapGraphSerializerTest, oneRootUserObject)
-{
-    HeapGraphReceiver receiver;
-    Helper helper(receiver.serializer());
-    helper.addNode("ClassName", "objectName", true);
-    helper.done();
-    receiver.printGraph();
-    EXPECT_EQ(String("['','weak','ownRef','countRef','unknown','ClassName','objectName','Root']"), receiver.dumpStrings());
-    EXPECT_EQ(String("[5,6,1,0,0,7,0,2,0,1]"), receiver.dumpNodes());
-    EXPECT_EQ(String("[1,0,1]"), receiver.dumpEdges());
-    EXPECT_EQ(String("[]"), receiver.dumpBaseToRealNodeId());
-}
-
-TEST(HeapGraphSerializerTest, twoUserObjectsWithEdge)
-{
-    HeapGraphReceiver receiver;
-    Helper helper(receiver.serializer());
-    void* childObject = helper.addNode("Child", "child", false);
-    helper.addEdge(childObject, "pointerToChild", WTF::OwnPtrMember);
-    helper.addNode("Parent", "parent", true);
-    helper.done();
-    receiver.printGraph();
-    EXPECT_EQ(String("['','weak','ownRef','countRef','unknown','Child','child','pointerToChild','Parent','parent','Root']"), receiver.dumpStrings());
-    EXPECT_EQ(String("[5,6,1,0,0,8,9,2,0,1,10,0,3,0,1]"), receiver.dumpNodes());
-    EXPECT_EQ(String("[2,7,1,1,0,2]"), receiver.dumpEdges());
-    EXPECT_EQ(String("[]"), receiver.dumpBaseToRealNodeId());
-}
-
-class Owner {
-public:
-    Owner()
-    {
-        m_strings.add("first element");
-        m_strings.add("second element");
-    }
-    void reportMemoryUsage(WTF::MemoryObjectInfo* memoryObjectInfo) const
-    {
-        WTF::MemoryClassInfo info(memoryObjectInfo, this, g_defaultObjectType);
-        info.addMember(m_strings, "strings");
-    }
-private:
-    HashSet<String> m_strings;
-};
-
-TEST(HeapGraphSerializerTest, hashSetWithTwoStrings)
-{
-    HeapGraphReceiver receiver;
-    MemoryInstrumentationClientImpl memoryInstrumentationClient(receiver.serializer());
-    MemoryInstrumentationImpl memoryInstrumentation(&memoryInstrumentationClient);
-
-    Owner owner;
-    memoryInstrumentation.addRootObject(&owner);
-    receiver.serializer()->finish();
-    receiver.printGraph();
-    EXPECT_EQ(String("[5,0,1,0,0,8,0,4,0,3,9,0,3,0,0,9,0,2,0,0,10,0,5,0,1]"), receiver.dumpNodes());
-    EXPECT_EQ(String("[2,6,1,1,7,2,1,7,3,1,0,4]"), receiver.dumpEdges());
-    EXPECT_EQ(String("[]"), receiver.dumpBaseToRealNodeId());
-}
-
-} // namespace
index c98da75..3a2fe95 100644 (file)
                                        </File>
                                </Filter>
                                <File
-                                       RelativePath="..\Tests\WebCore\HeapGraphGeneratorTest.cpp"
-                                       >
-                               </File>
-                               <File
                                        RelativePath="..\Tests\WebCore\LayoutUnit.cpp"
                                        >
                                </File>